Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
|
dgozman
2016/09/12 21:21:14
Let's place it under inspector/components.
einbinder
2016/09/12 22:19:05
Done.
| |
| 2 <head> | |
| 3 <script src="../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script> | |
| 5 function test() | |
| 6 { | |
| 7 var outerInput = document.createElement("input"); | |
| 8 WebInspector.inspectorView.element.appendChild(outerInput); | |
| 9 | |
| 10 var mainWidget = new WebInspector.Widget(); | |
|
dgozman
2016/09/12 21:21:14
Let's add SplitWidget into a mix as well to exerci
einbinder
2016/09/12 22:19:04
Done.
| |
| 11 mainWidget.show(WebInspector.inspectorView.element); | |
| 12 | |
| 13 var widget1 = new WebInspector.Widget(); | |
| 14 widget1.show(mainWidget.element); | |
| 15 var input1 = document.createElement("input"); | |
| 16 widget1.element.appendChild(input1); | |
| 17 widget1.setDefaultFocusedElement(input1); | |
| 18 | |
| 19 var widget2 = new WebInspector.Widget(); | |
| 20 widget2.show(mainWidget.element); | |
| 21 var input2 = document.createElement("input"); | |
| 22 widget2.element.appendChild(input2); | |
| 23 widget2.setDefaultFocusedElement(input2); | |
| 24 | |
| 25 outerInput.focus(); | |
| 26 dumpFocus(); | |
| 27 | |
| 28 widget1.focus(); | |
| 29 dumpFocus(); | |
| 30 | |
| 31 input2.focus(); | |
| 32 dumpFocus(); | |
| 33 | |
| 34 outerInput.focus(); | |
| 35 dumpFocus(); | |
| 36 | |
| 37 mainWidget.focus(); | |
| 38 dumpFocus(); | |
| 39 | |
| 40 outerInput.focus(); | |
| 41 dumpFocus(); | |
| 42 | |
| 43 widget2.hideWidget(); | |
| 44 mainWidget.focus(); | |
| 45 dumpFocus(); | |
| 46 | |
| 47 InspectorTest.completeTest(); | |
| 48 | |
| 49 function dumpFocus(){ | |
|
dgozman
2016/09/12 21:21:14
{ on next line
einbinder
2016/09/12 22:19:05
Done.
| |
| 50 var focused = WebInspector.currentFocusElement(); | |
|
dgozman
2016/09/12 21:21:14
Should we check document.deepActiveElement to not
einbinder
2016/09/12 22:19:04
document.deepActiveElement unfortunately isn't a t
| |
| 51 if (focused === outerInput) { | |
| 52 InspectorTest.addResult("Outer Focused"); | |
| 53 } else if (focused === input1) { | |
| 54 InspectorTest.addResult("Input1 Focused"); | |
| 55 } else if (focused === input2) { | |
| 56 InspectorTest.addResult("Input2 Focused"); | |
| 57 } | |
| 58 else { | |
|
dgozman
2016/09/12 21:21:14
} else on the same line
einbinder
2016/09/12 22:19:05
Done.
| |
| 59 InspectorTest.addResult("No focus"); | |
| 60 } | |
| 61 } | |
| 62 } | |
| 63 </script> | |
| 64 </head> | |
| 65 <body onload="runTest()"> | |
| 66 <p>Tests whether focus is properly remembered on widgets.</p> | |
| 67 </body> | |
| 68 </html> | |
| OLD | NEW |