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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/inspector-unit/tabbed-pane.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-unit/tabbed-pane.js b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/tabbed-pane.js
new file mode 100644
index 0000000000000000000000000000000000000000..9782aba45fa6272cd15c7a23937730d7de4fd444
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector-unit/tabbed-pane.js
@@ -0,0 +1,62 @@
+TestRunner.addResult("This tests if the TabbedPane is keyboard navigable.");
+
+class FocusableWidget extends UI.Widget {
+ constructor(name) {
+ super();
+ this.element.tabIndex = -1;
+ this.element.textContent = name;
+ this.setDefaultFocusedElement(this.element);
+ }
+}
+
+var tabbedPane = new UI.TabbedPane();
+tabbedPane.show(UI.inspectorView.element);
+TestRunner.addSniffer(tabbedPane, '_innerUpdateTabElements').then(tabsAdded);
+for (var i = 0; i < 10; i++)
+ tabbedPane.appendTab(i.toString(), 'Tab ' + i, new FocusableWidget('Widget ' + i));
+
+function tabsAdded() {
+ tabbedPane._currentTab.tabElement.focus();
+ dumpFocus();
+ TestRunner.addResult('Moving right and wrapping around');
+ for (var i = 0; i < 20; i++)
+ right();
+ TestRunner.addResult('Moving left and focusing widgets')
+ for (var i = 0; i < 10; i++) {
+ left();
+ enter();
+ tabbedPane._currentTab.tabElement.focus();
+ }
+ TestRunner.completeTest();
+}
+
+function right() {
+ var element = document.deepActiveElement();
+ if (element)
+ element.dispatchEvent(TestRunner.createKeyEvent('ArrowRight'));
+ dumpFocus();
+}
+
+function left() {
+ var element = document.deepActiveElement();
+ if (element)
+ element.dispatchEvent(TestRunner.createKeyEvent('ArrowLeft'));
+ dumpFocus();
+}
+
+function enter() {
+ var element = document.deepActiveElement();
+ if (element)
+ element.dispatchEvent(TestRunner.createKeyEvent('Enter'));
+ dumpFocus();
+}
+
+
+function dumpFocus() {
+ var element = document.deepActiveElement();
+ if (!element) {
+ TestRunner.addResult("null");
+ return;
+ }
+ TestRunner.addResult(element.textContent);
+}
« 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