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

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

Issue 2319523004: DevTools: Remember the last focused widget. (Closed)
Patch Set: Add 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/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/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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/widget-focus-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698