| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 cr.define('md_history.history_item_test', function() { |
| 6 var TEST_HISTORY_RESULTS = [ |
| 7 {"time": "1000000000"}, |
| 8 {"time": "10000000"}, |
| 9 {"time": "900000"}, |
| 10 {"time": "899999"} |
| 11 ]; |
| 12 |
| 13 function registerTests() { |
| 14 suite('history-item', function() { |
| 15 var element; |
| 16 |
| 17 suiteSetup(function() { |
| 18 element = $('history-list'); |
| 19 }); |
| 20 |
| 21 test('basic separator insertion', function() { |
| 22 element.addNewResults(TEST_HISTORY_RESULTS); |
| 23 |
| 24 flush(function() { |
| 25 // Check that the correct number of time gaps are inserted. |
| 26 var spacers = |
| 27 Polymer.dom(element.root).querySelectorAll('#time-gap-separator'); |
| 28 assertEquals(2, spacers.length); |
| 29 |
| 30 var items = Polymer.dom(element.root) |
| 31 .querySelectorAll('history-item'); |
| 32 assertTrue(items[0].hasTimeGap); |
| 33 assertTrue(items[1].hasTimeGap); |
| 34 assertFalse(items[2].hasTimeGap); |
| 35 }); |
| 36 }); |
| 37 |
| 38 teardown(function() { |
| 39 element.historyDataByDay_ = []; |
| 40 }); |
| 41 }); |
| 42 } |
| 43 return { |
| 44 registerTests: registerTests |
| 45 }; |
| 46 }); |
| OLD | NEW |