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-commit-list.html"> | 7 <link rel="import" href="../ct-commit-list.html"> |
8 | 8 |
9 <link rel="import" href="../../model/ct-commit-log-mock.html"> | 9 <link rel="import" href="../../model/ct-commit-list-mock.html"> |
10 | 10 |
11 <script> | 11 <script> |
12 (function () { | 12 (function () { |
13 | 13 |
14 var assert = chai.assert; | 14 var assert = chai.assert; |
15 | 15 |
16 describe('ct-commit-list', function() { | 16 describe('ct-commit-list', function() { |
17 var list; | 17 var list; |
18 | 18 |
19 beforeEach(function(done) { | 19 beforeEach(function(done) { |
20 list = document.createElement('ct-commit-list'); | 20 list = document.createElement('ct-commit-list'); |
21 setTimeout(done); | 21 setTimeout(done); |
22 }); | 22 }); |
23 | 23 |
24 describe('commit list UI', function() { | 24 describe('commit list UI', function() { |
25 beforeEach(function(done) { | 25 beforeEach(function(done) { |
26 var repos = [ | 26 list.commitList = new CTCommitListMock(); |
27 { commits: [ new CTCommitMock(), new CTCommitMock() ], | |
28 expanded: false }, | |
29 { commits: [ new CTCommitMock(), new CTCommitMock() ], | |
30 expanded: false } | |
31 ]; | |
32 | |
33 list.commitList = { | |
34 repositories: function() { | |
35 return repos; | |
36 } | |
37 }; | |
38 | |
39 setTimeout(done); | 27 setTimeout(done); |
40 }); | 28 }); |
41 | 29 |
42 it('should show no commits by default', function() { | 30 it('should show no commits by default', function() { |
43 var commits = list.shadowRoot.querySelectorAll('ct-commit'); | 31 var commits = list.shadowRoot.querySelectorAll('ct-commit'); |
44 assert.lengthOf(commits, 0); | 32 assert.lengthOf(commits, 0); |
45 }); | 33 }); |
46 | 34 |
47 describe('expanded test', function() { | 35 describe('expanded test', function() { |
48 beforeEach(function(done) { | 36 beforeEach(function(done) { |
49 list.commitList.repositories().first().expanded = true; | 37 list.commitList.repositories.first().expanded = true; |
50 list.commitList.repositories().last().expanded = true; | |
51 setTimeout(done); | 38 setTimeout(done); |
52 }); | 39 }); |
53 | 40 |
54 it('should show commits when expanded', function() { | 41 it('should show commit when expanded', function() { |
55 assert.lengthOf(list.shadowRoot.querySelectorAll('ct-commit'), 4); | 42 assert.lengthOf(list.shadowRoot.querySelectorAll('ct-commit'), 1); |
56 }); | 43 }); |
57 }); | 44 }); |
58 }); | 45 }); |
59 }); | 46 }); |
60 | 47 |
61 })() | 48 })() |
62 </script> | 49 </script> |
OLD | NEW |