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