OLD | NEW |
1 TestRunner.addResult("This tests if the TabbedPane is keyboard navigable."); | 1 TestRunner.addResult("This tests if the TabbedPane is keyboard navigable."); |
2 | 2 |
3 class FocusableWidget extends UI.Widget { | 3 class FocusableWidget extends UI.Widget { |
4 constructor(name) { | 4 constructor(name) { |
5 super(); | 5 super(); |
6 this.element.tabIndex = -1; | 6 this.element.tabIndex = -1; |
7 this.element.textContent = name; | 7 this.element.textContent = name; |
8 this.setDefaultFocusedElement(this.element); | 8 this.setDefaultFocusedElement(this.element); |
9 } | 9 } |
10 } | 10 } |
11 | 11 |
12 var tabbedPane = new UI.TabbedPane(); | 12 var tabbedPane = new UI.TabbedPane(); |
13 tabbedPane.show(UI.inspectorView.element); | 13 tabbedPane.show(UI.inspectorView.element); |
14 TestRunner.addSniffer(tabbedPane, '_innerUpdateTabElements').then(tabsAdded); | 14 TestRunner.addSnifferPromise(tabbedPane, '_innerUpdateTabElements').then(tabsAdd
ed); |
15 for (var i = 0; i < 10; i++) | 15 for (var i = 0; i < 10; i++) |
16 tabbedPane.appendTab(i.toString(), 'Tab ' + i, new FocusableWidget('Widget ' +
i)); | 16 tabbedPane.appendTab(i.toString(), 'Tab ' + i, new FocusableWidget('Widget ' +
i)); |
17 | 17 |
18 function tabsAdded() { | 18 function tabsAdded() { |
19 tabbedPane._currentTab.tabElement.focus(); | 19 tabbedPane._currentTab.tabElement.focus(); |
20 dumpFocus(); | 20 dumpFocus(); |
21 TestRunner.addResult('Moving right and wrapping around'); | 21 TestRunner.addResult('Moving right and wrapping around'); |
22 for (var i = 0; i < 20; i++) | 22 for (var i = 0; i < 20; i++) |
23 right(); | 23 right(); |
24 TestRunner.addResult('Moving left and focusing widgets') | 24 TestRunner.addResult('Moving left and focusing widgets') |
(...skipping 28 matching lines...) Expand all Loading... |
53 | 53 |
54 | 54 |
55 function dumpFocus() { | 55 function dumpFocus() { |
56 var element = document.deepActiveElement(); | 56 var element = document.deepActiveElement(); |
57 if (!element) { | 57 if (!element) { |
58 TestRunner.addResult("null"); | 58 TestRunner.addResult("null"); |
59 return; | 59 return; |
60 } | 60 } |
61 TestRunner.addResult(element.textContent); | 61 TestRunner.addResult(element.textContent); |
62 } | 62 } |
OLD | NEW |