OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. | 4 found in the LICENSE file. |
5 --> | 5 --> |
6 | 6 |
7 <link rel="import" href="../ct-failure-card.html"> | 7 <link rel="import" href="../ct-failure-card.html"> |
8 | 8 |
| 9 <link rel="import" href="../../model/ct-commit-list-mock.html"> |
9 <link rel="import" href="../../model/ct-commit-log-mock.html"> | 10 <link rel="import" href="../../model/ct-commit-log-mock.html"> |
10 <link rel="import" href="../../model/ct-failure-group.html"> | 11 <link rel="import" href="../../model/ct-failure-group.html"> |
11 | 12 |
12 <script> | 13 <script> |
13 (function () { | 14 (function () { |
14 | 15 |
15 var assert = chai.assert; | 16 var assert = chai.assert; |
16 | 17 |
17 describe('ct-failure-card', function() { | 18 describe('ct-failure-card', function() { |
18 var group; | 19 var group; |
19 var card; | 20 var card; |
20 var failures; | 21 var failures; |
21 | 22 |
22 beforeEach(function(done) { | 23 beforeEach(function(done) { |
23 card = document.createElement('ct-failure-card'); | 24 card = document.createElement('ct-failure-card'); |
| 25 var cl = new CTCommitListMock(); |
24 group = new CTFailureGroup([ | 26 group = new CTFailureGroup([ |
25 new CTFailure('autobot', 'unknown', {someBuilder: {key: 'a'}}, {'blink':
158547}, | 27 new CTFailure('autobot', 'unknown', {someBuilder: {key: 'a'}}, {'blink':
158547}, |
26 {'blink':158544})]); | 28 {'blink':158544})], cl); |
27 card.group = group; | 29 card.group = group; |
28 card.commitLog = new CTCommitLogMock(); | 30 card.commitLog = new CTCommitLogMock(); |
29 setTimeout(done); | 31 setTimeout(done); |
30 }); | 32 }); |
31 | 33 |
32 describe('failure card UI', function() { | 34 describe('failure card UI', function() { |
33 | 35 |
34 it('should have commit summaries', function(done) { | 36 it('should have commit summaries', function(done) { |
35 // Expand the first repository so that the <ct-commit>'s are generated. | 37 // Expand the first repository so that the <ct-commit>'s are generated. |
36 card._commitList.repositories[0].expanded = true; | 38 card.group.commitList.repositories[0].expanded = true; |
37 | 39 |
38 setTimeout(function() { | 40 setTimeout(function() { |
39 var list = card.shadowRoot.querySelector('ct-commit-list'); | 41 var list = card.shadowRoot.querySelector('ct-commit-list'); |
40 var commits = list.shadowRoot.querySelectorAll('ct-commit'); | 42 var commits = list.shadowRoot.querySelectorAll('ct-commit'); |
41 assert(commits[0].data); | 43 assert(commits[1].data); |
42 assert(commits[0].data.summary); | 44 assert(commits[1].data.summary); |
43 done(); | 45 done(); |
44 }); | 46 }); |
45 }); | 47 }); |
46 | 48 |
47 it('removing a commit summary', function(done) { | 49 it('removing a commit summary', function(done) { |
48 card.commitLog.commits['blink']['158545'].summary = undefined; | 50 card.commitLog.commits['blink']['158545'].summary = undefined; |
49 card._commitList.repositories[0].expanded = true; | 51 card.group.commitList.repositories[0].expanded = true; |
50 | 52 |
51 setTimeout(function() { | 53 setTimeout(function() { |
52 var list = card.shadowRoot.querySelector('ct-commit-list'); | 54 var list = card.shadowRoot.querySelector('ct-commit-list'); |
53 var commits = list.shadowRoot.querySelectorAll('ct-commit'); | 55 var commits = list.shadowRoot.querySelectorAll('ct-commit'); |
54 assert.notOk(commits[0].data.summary); | 56 assert.notOk(commits[0].data.summary); |
55 done(); | 57 done(); |
56 }); | 58 }); |
57 }); | 59 }); |
58 | 60 |
59 it('examine should dispatch event', function(done) { | 61 it('examine should dispatch event', function(done) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 done(); | 130 done(); |
129 }); | 131 }); |
130 }); | 132 }); |
131 }); | 133 }); |
132 }); | 134 }); |
133 | 135 |
134 }); | 136 }); |
135 | 137 |
136 })() | 138 })() |
137 </script> | 139 </script> |
OLD | NEW |