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

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

Issue 2627973008: Language settings: Wait 100ms to close language action menu on checkbox change (Closed)
Patch Set: Created 3 years, 11 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/browser/resources/settings/languages_page/languages_page.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 /** @fileoverview Suite of tests for settings-languages-page. */ 5 /** @fileoverview Suite of tests for settings-languages-page. */
6 6
7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ 7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */
8 var ROOT_PATH = '../../../../../'; 8 var ROOT_PATH = '../../../../../';
9 9
10 // Polymer BrowserTest fixture. 10 // Polymer BrowserTest fixture.
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 assertEquals(1, separator.offsetHeight); 228 assertEquals(1, separator.offsetHeight);
229 229
230 // Disable Translate. On platforms that can't change the UI language, 230 // Disable Translate. On platforms that can't change the UI language,
231 // this hides all the checkboxes, so the separator isn't needed. 231 // this hides all the checkboxes, so the separator isn't needed.
232 // Chrome OS and Windows still show a checkbox and thus the separator. 232 // Chrome OS and Windows still show a checkbox and thus the separator.
233 languageHelper.setPrefValue('translate.enabled', false); 233 languageHelper.setPrefValue('translate.enabled', false);
234 assertEquals( 234 assertEquals(
235 cr.isChromeOS || cr.isWindows ? 1 : 0, separator.offsetHeight); 235 cr.isChromeOS || cr.isWindows ? 1 : 0, separator.offsetHeight);
236 }); 236 });
237 237
238 test('toggle translate', function(done) {
239 // Enable Translate so the menu always shows the Translate checkbox.
240 languageHelper.setPrefValue('translate.enabled', true);
241 languagesPage.set('languages.translateTarget', 'foo');
242 languagesPage.set('languages.enabled.1.supportsTranslate', true);
243
244 var languageOptionsDropdownTrigger =
245 languagesCollapse.querySelectorAll('paper-icon-button')[1];
246 assertTrue(!!languageOptionsDropdownTrigger);
247 MockInteractions.tap(languageOptionsDropdownTrigger);
248 assertTrue(actionMenu.open);
249
250 // Toggle the translate option.
251 var translateOption = actionMenu.querySelector('#offerTranslations');
252 assertTrue(!!translateOption);
253 assertFalse(translateOption.disabled);
254 MockInteractions.tap(translateOption);
255
256 // Menu should stay open briefly.
257 assertTrue(actionMenu.open);
258 // Guaranteed to run later than the menu close delay.
dschuyler 2017/01/14 01:15:36 Could you point me to docs or something so I can u
michaelpg 2017/01/14 04:39:13 Totally right that the actual timeout is not guara
dschuyler 2017/01/17 19:30:06 Thanks! I really appreciate the detail provided.
259 setTimeout(function() {
260 assertFalse(actionMenu.open);
261 done();
262 }, settings.kMenuCloseDelay + 1);
263 });
264
238 test('remove language', function() { 265 test('remove language', function() {
239 var numEnabled = languagesPage.languages.enabled.length; 266 var numEnabled = languagesPage.languages.enabled.length;
240 267
241 // Enabled a language which we can then disable. 268 // Enabled a language which we can then disable.
242 var newLanguage = getAvailableLanguage(); 269 var newLanguage = getAvailableLanguage();
243 languageHelper.enableLanguage(newLanguage.code); 270 languageHelper.enableLanguage(newLanguage.code);
244 271
245 // Wait for the language to be enabled. 272 // Wait for the language to be enabled.
246 return whenNumEnabledLanguagesBecomes(numEnabled + 1).then(function() { 273 return whenNumEnabledLanguagesBecomes(numEnabled + 1).then(function() {
247 // Populate the dom-repeat. 274 // Populate the dom-repeat.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 assertTrue(!!languagesPage.$$('settings-edit-dictionary-page')); 348 assertTrue(!!languagesPage.$$('settings-edit-dictionary-page'));
322 } 349 }
323 }); 350 });
324 }.bind(this)); 351 }.bind(this));
325 352
326 // TODO(michaelpg): Test more aspects of the languages UI. 353 // TODO(michaelpg): Test more aspects of the languages UI.
327 354
328 // Run all registered tests. 355 // Run all registered tests.
329 mocha.run(); 356 mocha.run();
330 }); 357 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/languages_page/languages_page.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698