| 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 function registerTests() { | 6 function registerTests() { |
| 7 suite('history-toolbar', function() { | 7 suite('history-toolbar', function() { |
| 8 var app; | 8 var app; |
| 9 var element; | 9 var element; |
| 10 var toolbar; | 10 var toolbar; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 MockInteractions.pressAndReleaseKeyOn( | 59 MockInteractions.pressAndReleaseKeyOn( |
| 60 document.body, 191, '', '/'); | 60 document.body, 191, '', '/'); |
| 61 assertTrue(field.showingSearch); | 61 assertTrue(field.showingSearch); |
| 62 assertEquals(field.$.searchInput, field.root.activeElement); | 62 assertEquals(field.$.searchInput, field.root.activeElement); |
| 63 | 63 |
| 64 MockInteractions.pressAndReleaseKeyOn( | 64 MockInteractions.pressAndReleaseKeyOn( |
| 65 field.$.searchInput, 27, '', 'Escape'); | 65 field.$.searchInput, 27, '', 'Escape'); |
| 66 assertFalse(field.showingSearch, 'Pressing escape closes field.'); | 66 assertFalse(field.showingSearch, 'Pressing escape closes field.'); |
| 67 assertNotEquals(field.$.searchInput, field.root.activeElement); | 67 assertNotEquals(field.$.searchInput, field.root.activeElement); |
| 68 | 68 |
| 69 var modifier = 'ctrl'; |
| 70 if (cr.isMac) |
| 71 modifier = 'meta'; |
| 72 |
| 69 MockInteractions.pressAndReleaseKeyOn( | 73 MockInteractions.pressAndReleaseKeyOn( |
| 70 document.body, 70, 'ctrl', 'f'); | 74 document.body, 70, modifier, 'f'); |
| 71 assertTrue(field.showingSearch); | 75 assertTrue(field.showingSearch); |
| 72 assertEquals(field.$.searchInput, field.root.activeElement); | 76 assertEquals(field.$.searchInput, field.root.activeElement); |
| 73 }); | 77 }); |
| 74 | 78 |
| 75 test('spinner is active on search' , function(done) { | 79 test('spinner is active on search' , function(done) { |
| 76 app.queryState_.queryingDisabled = false; | 80 app.queryState_.queryingDisabled = false; |
| 77 registerMessageCallback('queryHistory', this, function (info) { | 81 registerMessageCallback('queryHistory', this, function (info) { |
| 78 assertTrue(toolbar.spinnerActive); | 82 assertTrue(toolbar.spinnerActive); |
| 79 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS); | 83 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS); |
| 80 assertFalse(toolbar.spinnerActive); | 84 assertFalse(toolbar.spinnerActive); |
| 81 done(); | 85 done(); |
| 82 }); | 86 }); |
| 83 | 87 |
| 84 toolbar.$$('cr-toolbar').fire('search-changed', 'Test2'); | 88 toolbar.$$('cr-toolbar').fire('search-changed', 'Test2'); |
| 85 }); | 89 }); |
| 86 | 90 |
| 87 teardown(function() { | 91 teardown(function() { |
| 88 element.historyData_ = []; | 92 element.historyData_ = []; |
| 89 element.searchedTerm = ''; | 93 element.searchedTerm = ''; |
| 90 registerMessageCallback('queryHistory', this, undefined); | 94 registerMessageCallback('queryHistory', this, undefined); |
| 91 toolbar.count = 0; | 95 toolbar.count = 0; |
| 92 }); | 96 }); |
| 93 }); | 97 }); |
| 94 } | 98 } |
| 95 return { | 99 return { |
| 96 registerTests: registerTests | 100 registerTests: registerTests |
| 97 }; | 101 }; |
| 98 }); | 102 }); |
| OLD | NEW |