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

Side by Side Diff: chrome/test/data/webui/cr_elements/cr_action_menu_test.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 Tests for settings-action-menu element. */ 5 /** @fileoverview Tests for cr-action-menu element. */
6 suite('SettingsActionMenu', function() { 6 suite('CrActionMenu', function() {
7 /** @type {?SettingsActionMenuElement} */ 7 /** @type {?CrActionMenuElement} */
8 var menu = null; 8 var menu = null;
9 9
10 /** @type {?NodeList<HTMLElement>} */ 10 /** @type {?NodeList<HTMLElement>} */
11 var items = null; 11 var items = null;
12 12
13 setup(function() { 13 setup(function() {
14 PolymerTest.clearBody(); 14 PolymerTest.clearBody();
15 15
16 document.body.innerHTML = ` 16 document.body.innerHTML = `
17 <button id="dots">...</button> 17 <button id="dots">...</button>
18 <dialog is="settings-action-menu"> 18 <dialog is="cr-action-menu">
19 <button class="dropdown-item">Un</button> 19 <button class="dropdown-item">Un</button>
20 <hr> 20 <hr>
21 <button class="dropdown-item">Dos</button> 21 <button class="dropdown-item">Dos</button>
22 <button class="dropdown-item">Tres</button> 22 <button class="dropdown-item">Tres</button>
23 </dialog> 23 </dialog>
24 `; 24 `;
25 25
26 menu = document.querySelector('dialog[is=settings-action-menu]'); 26 menu = document.querySelector('dialog[is=cr-action-menu]');
27 items = menu.querySelectorAll('.dropdown-item'); 27 items = menu.querySelectorAll('.dropdown-item');
28 assertEquals(3, items.length); 28 assertEquals(3, items.length);
29 }); 29 });
30 30
31 teardown(function() { 31 teardown(function() {
32 if (menu.open) 32 if (menu.open)
33 menu.close(); 33 menu.close();
34 }); 34 });
35 35
36 test('focus after showing', function() { 36 test('focus after showing', function() {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 }); 94 });
95 95
96 test('close on Tab', function() { 96 test('close on Tab', function() {
97 menu.showAt(document.querySelector('#dots')); 97 menu.showAt(document.querySelector('#dots'));
98 assertTrue(menu.open); 98 assertTrue(menu.open);
99 99
100 MockInteractions.keyDownOn(menu, 'Tab', [], 'Tab'); 100 MockInteractions.keyDownOn(menu, 'Tab', [], 'Tab');
101 assertFalse(menu.open); 101 assertFalse(menu.open);
102 }); 102 });
103 }); 103 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698