2 Copyright 2014 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
7 <link rel="import" href="../ct-step-failure-card.html">
9 <link rel="import" href="../../model/ct-commit-list-mock.html">
10 <link rel="import" href="../../model/ct-commit-log-mock.html">
11 <link rel="import" href="../../model/ct-failure-group.html">
16 var assert = chai.assert;
18 describe('ct-step-failure-card', function() {
23 beforeEach(function(done) {
24 card = document.createElement('ct-step-failure-card');
25 var cl = new CTCommitListMock();
26 group = new CTFailureGroup('', new CTStepFailureGroupData([
27 new CTStepFailure('autobot', 'unknown', {someBuilder: {key: 'a'}}, {'blink':158547},
28 {'blink':158544})], cl));
29 card.group = group.data;
30 card.commitLog = new CTCommitLogMock();
34 describe('failure card UI', function() {
36 it('should have commit summaries', function(done) {
37 // Expand the first repository so that the <ct-commit>'s are generated.
38 card.group.commitList.repositories[0].expanded = true;
40 setTimeout(function() {
41 var list = card.shadowRoot.querySelector('ct-commit-list');
42 var commits = list.shadowRoot.querySelectorAll('ct-commit');
43 assert(commits[1].data);
44 assert(commits[1].data.summary);
49 it('removing a commit summary', function(done) {
50 card.commitLog.commits['blink']['158545'].summary = undefined;
51 card.group.commitList.repositories[0].expanded = true;
53 setTimeout(function() {
54 var list = card.shadowRoot.querySelector('ct-commit-list');
55 var commits = list.shadowRoot.querySelectorAll('ct-commit');
56 assert.notOk(commits[0].data.summary);