| 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_toolbar_test', function() { | 5 cr.define('md_history.history_toolbar_test', function() { |
| 6 // Array of test history data. | 6 // Array of test history data. |
| 7 var TEST_HISTORY_RESULTS = [ | 7 var TEST_HISTORY_RESULTS = [ |
| 8 { | 8 { |
| 9 "dateRelativeDay": "Today - Wednesday, December 9, 2015", | 9 "dateRelativeDay": "Today - Wednesday, December 9, 2015", |
| 10 "url": "https://www.google.com" | 10 "url": "https://www.google.com" |
| 11 } | 11 } |
| 12 ]; | 12 ]; |
| 13 | 13 |
| 14 function registerTests() { | 14 function registerTests() { |
| 15 suite('history-toolbar', function() { | 15 suite('history-toolbar', function() { |
| 16 var element; | 16 var element; |
| 17 var toolbar; | 17 var toolbar; |
| 18 | 18 |
| 19 suiteSetup(function() { | 19 suiteSetup(function() { |
| 20 element = $('history-card-manager'); | 20 element = $('history-list'); |
| 21 toolbar = $('toolbar'); | 21 toolbar = $('toolbar'); |
| 22 }); | 22 }); |
| 23 | 23 |
| 24 test('selecting checkbox causes toolbar to change', function(done) { | 24 test('selecting checkbox causes toolbar to change', function(done) { |
| 25 element.addNewResults(TEST_HISTORY_RESULTS); | 25 element.addNewResults(TEST_HISTORY_RESULTS); |
| 26 | 26 |
| 27 flush(function() { | 27 flush(function() { |
| 28 var item = element.$$('history-card').$$('history-item'); | 28 var item = element.$$('history-item'); |
| 29 MockInteractions.tap(item.$.checkbox); | 29 MockInteractions.tap(item.$.checkbox); |
| 30 | 30 |
| 31 // Ensure that when an item is selected that the count held by the | 31 // Ensure that when an item is selected that the count held by the |
| 32 // toolbar increases. | 32 // toolbar increases. |
| 33 assertEquals(1, toolbar.count); | 33 assertEquals(1, toolbar.count); |
| 34 // Ensure that the toolbar boolean states that at least one item is | 34 // Ensure that the toolbar boolean states that at least one item is |
| 35 // selected. | 35 // selected. |
| 36 assertTrue(toolbar.itemsSelected_); | 36 assertTrue(toolbar.itemsSelected_); |
| 37 | 37 |
| 38 MockInteractions.tap(item.$.checkbox); | 38 MockInteractions.tap(item.$.checkbox); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 49 | 49 |
| 50 teardown(function() { | 50 teardown(function() { |
| 51 toolbar.count = 0; | 51 toolbar.count = 0; |
| 52 }); | 52 }); |
| 53 }); | 53 }); |
| 54 } | 54 } |
| 55 return { | 55 return { |
| 56 registerTests: registerTests | 56 registerTests: registerTests |
| 57 }; | 57 }; |
| 58 }); | 58 }); |
| OLD | NEW |