OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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('languages_page_tests', function() { | 5 cr.define('languages_page_tests', function() { |
6 /** @enum {string} */ | 6 /** @enum {string} */ |
7 const TestNames = { | 7 const TestNames = { |
8 AddLanguagesDialog: 'add languages dialog', | 8 AddLanguagesDialog: 'add languages dialog', |
9 LanguageMenu: 'language menu', | 9 LanguageMenu: 'language menu', |
10 InputMethods: 'input methods', | 10 InputMethods: 'input methods', |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 | 101 |
102 // No languages have been checked, so the action button is disabled. | 102 // No languages have been checked, so the action button is disabled. |
103 assertTrue(actionButton.disabled); | 103 assertTrue(actionButton.disabled); |
104 assertFalse(cancelButton.disabled); | 104 assertFalse(cancelButton.disabled); |
105 | 105 |
106 done(); | 106 done(); |
107 }); | 107 }); |
108 }); | 108 }); |
109 | 109 |
110 // After every test, check that the dialog is removed from the DOM. | 110 // After every test, check that the dialog is removed from the DOM. |
111 teardown(function() { | 111 teardown(function(done) { |
112 // Flush the DOM, then wait for the |restamp| to take effect. | |
112 Polymer.dom.flush(); | 113 Polymer.dom.flush(); |
113 assertEquals(null, languagesPage.$$('settings-add-languages-dialog')); | 114 setTimeout(function() { |
dpapad
2017/05/09 01:14:29
Nit (optional): Perhaps it would be more robust to
michaelpg
2017/05/16 00:03:44
The MutationObserver you suggested in the bug work
| |
115 assertEquals(null, languagesPage.$$('settings-add-languages-dialog')); | |
116 done(); | |
117 }); | |
114 }); | 118 }); |
115 | 119 |
116 test('cancel', function() { | 120 test('cancel', function() { |
117 // Canceling the dialog should close and remove it. | 121 // Canceling the dialog should close and remove it. |
118 MockInteractions.tap(cancelButton); | 122 MockInteractions.tap(cancelButton); |
119 }); | 123 }); |
120 | 124 |
121 test('add languages and cancel', function(done) { | 125 test('add languages and cancel', function(done) { |
122 // Check some languages. | 126 // Check some languages. |
123 MockInteractions.tap(dialogItems[1]); // en-CA. | 127 MockInteractions.tap(dialogItems[1]); // en-CA. |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 // Now the secondary row is empty, so it shouldn't be shown. | 390 // Now the secondary row is empty, so it shouldn't be shown. |
387 assertFalse(triggerRow.classList.contains('two-line')); | 391 assertFalse(triggerRow.classList.contains('two-line')); |
388 assertEquals( | 392 assertEquals( |
389 0, triggerRow.querySelector('.secondary').textContent.length); | 393 0, triggerRow.querySelector('.secondary').textContent.length); |
390 } | 394 } |
391 }); | 395 }); |
392 }); | 396 }); |
393 | 397 |
394 return {TestNames: TestNames}; | 398 return {TestNames: TestNames}; |
395 }); | 399 }); |
OLD | NEW |