Index: Tools/GardeningServer/ui/test/ct-commit-list-tests.html |
diff --git a/Tools/GardeningServer/ui/test/ct-commit-list-tests.html b/Tools/GardeningServer/ui/test/ct-commit-list-tests.html |
index 6a45f9edaab6b09030ae15ee972dcf70a7fb6a18..48815c9fea7a129cdc5e1b6cd60c287be869c1a1 100644 |
--- a/Tools/GardeningServer/ui/test/ct-commit-list-tests.html |
+++ b/Tools/GardeningServer/ui/test/ct-commit-list-tests.html |
@@ -15,46 +15,45 @@ var assert = chai.assert; |
describe('ct-commit-list', function() { |
var list; |
- var numCommits; |
beforeEach(function(done) { |
list = document.createElement('ct-commit-list'); |
- list.commits = new CTCommitLogMock(); |
- |
- // FIXME: This test shouldn't rely on firstRevision being empty to pass. |
- if (numCommits > 0) |
- list.commits.firstRevision = {}; |
- |
- var blinkCommits = list.commits.commits.blink; |
- var revision; |
- for (revision in blinkCommits) |
- break; |
- |
- list.first = {blink: revision}; |
- list.last = {blink: Number(revision) + numCommits}; |
- |
setTimeout(done); |
}); |
describe('commit list UI', function() { |
- before(function() { |
- numCommits = 2; |
+ beforeEach(function(done) { |
+ var repos = [ |
+ { commits: [ new CTCommitMock(), new CTCommitMock() ], |
+ expanded: false }, |
+ { commits: [ new CTCommitMock(), new CTCommitMock() ], |
+ expanded: false } |
+ ]; |
+ |
+ var CommitList = Object.create(Object); |
+ CommitList.prototype.repositories = function() { |
+ return repos; |
+ }; |
+ list.commitList = CommitList; |
+ |
+ setTimeout(done); |
}); |
- it('should show all commits in revision range', function() { |
+ it('should show no commits by default', function() { |
var commits = list.shadowRoot.querySelectorAll('ct-commit'); |
- assert.lengthOf(commits, numCommits); |
+ assert.lengthOf(commits, 0); |
}); |
- }); |
- describe('empty commit list UI', function() { |
- before(function() { |
- numCommits = 0; |
- }); |
+ describe('expanded test', function() { |
+ beforeEach(function(done) { |
+ list.commitList.repositories().first().expanded = true; |
+ list.commitList.repositories().last().expanded = true; |
+ setTimeout(done); |
+ }); |
- it('should show no commits for backwards revision range', function() { |
- var commits = list.shadowRoot.querySelectorAll('ct-commit'); |
- assert.lengthOf(commits, numCommits); |
+ it('should show commits when expanded', function() { |
+ assert.lengthOf(list.shadowRoot.querySelectorAll('ct-commit'), 4); |
+ }); |
}); |
}); |
}); |