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

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

Issue 2386993005: Site Settings Desktop: Switch out paper-menu for iron-dropdown. (Closed)
Patch Set: sync'ed 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/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 57962f04f971d8c4ac02bcbc88dad6786653e43c..e7c515e4427e3ad741f6ed68dd81a344ed221787 100644
--- a/chrome/test/data/webui/settings/site_list_tests.js
+++ b/chrome/test/data/webui/settings/site_list_tests.js
@@ -327,7 +327,19 @@ cr.define('site_list', function() {
*/
function getMenuItems(listContainer, index) {
return listContainer.children[index].querySelectorAll(
- 'paper-menu-button paper-item:not([hidden])');
+ 'iron-dropdown div button:not([hidden])');
dpapad 2016/10/04 20:58:44 Does this selector have to be so specific? How abo
Finnur 2016/10/05 10:29:43 Works for me.
+ }
+
+ /**
+ * Opens the context menu for a particular element in the list.
+ * @param {number} index The index of the child element (which site) to
+ * open the context menu for.
+ */
+ function openContextMenu(index) {
dpapad 2016/10/04 20:58:44 Nit: We've been trying to establish the term "acti
Finnur 2016/10/05 10:29:43 Done.
+ var item = testElement.$.listContainer.children[index];
+ var dots = item.querySelector('paper-icon-button');
+ MockInteractions.tap(dots);
+ Polymer.dom.flush();
}
/**
@@ -416,6 +428,7 @@ cr.define('site_list', function() {
assertEquals(
settings.PermissionValues.ALLOW, testElement.categorySubtype);
Polymer.dom.flush(); // Populates action menu.
+ openContextMenu(0);
assertMenu(['Block', 'Remove'], testElement);
assertEquals('Allow - 2', testElement.$.header.innerText.trim());
@@ -447,6 +460,7 @@ cr.define('site_list', function() {
assertEquals(
settings.PermissionValues.BLOCK, testElement.categorySubtype);
Polymer.dom.flush(); // Populates action menu.
+ openContextMenu(0);
assertMenu(['Allow', 'Remove'], testElement);
assertEquals('Block - 2', testElement.$.header.innerText.trim());
@@ -475,6 +489,7 @@ cr.define('site_list', function() {
assertEquals(settings.PermissionValues.SESSION_ONLY,
testElement.categorySubtype);
Polymer.dom.flush(); // Populates action menu.
+ openContextMenu(0);
assertMenu(['Allow', 'Block', 'Remove'], testElement);
assertEquals('Clear on exit - 1',
testElement.$.header.innerText.trim());
@@ -505,6 +520,7 @@ cr.define('site_list', function() {
assertEquals(settings.PermissionValues.BLOCK,
testElement.categorySubtype);
Polymer.dom.flush(); // Populates action menu.
+ openContextMenu(0);
// 'Clear on exit' is visible as this is not an incognito item.
assertMenu(['Allow', 'Clear on exit', 'Remove'], testElement);
assertEquals('Block - 1',
@@ -541,12 +557,14 @@ cr.define('site_list', function() {
assertEquals(settings.PermissionValues.ALLOW,
testElement.categorySubtype);
Polymer.dom.flush(); // Populates action menu.
+ openContextMenu(0);
// 'Clear on exit' is hidden for incognito items.
assertMenu(['Block', 'Remove'], testElement);
assertEquals('Allow - 2',
testElement.$.header.innerText.trim());
// Select 'Remove' from menu on 'foo.com'.
+ openContextMenu(1);
var menuItems = getMenuItems(testElement.$.listContainer, 1);
assertTrue(!!menuItems);
MockInteractions.tap(menuItems[1]);
@@ -779,6 +797,7 @@ cr.define('site_list', function() {
return browserProxy.whenCalled('getExceptionList').then(function(
contentType) {
Polymer.dom.flush();
+ openContextMenu(0);
var menuItems = getMenuItems(testElement.$.listContainer, 0);
assertTrue(!!menuItems);
MockInteractions.tap(menuItems[0]);

Powered by Google App Engine
This is Rietveld 408576698