Chromium Code Reviews| 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 /** @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 Loading... | |
| 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('test enable translation toggle', function() { | |
| 239 var toggle = languagesPage.$.offerTranslateOtherLangs; | |
|
michaelpg
2017/01/31 21:54:10
this assumes translate is already enabled. we shou
scottchen
2017/02/01 01:02:39
The button that this line is grabbing is the toggl
michaelpg
2017/02/01 01:50:02
origTranslateEnabled is used to ensure the value g
scottchen
2017/02/01 02:04:31
The test would be valid regardless of origTranslat
michaelpg
2017/02/01 02:57:15
I was playing with this test to try to show what I
scottchen
2017/02/01 18:52:35
Acknowledged. Please see newest patch.
| |
| 240 assertTrue(!!toggle); | |
| 241 MockInteractions.tap(toggle); | |
| 242 var newTranslateEnabled = languageHelper.prefs.translate.enabled.value; | |
| 243 assertEquals(!origTranslateEnabled, newTranslateEnabled); | |
|
michaelpg
2017/01/31 21:54:10
can you also test that disabling the toggle button
scottchen
2017/02/01 01:02:38
Do you mean disabling the toggle button as in <set
michaelpg
2017/02/01 01:50:02
Sorry, yes, if we "uncheck" the toggle button to t
| |
| 244 }); | |
| 245 | |
| 238 test('toggle translate', function(done) { | 246 test('toggle translate', function(done) { |
|
michaelpg
2017/01/31 21:54:10
change title to something like 'toggle translate f
scottchen
2017/02/01 01:02:39
Done.
| |
| 239 // Enable Translate so the menu always shows the Translate checkbox. | 247 // Enable Translate so the menu always shows the Translate checkbox. |
| 240 languageHelper.setPrefValue('translate.enabled', true); | 248 languageHelper.setPrefValue('translate.enabled', true); |
| 241 languagesPage.set('languages.translateTarget', 'foo'); | 249 languagesPage.set('languages.translateTarget', 'foo'); |
| 242 languagesPage.set('languages.enabled.1.supportsTranslate', true); | 250 languagesPage.set('languages.enabled.1.supportsTranslate', true); |
| 243 | 251 |
| 244 var languageOptionsDropdownTrigger = | 252 var languageOptionsDropdownTrigger = |
| 245 languagesCollapse.querySelectorAll('paper-icon-button')[1]; | 253 languagesCollapse.querySelectorAll('paper-icon-button')[1]; |
| 246 assertTrue(!!languageOptionsDropdownTrigger); | 254 assertTrue(!!languageOptionsDropdownTrigger); |
| 247 MockInteractions.tap(languageOptionsDropdownTrigger); | 255 MockInteractions.tap(languageOptionsDropdownTrigger); |
| 248 assertTrue(actionMenu.open); | 256 assertTrue(actionMenu.open); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 assertTrue(!!languagesPage.$$('settings-edit-dictionary-page')); | 356 assertTrue(!!languagesPage.$$('settings-edit-dictionary-page')); |
| 349 } | 357 } |
| 350 }); | 358 }); |
| 351 }.bind(this)); | 359 }.bind(this)); |
| 352 | 360 |
| 353 // TODO(michaelpg): Test more aspects of the languages UI. | 361 // TODO(michaelpg): Test more aspects of the languages UI. |
| 354 | 362 |
| 355 // Run all registered tests. | 363 // Run all registered tests. |
| 356 mocha.run(); | 364 mocha.run(); |
| 357 }); | 365 }); |
| OLD | NEW |