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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/html/editing/focus/processing-model/focus-fixup-rule-one-no-dialogs.html

Issue 2477133002: Import wpt@306326cfe973b6c7019c50879ad03b02825c7539 (Closed)
Patch Set: Modify TestExpectations or download new baselines for tests. Created 4 years, 1 month 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
Index: third_party/WebKit/LayoutTests/imported/wpt/html/editing/focus/processing-model/focus-fixup-rule-one-no-dialogs.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/html/editing/focus/processing-model/focus-fixup-rule-one-no-dialogs.html b/third_party/WebKit/LayoutTests/imported/wpt/html/editing/focus/processing-model/focus-fixup-rule-one-no-dialogs.html
new file mode 100644
index 0000000000000000000000000000000000000000..dab9c5751476de64945cc8db8a1e7763f5d93026
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/html/editing/focus/processing-model/focus-fixup-rule-one-no-dialogs.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Focus fixup rule one (no &lt;dialog>s involved)</title>
+<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule-one">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<div>
+ <button id="button1">Button 1</button>
+ <button id="button2">Button 2</button>
+ <button id="button3">Button 3</button>
+ <div id="div" tabindex="0">Div</div>
+</div>
+
+<script>
+"use strict";
+
+async_test(t => {
+ const button = document.querySelector("#button1");
+ button.focus();
+
+ assert_equals(document.activeElement, button, "Sanity check: the button must start focused");
+
+ button.disabled = true;
+
+ assert_not_equals(document.activeElement, button, "After disabling, the button must no longer be focused");
+ assert_equals(document.activeElement, document.body, "After disabling, the body must be focused");
+
+}, "Disabling the active element (making it expressly inert)");
+
+test(() => {
+ const button = document.querySelector("#button2");
+ button.focus();
+
+ assert_equals(document.activeElement, button, "Sanity check: the button must start focused");
+
+ button.hidden = true;
+
+ assert_not_equals(document.activeElement, button, "After hiding, the button must no longer be focused");
+ assert_equals(document.activeElement, document.body, "After hiding, the body must be focused");
+
+}, "Hiding the active element");
+
+test(() => {
+ const button = document.querySelector("#button3");
+ button.focus();
+
+ assert_equals(document.activeElement, button, "Sanity check: the button must start focused");
+
+ button.remove();
+
+ assert_not_equals(document.activeElement, button, "After removing, the button must no longer be focused");
+ assert_equals(document.activeElement, document.body, "After removing, the body must be focused");
+
+}, "Removing the active element from the DOM");
+
+test(() => {
+ const div = document.querySelector("#div");
+ div.focus();
+
+ assert_equals(document.activeElement, div, "Sanity check: the div must start focused");
+
+ div.removeAttribute("tabindex");
+
+ assert_not_equals(document.activeElement, div, "After removing tabindex, the div must no longer be focused");
+ assert_equals(document.activeElement, document.body, "After removing tabindex, the body must be focused");
+
+}, "Removing the tabindex attribute from a div");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698