Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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-dropdown-menu. */ | 5 /** @fileoverview Suite of tests for settings-dropdown-menu. */ |
| 6 cr.define('settings_dropdown_menu', function() { | 6 cr.define('settings_dropdown_menu', function() { |
| 7 function registerTests() { | 7 function registerTests() { |
| 8 suite('SettingsDropdownMenu', function() { | 8 suite('SettingsDropdownMenu', function() { |
| 9 /** @type {SettingsDropdownMenu} */ | 9 /** @type {SettingsDropdownMenu} */ |
| 10 var dropdown; | 10 var dropdown; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 {value: 'b', name: 'BBB'}, | 85 {value: 'b', name: 'BBB'}, |
| 86 {value: 'c', name: 'CCC'}, | 86 {value: 'c', name: 'CCC'}, |
| 87 {value: 'd', name: 'DDD'}]; | 87 {value: 'd', name: 'DDD'}]; |
| 88 Polymer.dom.flush(); | 88 Polymer.dom.flush(); |
| 89 | 89 |
| 90 // "Custom" initially selected. | 90 // "Custom" initially selected. |
| 91 assertEquals(dropdown.notFoundValue_, selectable.selected); | 91 assertEquals(dropdown.notFoundValue_, selectable.selected); |
| 92 // Pref should not have changed. | 92 // Pref should not have changed. |
| 93 assertEquals('f', dropdown.pref.value); | 93 assertEquals('f', dropdown.pref.value); |
| 94 }); | 94 }); |
| 95 | |
| 96 test('delay setting options', function testDelayedOptions(done) { | |
| 97 dropdown.pref = { | |
| 98 key: 'test.number2', | |
| 99 type: chrome.settingsPrivate.PrefType.NUMBER, | |
| 100 value: 200, | |
| 101 }; | |
| 102 | |
|
dschuyler
2016/08/17 23:59:46
Would it make sense to have check that
the label i
| |
| 103 setTimeout(function() { | |
| 104 assertEquals( | |
| 105 loadTimeData.getValue('loading'), dropdown.$.dropdownMenu.label); | |
|
dschuyler
2016/08/17 23:59:46
...that the label is not shown here?
I think we w
| |
| 106 assertTrue(dropdown.$.dropdownMenu.disabled); | |
| 107 assertEquals(undefined, selectable.selected); | |
| 108 | |
| 109 dropdown.menuOptions = [{value: 100, name: 'Option 100'}, | |
| 110 {value: 200, name: 'Option 200'}, | |
| 111 {value: 300, name: 'Option 300'}, | |
| 112 {value: 400, name: 'Option 400'}]; | |
| 113 Polymer.dom.flush(); | |
| 114 | |
| 115 // Dropdown menu enables itself and selects the new menu option | |
| 116 // correpsonding to the pref value. | |
| 117 assertFalse(dropdown.$.dropdownMenu.disabled); | |
| 118 assertEquals('200', selectable.selected); | |
| 119 done(); | |
| 120 }, 100); | |
| 121 }); | |
| 95 }); | 122 }); |
| 96 } | 123 } |
| 97 | 124 |
| 98 return { | 125 return { |
| 99 registerTests: registerTests, | 126 registerTests: registerTests, |
| 100 }; | 127 }; |
| 101 }); | 128 }); |
| OLD | NEW |