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-stream.html"> | 7 <link rel="import" href="../ct-failure-stream.html"> |
8 | 8 |
9 <script> | 9 <script> |
10 (function () { | 10 (function () { |
11 | 11 |
12 var assert = chai.assert; | 12 var assert = chai.assert; |
13 | 13 |
14 describe('ct-failure-stream', function() { | 14 describe('ct-failure-stream', function() { |
15 | 15 |
16 var stream; | 16 var stream; |
17 | 17 |
18 beforeEach(function(done) { | 18 beforeEach(function(done) { |
19 stream = document.createElement('ct-failure-stream'); | 19 stream = document.createElement('ct-failure-stream'); |
20 setTimeout(done); | 20 setTimeout(done); |
21 }); | 21 }); |
22 | 22 |
23 describe('default ui', function() { | 23 describe('default ui', function() { |
24 it('should show failure groups', function(done) { | 24 it('should show failure groups', function(done) { |
25 // FIXME: We should use some more interesting test data, but | 25 // FIXME: We should use some more interesting test data, but |
26 // ct-failure-stream will give these values to ct-commit-data, | 26 // ct-failure-stream will give these values to ct-commit-data, |
27 // which will hit the network unless we figure out how to mock | 27 // which will hit the network unless we figure out how to mock |
28 // out ct-commit-data in a better way. | 28 // out ct-commit-data in a better way. |
29 stream.groups = [new CTFailureGroup([], undefined), new CTFailureGroup([],
undefined)]; | 29 stream.groups = [new CTFailureGroup('', [], undefined), |
| 30 new CTFailureGroup('', [], undefined)]; |
30 stream.category = 'default'; | 31 stream.category = 'default'; |
31 setTimeout(function() { | 32 setTimeout(function() { |
32 var cards = stream.shadowRoot.querySelectorAll('ct-failure-card'); | 33 var cards = stream.shadowRoot.querySelectorAll('ct-failure-card'); |
33 assert.equal(cards.length, 2); | 34 assert.equal(cards.length, 2); |
34 done(); | 35 done(); |
35 }); | 36 }); |
36 }); | 37 }); |
37 }); | 38 }); |
38 | 39 |
39 describe('category', function() { | 40 describe('category', function() { |
40 it('should only show failure groups for the specified category', function(do
ne) { | 41 it('should only show failure groups for the specified category', function(do
ne) { |
41 var failures = [new CTFailure('step', 'reason', [{key: 'a', annotation: {s
noozeTime: Date.now() + 1000 * 1000}}])]; | 42 var failures = [new CTFailure('step', 'reason', [{key: 'a', annotation: {s
noozeTime: Date.now() + 1000 * 1000}}])]; |
42 var snoozed = new CTFailureGroup(failures, undefined); | 43 var snoozed = new CTFailureGroup('', failures, undefined); |
43 stream.groups = [new CTFailureGroup([], undefined), snoozed]; | 44 stream.groups = [new CTFailureGroup('', [], undefined), snoozed]; |
44 stream.category = 'snoozed'; | 45 stream.category = 'snoozed'; |
45 setTimeout(function() { | 46 setTimeout(function() { |
46 var cards = stream.shadowRoot.querySelectorAll('ct-failure-card'); | 47 var cards = stream.shadowRoot.querySelectorAll('ct-failure-card'); |
47 assert.equal(cards.length, 1); | 48 assert.equal(cards.length, 1); |
48 assert.equal(cards[0].group, snoozed); | 49 assert.equal(cards[0].group, snoozed); |
49 done(); | 50 done(); |
50 }); | 51 }); |
51 }); | 52 }); |
52 }); | 53 }); |
53 }); | 54 }); |
54 | 55 |
55 })(); | 56 })(); |
56 </script> | 57 </script> |
OLD | NEW |