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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/tabbed-pane.js

Issue 2805593002: DevTools: Navigate TabbedPane with arrow keys (Closed)
Patch Set: Fix stray space in test Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-unit/tabbed-pane-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 TestRunner.addResult("This tests if the TabbedPane is keyboard navigable.");
2
3 class FocusableWidget extends UI.Widget {
4 constructor(name) {
5 super();
6 this.element.tabIndex = -1;
7 this.element.textContent = name;
8 this.setDefaultFocusedElement(this.element);
9 }
10 }
11
12 var tabbedPane = new UI.TabbedPane();
13 tabbedPane.show(UI.inspectorView.element);
14 TestRunner.addSniffer(tabbedPane, '_innerUpdateTabElements').then(tabsAdded);
15 for (var i = 0; i < 10; i++)
16 tabbedPane.appendTab(i.toString(), 'Tab ' + i, new FocusableWidget('Widget ' + i));
17
18 function tabsAdded() {
19 tabbedPane._currentTab.tabElement.focus();
20 dumpFocus();
21 TestRunner.addResult('Moving right and wrapping around');
22 for (var i = 0; i < 20; i++)
23 right();
24 TestRunner.addResult('Moving left and focusing widgets')
25 for (var i = 0; i < 10; i++) {
26 left();
27 enter();
28 tabbedPane._currentTab.tabElement.focus();
29 }
30 TestRunner.completeTest();
31 }
32
33 function right() {
34 var element = document.deepActiveElement();
35 if (element)
36 element.dispatchEvent(TestRunner.createKeyEvent('ArrowRight'));
37 dumpFocus();
38 }
39
40 function left() {
41 var element = document.deepActiveElement();
42 if (element)
43 element.dispatchEvent(TestRunner.createKeyEvent('ArrowLeft'));
44 dumpFocus();
45 }
46
47 function enter() {
48 var element = document.deepActiveElement();
49 if (element)
50 element.dispatchEvent(TestRunner.createKeyEvent('Enter'));
51 dumpFocus();
52 }
53
54
55 function dumpFocus() {
56 var element = document.deepActiveElement();
57 if (!element) {
58 TestRunner.addResult("null");
59 return;
60 }
61 TestRunner.addResult(element.textContent);
62 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-unit/tabbed-pane-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698