| 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-log-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 | |
| 22 setTimeout(done); | 21 setTimeout(done); |
| 23 }); | 22 }); |
| 24 | 23 |
| 25 describe('commit list UI', function() { | 24 describe('commit list UI', function() { |
| 26 beforeEach(function(done) { | 25 beforeEach(function(done) { |
| 26 var repos = [ |
| 27 { commits: [ new CTCommitMock(), new CTCommitMock() ], |
| 28 expanded: false }, |
| 29 { commits: [ new CTCommitMock(), new CTCommitMock() ], |
| 30 expanded: false } |
| 31 ]; |
| 32 |
| 27 var CommitList = Object.create(Object); | 33 var CommitList = Object.create(Object); |
| 28 CommitList.prototype.repositories = function() { | 34 CommitList.prototype.repositories = function() { |
| 29 return [ | 35 return repos; |
| 30 { commits: [ new CTCommitMock(), new CTCommitMock() ] }, | |
| 31 { commits: [ new CTCommitMock(), new CTCommitMock() ] } | |
| 32 ] | |
| 33 }; | 36 }; |
| 34 list.commitList = CommitList; | 37 list.commitList = CommitList; |
| 35 | 38 |
| 36 setTimeout(done); | 39 setTimeout(done); |
| 37 }); | 40 }); |
| 38 | 41 |
| 39 it('should show all commits in revision range', function() { | 42 it('should show no commits by default', function() { |
| 40 var commits = list.shadowRoot.querySelectorAll('ct-commit'); | 43 var commits = list.shadowRoot.querySelectorAll('ct-commit'); |
| 41 assert.lengthOf(commits, 4); | 44 assert.lengthOf(commits, 0); |
| 45 }); |
| 46 |
| 47 describe('expanded test', function() { |
| 48 beforeEach(function(done) { |
| 49 list.commitList.repositories().first().expanded = true; |
| 50 list.commitList.repositories().last().expanded = true; |
| 51 setTimeout(done); |
| 52 }); |
| 53 |
| 54 it('should show commits when expanded', function() { |
| 55 assert.lengthOf(list.shadowRoot.querySelectorAll('ct-commit'), 4); |
| 56 }); |
| 42 }); | 57 }); |
| 43 }); | 58 }); |
| 44 }); | 59 }); |
| 45 | 60 |
| 46 })() | 61 })() |
| 47 </script> | 62 </script> |
| OLD | NEW |