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

Unified Diff: chrome/test/data/webui/settings/dropdown_menu_tests.js

Issue 2446003002: settings-dropdown-menu must set <select>#value after its options change (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/settings/dropdown_menu_tests.js
diff --git a/chrome/test/data/webui/settings/dropdown_menu_tests.js b/chrome/test/data/webui/settings/dropdown_menu_tests.js
index 543512b27bf7bea0d4a4abed2cfa51f4fbaebbe7..fdcdf3721a94b742d614e4f68292c2ab72ac0a3c 100644
--- a/chrome/test/data/webui/settings/dropdown_menu_tests.js
+++ b/chrome/test/data/webui/settings/dropdown_menu_tests.js
@@ -84,11 +84,13 @@ cr.define('settings_dropdown_menu', function() {
}).then(function() {
assertEquals('a', dropdown.pref.value);
- // Updating the pref selects an item.
- dropdown.set('pref.value', 'b');
+ // Item remains selected after updating menu items.
+ var newMenuOptions = dropdown.menuOptions.slice().reverse();
+ dropdown.menuOptions = newMenuOptions;
return waitUntilDropdownUpdated();
}).then(function() {
- assertEquals('b', selectElement.value);
+ assertEquals('AAA',
+ selectElement.selectedOptions[0].textContent.trim());
});
});
@@ -123,11 +125,10 @@ cr.define('settings_dropdown_menu', function() {
value: 200,
};
- console.log('running test');
return waitForTimeout(100).then(function() {
return waitUntilDropdownUpdated();
}).then(function() {
- assertTrue(dropdown.$.dropdownMenu.disabled);
+ assertTrue(selectElement.disabled);
assertEquals('SETTINGS_DROPDOWN_NOT_FOUND_ITEM', selectElement.value);
dropdown.menuOptions = [{value: 100, name: 'Option 100'},
@@ -138,8 +139,15 @@ cr.define('settings_dropdown_menu', function() {
}).then(function() {
// Dropdown menu enables itself and selects the new menu option
// correpsonding to the pref value.
- assertFalse(dropdown.$.dropdownMenu.disabled);
+ assertFalse(selectElement.disabled);
assertEquals('200', selectElement.value);
+
+ // The "Custom" option should not show up in the dropdown list or be
+ // reachable via type-ahead.
+ var options = selectElement.options;
+ var customOption = assert(options[options.length - 1]);
+ assertTrue(customOption.hidden);
+ assertTrue(customOption.disabled);
});
});
});

Powered by Google App Engine
This is Rietveld 408576698