| 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-revision-details.html"> |
| 8 | 8 |
| 9 <link rel="import" href="../../model/ct-builder-revisions-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 | 11 |
| 11 <script> | 12 <script> |
| 12 (function () { | 13 (function () { |
| 13 | 14 |
| 14 var assert = chai.assert; | 15 var assert = chai.assert; |
| 15 | 16 |
| 16 describe('ct-commit-list', function() { | 17 describe('ct-revision-details', function() { |
| 17 var list; | 18 var revisionDetails; |
| 18 var numCommits; | |
| 19 | 19 |
| 20 beforeEach(function(done) { | 20 describe('empty', function() { |
| 21 list = document.createElement('ct-commit-list'); | 21 before(function(done) { |
| 22 list.commits = new CTCommitLogMock(); | 22 revisionDetails = document.createElement('ct-revision-details'); |
| 23 | 23 setTimeout(done); |
| 24 // FIXME: This test shouldn't rely on firstRevision being empty to pass. | |
| 25 if (numCommits > 0) | |
| 26 list.commits.firstRevision = {}; | |
| 27 | |
| 28 var blinkCommits = list.commits.commits.blink; | |
| 29 var revision; | |
| 30 for (revision in blinkCommits) | |
| 31 break; | |
| 32 | |
| 33 list.first = {blink: revision}; | |
| 34 list.last = {blink: Number(revision) + numCommits}; | |
| 35 | |
| 36 setTimeout(done); | |
| 37 }); | |
| 38 | |
| 39 describe('commit list UI', function() { | |
| 40 before(function() { | |
| 41 numCommits = 2; | |
| 42 }); | 24 }); |
| 43 | 25 |
| 44 it('should show all commits in revision range', function() { | 26 it('should not show revision', function() { |
| 45 var commits = list.shadowRoot.querySelectorAll('ct-commit'); | 27 assert.isNull(revisionDetails.shadowRoot.querySelector('#fullyProcessedRev
ision')); |
| 46 assert.lengthOf(commits, numCommits); | 28 assert.isNull(revisionDetails.shadowRoot.querySelector('#trunkRevision')); |
| 47 }); | 29 }); |
| 48 }); | 30 }); |
| 49 | 31 |
| 50 describe('empty commit list UI', function() { | 32 describe('blink revision', function() { |
| 51 before(function() { | 33 before(function(done) { |
| 52 numCommits = 0; | 34 revisionDetails = document.createElement('ct-revision-details'); |
| 35 |
| 36 var builderRevisions = CTBuilderRevisionsMock(); |
| 37 var commitLog = CTCommitLogMock(); |
| 38 commitLog._findFirstAndLastRevisions('blink'); |
| 39 |
| 40 revisionDetails.builderLatestRevisions = builderRevisions; |
| 41 revisionDetails.tree = 'blink'; |
| 42 revisionDetails.revisionLog = commitLog; |
| 43 |
| 44 setTimeout(done); |
| 53 }); | 45 }); |
| 54 | 46 |
| 55 it('should show no commits for backwards revision range', function() { | 47 it('should show the revision', function() { |
| 56 var commits = list.shadowRoot.querySelectorAll('ct-commit'); | 48 assert.equal(revisionDetails.shadowRoot.querySelector('#fullyProcessedRevi
sion').innerText, '158543'); |
| 57 assert.lengthOf(commits, numCommits); | 49 assert.equal(revisionDetails.shadowRoot.querySelector('#trunkRevision').in
nerText, '158545'); |
| 58 }); | 50 }); |
| 59 }); | 51 }); |
| 60 }); | 52 }); |
| 61 | 53 |
| 62 })() | 54 })(); |
| 63 </script> | 55 </script> |
| OLD | NEW |