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

Side by Side Diff: chrome/test/data/webui/settings/settings_subpage_test.js

Issue 2772873002: MD Settings: Allow searching the languages list in "add language" dialog. (Closed)
Patch Set: Fix test. Created 3 years, 9 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
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_browsertest.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cr.define('settings_subpage', function() { 5 cr.define('settings_subpage', function() {
6 function registerTests() { 6 suite('SettingsSubpage', function() {
7 suite('SettingsSubpage', function() { 7 test('navigates to parent when there is no history', function() {
8 test('navigates to parent when there is no history', function() { 8 PolymerTest.clearBody();
9 PolymerTest.clearBody();
10 9
11 // Pretend that we initially started on the CERTIFICATES route. 10 // Pretend that we initially started on the CERTIFICATES route.
12 window.history.replaceState( 11 window.history.replaceState(
13 undefined, '', settings.Route.CERTIFICATES.path); 12 undefined, '', settings.Route.CERTIFICATES.path);
14 settings.initializeRouteFromUrl(); 13 settings.initializeRouteFromUrl();
15 assertEquals(settings.Route.CERTIFICATES, settings.getCurrentRoute()); 14 assertEquals(settings.Route.CERTIFICATES, settings.getCurrentRoute());
16 15
17 var subpage = document.createElement('settings-subpage'); 16 var subpage = document.createElement('settings-subpage');
18 document.body.appendChild(subpage); 17 document.body.appendChild(subpage);
19 18
20 MockInteractions.tap(subpage.$$('paper-icon-button')); 19 MockInteractions.tap(subpage.$$('paper-icon-button'));
21 assertEquals(settings.Route.PRIVACY, settings.getCurrentRoute()); 20 assertEquals(settings.Route.PRIVACY, settings.getCurrentRoute());
22 }); 21 });
23 22
24 test('navigates to any route via window.back()', function(done) { 23 test('navigates to any route via window.back()', function(done) {
25 PolymerTest.clearBody(); 24 PolymerTest.clearBody();
26 25
27 settings.navigateTo(settings.Route.BASIC); 26 settings.navigateTo(settings.Route.BASIC);
28 settings.navigateTo(settings.Route.SYNC); 27 settings.navigateTo(settings.Route.SYNC);
29 assertEquals(settings.Route.SYNC, settings.getCurrentRoute()); 28 assertEquals(settings.Route.SYNC, settings.getCurrentRoute());
30 29
31 var subpage = document.createElement('settings-subpage'); 30 var subpage = document.createElement('settings-subpage');
32 document.body.appendChild(subpage); 31 document.body.appendChild(subpage);
33 32
34 MockInteractions.tap(subpage.$$('paper-icon-button')); 33 MockInteractions.tap(subpage.$$('paper-icon-button'));
35 34
36 window.addEventListener('popstate', function(event) { 35 window.addEventListener('popstate', function(event) {
37 assertEquals(settings.Route.BASIC, settings.getCurrentRoute()); 36 assertEquals(settings.Route.BASIC, settings.getCurrentRoute());
38 done(); 37 done();
39 });
40 }); 38 });
41 }); 39 });
42 } 40 });
43 41
44 return { 42 suite('SettingsSubpageSearch', function() {
45 registerTests: registerTests, 43 test('host autofocus propagates to <input>', function() {
46 }; 44 PolymerTest.clearBody();
45 var element = document.createElement('settings-subpage-search');
46 element.setAttribute('autofocus', true);
47 document.body.appendChild(element);
48
49 assertTrue(element.$$('input').hasAttribute('autofocus'));
50
51 element.removeAttribute('autofocus');
52 assertFalse(element.$$('input').hasAttribute('autofocus'));
53 });
54 });
47 }); 55 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698