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 module("ct-commit-list"); | 14 module("ct-commit-list"); |
15 | 15 |
16 asyncTest("basic", 2, function() { | 16 asyncTest("basic", 1, function() { |
17 var list = document.createElement('ct-commit-list'); | 17 var list = document.createElement('ct-commit-list'); |
18 | 18 |
19 list.first = 158545; | |
20 list.last = 158547; | |
21 list.commits = new CTCommitLogMock(); | 19 list.commits = new CTCommitLogMock(); |
22 | 20 |
23 Platform.endOfMicrotask(function() { | 21 var blinkCommits = list.commits.commits.blink; |
| 22 var revision; |
| 23 for (revision in blinkCommits) |
| 24 break; |
| 25 |
| 26 var numCommits = 2; |
| 27 |
| 28 list.first = {blink: revision}; |
| 29 list.last = {blink: Number(revision) + numCommits}; |
| 30 |
| 31 requestAnimationFrame(function() { |
24 var commits = list.shadowRoot.querySelectorAll('ct-commit'); | 32 var commits = list.shadowRoot.querySelectorAll('ct-commit'); |
25 equal(commits.length, 1); | 33 equal(commits.length, numCommits); |
26 deepEqual(list._revisions, [158545, 158546, 158547]) | |
27 | 34 |
28 start(); | 35 start(); |
29 }); | 36 }); |
| 37 }); |
| 38 |
| 39 asyncTest("backwards", 1, function() { |
| 40 var list = document.createElement('ct-commit-list'); |
| 41 |
| 42 list.commits = new CTCommitLogMock(); |
| 43 |
| 44 var blinkCommits = list.commits.commits.blink; |
| 45 var revision; |
| 46 for (revision in blinkCommits) |
| 47 break; |
| 48 |
| 49 list.first = {blink: revision}; |
| 50 list.last = {blink: Number(revision) - 1}; |
| 51 |
| 52 requestAnimationFrame(function() { |
| 53 var commits = list.shadowRoot.querySelectorAll('ct-commit'); |
| 54 equal(commits.length, 0); |
| 55 |
| 56 start(); |
| 57 }); |
30 }); | 58 }); |
31 | 59 |
32 })() | 60 })() |
33 </script> | 61 </script> |
OLD | NEW |