| <!-- |
| Copyright 2014 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| |
| <link rel="import" href="ct-commit-list.html"> |
| |
| <link rel="import" href="../model/ct-commit-log-mock.html"> |
| |
| <script> |
| (function () { |
| |
| module("ct-commit-list"); |
| |
| asyncTest("basic", 1, function() { |
| var list = document.createElement('ct-commit-list'); |
| |
| list.commits = new CTCommitLogMock(); |
| |
| // FIXME: This test shouldn't rely on firstRevision being empty to pass. |
| list.commits.firstRevision = {}; |
| |
| var blinkCommits = list.commits.commits.blink; |
| var revision; |
| for (revision in blinkCommits) |
| break; |
| |
| var numCommits = 2; |
| |
| list.first = {blink: revision}; |
| list.last = {blink: Number(revision) + numCommits}; |
| |
| requestAnimationFrame(function() { |
| var commits = list.shadowRoot.querySelectorAll('ct-commit'); |
| equal(commits.length, numCommits); |
| |
| start(); |
| }); |
| }); |
| |
| asyncTest("backwards", 1, function() { |
| var list = document.createElement('ct-commit-list'); |
| |
| list.commits = new CTCommitLogMock(); |
| |
| var blinkCommits = list.commits.commits.blink; |
| var revision; |
| for (revision in blinkCommits) |
| break; |
| |
| list.first = {blink: revision}; |
| list.last = {blink: Number(revision) - 1}; |
| |
| requestAnimationFrame(function() { |
| var commits = list.shadowRoot.querySelectorAll('ct-commit'); |
| equal(commits.length, 0); |
| |
| start(); |
| }); |
| }); |
| |
| })() |
| </script> |