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

Side by Side Diff: chrome/test/data/webui/settings/site_list_tests.js

Issue 2461113002: WebUI: Make settings-action-menu re-usable as cr-action-menu. (Closed)
Patch Set: getComputedStyle instead of util.js Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 site-list. */ 5 /** @fileoverview Suite of tests for site-list. */
6 cr.define('site_list', function() { 6 cr.define('site_list', function() {
7 function registerTests() { 7 function registerTests() {
8 suite('SiteList', function() { 8 suite('SiteList', function() {
9 /** 9 /**
10 * A site list element created before each test. 10 * A site list element created before each test.
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 }); 320 });
321 321
322 teardown(function() { 322 teardown(function() {
323 closeActionMenu(); 323 closeActionMenu();
324 }); 324 });
325 325
326 /** 326 /**
327 * Fetch the non-hidden menu items from the action menu. 327 * Fetch the non-hidden menu items from the action menu.
328 */ 328 */
329 function getMenuItems() { 329 function getMenuItems() {
330 var menu = testElement.$$('dialog[is=settings-action-menu]'); 330 var menu = testElement.$$('dialog[is=cr-action-menu]');
331 assertTrue(!!menu); 331 assertTrue(!!menu);
332 return menu.querySelectorAll('button:not([hidden])'); 332 return menu.querySelectorAll('button:not([hidden])');
333 } 333 }
334 334
335 /** 335 /**
336 * Opens the action menu for a particular element in the list. 336 * Opens the action menu for a particular element in the list.
337 * @param {number} index The index of the child element (which site) to 337 * @param {number} index The index of the child element (which site) to
338 * open the action menu for. 338 * open the action menu for.
339 */ 339 */
340 function openActionMenu(index) { 340 function openActionMenu(index) {
341 var item = testElement.$.listContainer.children[index]; 341 var item = testElement.$.listContainer.children[index];
342 var dots = item.querySelector('paper-icon-button'); 342 var dots = item.querySelector('paper-icon-button');
343 MockInteractions.tap(dots); 343 MockInteractions.tap(dots);
344 Polymer.dom.flush(); 344 Polymer.dom.flush();
345 } 345 }
346 346
347 /** Closes the action menu. */ 347 /** Closes the action menu. */
348 function closeActionMenu() { 348 function closeActionMenu() {
349 var menu = testElement.$$('dialog[is=settings-action-menu]'); 349 var menu = testElement.$$('dialog[is=cr-action-menu]');
350 if (menu.open) 350 if (menu.open)
351 menu.close(); 351 menu.close();
352 } 352 }
353 353
354 /** 354 /**
355 * Asserts the menu looks as expected. 355 * Asserts the menu looks as expected.
356 * @param {Array<string>} items The items expected to show in the menu. 356 * @param {Array<string>} items The items expected to show in the menu.
357 */ 357 */
358 function assertMenu(items) { 358 function assertMenu(items) {
359 var menuItems = getMenuItems(); 359 var menuItems = getMenuItems();
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 assertEquals(settings.ContentSettingsTypes.JAVASCRIPT, args[2]); 811 assertEquals(settings.ContentSettingsTypes.JAVASCRIPT, args[2]);
812 assertEquals('allow', args[3]); 812 assertEquals('allow', args[3]);
813 }); 813 });
814 }); 814 });
815 }); 815 });
816 } 816 }
817 return { 817 return {
818 registerTests: registerTests, 818 registerTests: registerTests,
819 }; 819 };
820 }); 820 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698