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 | 21 |
21 beforeEach(function(done) { | 22 beforeEach(function(done) { |
22 card = document.createElement('ct-failure-card'); | 23 card = document.createElement('ct-failure-card'); |
| 24 var cl = new CTCommitListMock(); |
23 group = new CTFailureGroup('key', [ | 25 group = new CTFailureGroup('key', [ |
24 new CTFailure('autobot', 'unknown', {}, {'blink':158547}, | 26 new CTFailure('autobot', 'unknown', {})], cl); |
25 {'blink':158544})]); | |
26 card.group = group; | 27 card.group = group; |
27 card.commitLog = new CTCommitLogMock(); | 28 card.commitLog = new CTCommitLogMock(); |
28 setTimeout(done); | 29 setTimeout(done); |
29 }); | 30 }); |
30 | 31 |
31 describe('failure card UI', function() { | 32 describe('failure card UI', function() { |
32 | 33 |
33 it('should have commit summaries', function(done) { | 34 it('should have commit summaries', function(done) { |
34 // Expand the first repository so that the <ct-commit>'s are generated. | 35 // Expand the first repository so that the <ct-commit>'s are generated. |
35 card._commitList.repositories[0].expanded = true; | 36 card.group.commitList.repositories[0].expanded = true; |
36 | 37 |
37 setTimeout(function() { | 38 setTimeout(function() { |
38 var list = card.shadowRoot.querySelector('ct-commit-list'); | 39 var list = card.shadowRoot.querySelector('ct-commit-list'); |
39 var commits = list.shadowRoot.querySelectorAll('ct-commit'); | 40 var commits = list.shadowRoot.querySelectorAll('ct-commit'); |
40 assert(commits[0].data); | 41 assert(commits[1].data); |
41 assert(commits[0].data.summary); | 42 assert(commits[1].data.summary); |
42 done(); | 43 done(); |
43 }); | 44 }); |
44 }); | 45 }); |
45 | 46 |
46 it('removing a commit summary', function(done) { | 47 it('removing a commit summary', function(done) { |
47 card.commitLog.commits['blink']['158545'].summary = undefined; | 48 card.commitLog.commits['blink']['158545'].summary = undefined; |
48 card._commitList.repositories[0].expanded = true; | 49 card.group.commitList.repositories[0].expanded = true; |
49 | 50 |
50 setTimeout(function() { | 51 setTimeout(function() { |
51 var list = card.shadowRoot.querySelector('ct-commit-list'); | 52 var list = card.shadowRoot.querySelector('ct-commit-list'); |
52 var commits = list.shadowRoot.querySelectorAll('ct-commit'); | 53 var commits = list.shadowRoot.querySelectorAll('ct-commit'); |
53 assert.notOk(commits[0].data.summary); | 54 assert.notOk(commits[0].data.summary); |
54 done(); | 55 done(); |
55 }); | 56 }); |
56 }); | 57 }); |
57 | 58 |
58 it('examine should dispatch event', function(done) { | 59 it('examine should dispatch event', function(done) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 done(); | 128 done(); |
128 }); | 129 }); |
129 }); | 130 }); |
130 }); | 131 }); |
131 }); | 132 }); |
132 | 133 |
133 }); | 134 }); |
134 | 135 |
135 })() | 136 })() |
136 </script> | 137 </script> |
OLD | NEW |