Chromium Code Reviews| 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_toolbar_test', function() { | |
| 6 // Array of test history data. | |
| 7 var TEST_HISTORY_RESULTS = [ | |
| 8 { | |
| 9 "dateRelativeDay": "Today - Wednesday, December 9, 2015", | |
| 10 "url": "https://www.google.com" | |
| 11 } | |
| 12 ]; | |
| 13 | |
| 14 function registerTests() { | |
| 15 suite('history-toolbar', function() { | |
| 16 var element; | |
| 17 var toolbar; | |
| 18 | |
| 19 suiteSetup(function() { | |
| 20 element = $('history-card-manager'); | |
| 21 toolbar = $('toolbar'); | |
| 22 }); | |
| 23 | |
| 24 test('selecting checkbox causes toolbar to change', function() { | |
| 25 element.addNewResults(TEST_HISTORY_RESULTS); | |
| 26 | |
| 27 flush(function() { | |
| 28 var item = element.$$('history-card').$$('history-item'); | |
| 29 MockInteractions.tap(item.$['checkbox']); | |
|
tsergeant
2016/01/25 00:40:20
item.$.checkbox here and below again
hsampson
2016/01/25 02:14:01
Done.
| |
| 30 | |
| 31 // Ensure that when an item is selected that the count held by the | |
| 32 // toolbar increases. | |
| 33 assertEquals(1, toolbar.count); | |
| 34 // Ensure that the toolbar boolean states that at least one item is | |
| 35 // selected. | |
| 36 assertTrue(toolbar.itemsSelected_); | |
| 37 | |
| 38 MockInteractions.tap(item.$['checkbox']); | |
| 39 | |
| 40 // Ensure that when an item is deselected the count held by the | |
| 41 // toolbar decreases. | |
| 42 assertEquals(0, toolbar.count); | |
| 43 // Ensure that the toolbar boolean states that no items are selected. | |
| 44 assertFalse(toolbar.itemsSelected_); | |
| 45 }); | |
| 46 }); | |
| 47 | |
| 48 teardown(function() { | |
| 49 toolbar.count = 0; | |
| 50 }); | |
| 51 }); | |
| 52 } | |
| 53 return { | |
| 54 registerTests: registerTests | |
| 55 }; | |
| 56 }); | |
| OLD | NEW |