Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/inspector/widget-focus.html |
| diff --git a/third_party/WebKit/LayoutTests/inspector/widget-focus.html b/third_party/WebKit/LayoutTests/inspector/widget-focus.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8596f964ee8d8cdac6949f24ea2d666a2f2a674d |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/inspector/widget-focus.html |
| @@ -0,0 +1,68 @@ |
| +<html> |
|
dgozman
2016/09/12 21:21:14
Let's place it under inspector/components.
einbinder
2016/09/12 22:19:05
Done.
|
| +<head> |
| +<script src="../http/tests/inspector/inspector-test.js"></script> |
| +<script> |
| +function test() |
| +{ |
| + var outerInput = document.createElement("input"); |
| + WebInspector.inspectorView.element.appendChild(outerInput); |
| + |
| + 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.
|
| + mainWidget.show(WebInspector.inspectorView.element); |
| + |
| + var widget1 = new WebInspector.Widget(); |
| + widget1.show(mainWidget.element); |
| + var input1 = document.createElement("input"); |
| + widget1.element.appendChild(input1); |
| + widget1.setDefaultFocusedElement(input1); |
| + |
| + var widget2 = new WebInspector.Widget(); |
| + widget2.show(mainWidget.element); |
| + var input2 = document.createElement("input"); |
| + widget2.element.appendChild(input2); |
| + widget2.setDefaultFocusedElement(input2); |
| + |
| + outerInput.focus(); |
| + dumpFocus(); |
| + |
| + widget1.focus(); |
| + dumpFocus(); |
| + |
| + input2.focus(); |
| + dumpFocus(); |
| + |
| + outerInput.focus(); |
| + dumpFocus(); |
| + |
| + mainWidget.focus(); |
| + dumpFocus(); |
| + |
| + outerInput.focus(); |
| + dumpFocus(); |
| + |
| + widget2.hideWidget(); |
| + mainWidget.focus(); |
| + dumpFocus(); |
| + |
| + InspectorTest.completeTest(); |
| + |
| + function dumpFocus(){ |
|
dgozman
2016/09/12 21:21:14
{ on next line
einbinder
2016/09/12 22:19:05
Done.
|
| + 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
|
| + if (focused === outerInput) { |
| + InspectorTest.addResult("Outer Focused"); |
| + } else if (focused === input1) { |
| + InspectorTest.addResult("Input1 Focused"); |
| + } else if (focused === input2) { |
| + InspectorTest.addResult("Input2 Focused"); |
| + } |
| + else { |
|
dgozman
2016/09/12 21:21:14
} else on the same line
einbinder
2016/09/12 22:19:05
Done.
|
| + InspectorTest.addResult("No focus"); |
| + } |
| + } |
| +} |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +<p>Tests whether focus is properly remembered on widgets.</p> |
| +</body> |
| +</html> |