| 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 suite('toolbar tests', function() { | 5 suite('toolbar tests', function() { |
| 6 /** @type {!downloads.Toolbar} */ | 6 /** @type {!downloads.Toolbar} */ |
| 7 var toolbar; | 7 var toolbar; |
| 8 | 8 |
| 9 setup(function() { | 9 setup(function() { |
| 10 /** @extends {downloads.ActionService} */ |
| 11 function TestActionService() { |
| 12 downloads.ActionService.call(this); |
| 13 } |
| 14 |
| 15 TestActionService.prototype = { |
| 16 __proto__: downloads.ActionService.prototype, |
| 17 loadMore: function() { /* Prevent chrome.send(). */ }, |
| 18 }; |
| 19 |
| 10 toolbar = document.createElement('downloads-toolbar'); | 20 toolbar = document.createElement('downloads-toolbar'); |
| 21 downloads.ActionService.instance_ = new TestActionService; |
| 11 document.body.appendChild(toolbar); | 22 document.body.appendChild(toolbar); |
| 12 }); | 23 }); |
| 13 | 24 |
| 14 test('resize closes more options menu', function() { | 25 test('resize closes more options menu', function() { |
| 15 MockInteractions.tap(toolbar.$$('paper-icon-button')); | 26 MockInteractions.tap(toolbar.$$('paper-icon-button')); |
| 16 assertTrue(toolbar.$.more.opened); | 27 assertTrue(toolbar.$.more.opened); |
| 17 | 28 |
| 18 window.dispatchEvent(new CustomEvent('resize')); | 29 window.dispatchEvent(new CustomEvent('resize')); |
| 19 assertFalse(toolbar.$.more.opened); | 30 assertFalse(toolbar.$.more.opened); |
| 20 }); | 31 }); |
| 32 |
| 33 test('search starts spinner', function() { |
| 34 toolbar.$.toolbar.fire('search-changed', 'a'); |
| 35 assertTrue(toolbar.spinnerActive); |
| 36 |
| 37 // Pretend the manager got results and set this to false. |
| 38 toolbar.spinnerActive = false; |
| 39 |
| 40 toolbar.$.toolbar.fire('search-changed', 'a '); // Same term plus a space. |
| 41 assertFalse(toolbar.spinnerActive); |
| 42 }); |
| 21 }); | 43 }); |
| OLD | NEW |