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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 }); | 405 }); |
| 406 }); | 406 }); |
| 407 }); | 407 }); |
| 408 | 408 |
| 409 test('manage input methods', function() { | 409 test('manage input methods', function() { |
| 410 var inputMethodsCollapse = languagesPage.$.inputMethodsCollapse; | 410 var inputMethodsCollapse = languagesPage.$.inputMethodsCollapse; |
| 411 var inputMethodSettingsExist = !!inputMethodsCollapse; | 411 var inputMethodSettingsExist = !!inputMethodsCollapse; |
| 412 if (cr.isChromeOS) { | 412 if (cr.isChromeOS) { |
| 413 assertTrue(inputMethodSettingsExist); | 413 assertTrue(inputMethodSettingsExist); |
| 414 var manageInputMethodsButton = | 414 var manageInputMethodsButton = |
| 415 inputMethodsCollapse.querySelector('.list-button:last-of-type'); | 415 inputMethodsCollapse.querySelector('.list-button:last-of-type'); |
|
dpapad
2017/02/07 00:47:16
This reference to last-of-type as well as the one
Dan Beam
2017/02/07 03:08:43
scottchen@: it is customary to respond to reviewer
scottchen
2017/02/08 00:43:19
Sorry, missed this comment before landing. Will be
| |
| 416 MockInteractions.tap(manageInputMethodsButton); | 416 MockInteractions.tap(manageInputMethodsButton); |
| 417 assertTrue(!!languagesPage.$$('settings-manage-input-methods-page')); | 417 assertTrue(!!languagesPage.$$('settings-manage-input-methods-page')); |
| 418 } else { | 418 } else { |
| 419 assertFalse(inputMethodSettingsExist); | 419 assertFalse(inputMethodSettingsExist); |
| 420 } | 420 } |
| 421 }); | 421 }); |
| 422 | 422 |
| 423 test('spellcheck', function() { | 423 test('spellcheck', function() { |
| 424 var spellCheckCollapse = languagesPage.$.spellCheckCollapse; | 424 var spellCheckCollapse = languagesPage.$.spellCheckCollapse; |
| 425 var spellCheckSettingsExist = !!spellCheckCollapse; | 425 var spellCheckSettingsExist = !!spellCheckCollapse; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 440 assertFalse(triggerRow.classList.contains('two-line')); | 440 assertFalse(triggerRow.classList.contains('two-line')); |
| 441 assertEquals( | 441 assertEquals( |
| 442 0, triggerRow.querySelector('.secondary').textContent.length); | 442 0, triggerRow.querySelector('.secondary').textContent.length); |
| 443 | 443 |
| 444 languagesPage.set( | 444 languagesPage.set( |
| 445 'languages.enabled.0.language.supportsSpellcheck', true); | 445 'languages.enabled.0.language.supportsSpellcheck', true); |
| 446 languagesPage.set('languages.enabled.0.spellCheckEnabled', true); | 446 languagesPage.set('languages.enabled.0.spellCheckEnabled', true); |
| 447 assertTrue(triggerRow.classList.contains('two-line')); | 447 assertTrue(triggerRow.classList.contains('two-line')); |
| 448 assertLT( | 448 assertLT( |
| 449 0, triggerRow.querySelector('.secondary').textContent.length); | 449 0, triggerRow.querySelector('.secondary').textContent.length); |
| 450 | |
| 451 MockInteractions.tap( | |
| 452 spellCheckCollapse.querySelector('.list-button:last-of-type')); | |
| 453 assertTrue(!!languagesPage.$$('settings-edit-dictionary-page')); | |
| 454 } | 450 } |
| 455 }); | 451 }); |
| 452 | |
| 453 if (!cr.isMac) { | |
| 454 test('spellcheck edit dictionary page add word button', function() { | |
|
dpapad
2017/02/07 00:47:16
Nit (optional): s/add word button/add word validat
scottchen
2017/02/08 00:43:19
Addressed in new CL: https://codereview.chromium.o
| |
| 455 assertFalse(!!languagesPage.$$('settings-edit-dictionary-page')); | |
| 456 var spellCheckCollapse = languagesPage.$.spellCheckCollapse; | |
| 457 MockInteractions.tap( | |
| 458 spellCheckCollapse.querySelector('.list-button')); | |
| 459 var editDictPage = languagesPage.$$('settings-edit-dictionary-page'); | |
| 460 assertTrue(!!editDictPage); | |
| 461 var addWordButton = editDictPage.root.querySelector('paper-button'); | |
| 462 editDictPage.$.newWord.value = ''; | |
| 463 assertTrue(!!addWordButton); | |
| 464 assertTrue(addWordButton.disabled); | |
| 465 editDictPage.$.newWord.value = 'valid word'; | |
| 466 assertFalse(addWordButton.disabled); | |
| 467 }); | |
| 468 } | |
| 456 }.bind(this)); | 469 }.bind(this)); |
| 457 | 470 |
| 458 // TODO(michaelpg): Test more aspects of the languages UI. | 471 // TODO(michaelpg): Test more aspects of the languages UI. |
| 459 | 472 |
| 460 // Run all registered tests. | 473 // Run all registered tests. |
| 461 mocha.run(); | 474 mocha.run(); |
| 462 }); | 475 }); |
| OLD | NEW |