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

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

Issue 2438643004: MD Settings: Migrate cookies iron-dropdown to settings-action-menu. (Closed)
Patch Set: Nit. 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
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_list.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/site_list_tests.js
diff --git a/chrome/test/data/webui/settings/site_list_tests.js b/chrome/test/data/webui/settings/site_list_tests.js
index 13e6d8f3d46d7eb5bd709018259f035eee7db78a..62fa0528ce35b50a9bcc32ffa918e2fe7d5794b6 100644
--- a/chrome/test/data/webui/settings/site_list_tests.js
+++ b/chrome/test/data/webui/settings/site_list_tests.js
@@ -319,15 +319,17 @@ cr.define('site_list', function() {
document.body.appendChild(testElement);
});
+ teardown(function() {
+ closeActionMenu();
+ });
+
/**
- * Fetch the non-hidden menu items from the list.
- * @param {!HTMLElement} parentElement
- * @param {number} index The index of the child element (which site) to
- * fetch.
+ * Fetch the non-hidden menu items from the action menu.
*/
- function getMenuItems(listContainer, index) {
- return listContainer.children[index].querySelectorAll(
- 'iron-dropdown .dropdown-item:not([hidden])');
+ function getMenuItems() {
+ var menu = testElement.$$('dialog[is=settings-action-menu]');
+ assertTrue(!!menu);
+ return menu.querySelectorAll('button:not([hidden])');
}
/**
@@ -342,14 +344,19 @@ cr.define('site_list', function() {
Polymer.dom.flush();
}
+ /** Closes the action menu. */
+ function closeActionMenu() {
+ var menu = testElement.$$('dialog[is=settings-action-menu]');
+ if (menu.open)
+ menu.close();
+ }
+
/**
* Asserts the menu looks as expected.
* @param {Array<string>} items The items expected to show in the menu.
- * @param {!HTMLElement} parentElement The parent node to start looking
- * in.
*/
- function assertMenu(items, parentElement) {
- var menuItems = getMenuItems(parentElement.$.listContainer, 0);
+ function assertMenu(items) {
+ var menuItems = getMenuItems();
assertEquals(items.length, menuItems.length);
for (var i = 0; i < items.length; i++)
assertEquals(items[i], menuItems[i].textContent.trim());
@@ -515,7 +522,7 @@ cr.define('site_list', function() {
assertMenu(['Allow', 'Clear on exit', 'Remove'], testElement);
// Select 'Remove from menu'.
- var menuItems = getMenuItems(testElement.$.listContainer, 0);
+ var menuItems = getMenuItems();
assertTrue(!!menuItems);
MockInteractions.tap(menuItems[2]);
return browserProxy.whenCalled(
@@ -548,10 +555,11 @@ cr.define('site_list', function() {
openActionMenu(0);
// 'Clear on exit' is hidden for incognito items.
assertMenu(['Block', 'Remove'], testElement);
+ closeActionMenu();
// Select 'Remove' from menu on 'foo.com'.
openActionMenu(1);
- var menuItems = getMenuItems(testElement.$.listContainer, 1);
+ var menuItems = getMenuItems();
assertTrue(!!menuItems);
MockInteractions.tap(menuItems[1]);
return browserProxy.whenCalled(
@@ -776,7 +784,7 @@ cr.define('site_list', function() {
contentType) {
Polymer.dom.flush();
openActionMenu(0);
- var menuItems = getMenuItems(testElement.$.listContainer, 0);
+ var menuItems = getMenuItems();
assertTrue(!!menuItems);
MockInteractions.tap(menuItems[0]);
return browserProxy.whenCalled('setCategoryPermissionForOrigin');
@@ -792,7 +800,7 @@ cr.define('site_list', function() {
openActionMenu(0);
assertMenu(['Allow', 'Remove'], testElement);
- var menuItems = getMenuItems(testElement.$.listContainer, 0);
+ var menuItems = getMenuItems();
assertTrue(!!menuItems);
MockInteractions.tap(menuItems[0]); // Action: Allow.
return browserProxy.whenCalled('setCategoryPermissionForOrigin');
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_list.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698