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

Unified Diff: third_party/WebKit/LayoutTests/inspector/components/widget-focus.html

Issue 2319523004: DevTools: Remember the last focused widget. (Closed)
Patch Set: Fix test Created 4 years, 3 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/inspector/components/widget-focus-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/inspector/components/widget-focus.html
diff --git a/third_party/WebKit/LayoutTests/inspector/components/widget-focus.html b/third_party/WebKit/LayoutTests/inspector/components/widget-focus.html
new file mode 100644
index 0000000000000000000000000000000000000000..ac5f92598b70bb711bb3a323a1aa5b364b5e1caf
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/components/widget-focus.html
@@ -0,0 +1,99 @@
+<html>
+<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();
+ mainWidget.show(WebInspector.inspectorView.element);
+
+ var widget1 = new WebInspector.Widget();
+ widget1.show(mainWidget.element);
+ var input1 = document.createElement("input");
+ input1.id = "input1";
+ widget1.element.appendChild(input1);
+ widget1.setDefaultFocusedElement(input1);
+
+ var widget2 = new WebInspector.Widget();
+ widget2.show(mainWidget.element);
+ var input2 = document.createElement("input");
+ input2.id = "input2";
+ 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();
+
+ var splitWidget = new WebInspector.SplitWidget();
+ splitWidget.show(mainWidget.element);
+ var widget3 = new WebInspector.Widget();
+ var input3 = document.createElement("input");
+ input1.id = "input3";
+ widget3.element.appendChild(input3);
+ widget3.setDefaultFocusedElement(input3);
+ splitWidget.setSidebarWidget(widget3);
+ var widget4 = new WebInspector.Widget();
+ var input4 = document.createElement("input");
+ input4.id = "input4";
+ widget4.element.appendChild(input4);
+ widget4.setDefaultFocusedElement(input4);
+ splitWidget.setMainWidget(widget4);
+
+ splitWidget.focus();
+ dumpFocus();
+
+ widget3.focus();
+ dumpFocus();
+
+ mainWidget.focus();
+ dumpFocus();
+
+ InspectorTest.completeTest();
+
+ function dumpFocus()
+ {
+ var focused = WebInspector.currentFocusElement();
+ if (focused === outerInput) {
+ InspectorTest.addResult("Outer Focused");
+ } else if (focused === input1) {
+ InspectorTest.addResult("Input1 Focused");
+ } else if (focused === input2) {
+ InspectorTest.addResult("Input2 Focused");
+ } else if (focused === input3) {
+ InspectorTest.addResult("Input3 Focused");
+ } else if (focused === input4) {
+ InspectorTest.addResult("Input4 Focused");
+ } else {
+ InspectorTest.addResult("No focus");
+ }
+ }
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests whether focus is properly remembered on widgets.</p>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/components/widget-focus-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698