Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: chrome/test/data/webui/md_downloads/toolbar_tests.js

Issue 2284463002: MD Downloads: fix search spinner when terms are the same (Closed)
Patch Set: +tests Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698