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

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/uievents/legacy-domevents-tests/approved/dispatchEvent.click.checkbox.html

Issue 1933203002: Import web-platform-tests@343606cdf8f6c7442d1a0309a9fcdd47d6244eca (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase against web-platform tests to pick up my whitespace fix upstream Created 4 years, 8 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
Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/uievents/legacy-domevents-tests/approved/dispatchEvent.click.checkbox.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/uievents/legacy-domevents-tests/approved/dispatchEvent.click.checkbox.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/uievents/legacy-domevents-tests/approved/dispatchEvent.click.checkbox.html
new file mode 100644
index 0000000000000000000000000000000000000000..fb2c6a34f2f70ea62f74685297862700c3282d3f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/uievents/legacy-domevents-tests/approved/dispatchEvent.click.checkbox.html
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title> MouseEvent: Default action and synthetic click event </title>
+<script src="../../../../../resources/testharness.js"></script>
+<script src="../../../../../resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id=log></div>
+
+<div style="display: none">
+ <input type="checkbox" id="target">
+ <button id="button"> Click Here </button>
+</div>
+
+<script>
+ setup({explicit_done:true});
+ var EVENT = "click";
+ var TARGET = document.getElementById("target");
+ var BUTTON = document.getElementById("button");
+ var state;
+
+ var description = "Test Description: " +
+ "MouseEvent: Default action is performed when a synthetic click event is dispatched on a checkbox element";
+
+ BUTTON.addEventListener(EVENT, TestEvent, true);
+ TARGET.addEventListener(EVENT, TestEvent, true);
+
+ window.onload = function()
+ {
+ state = TARGET.checked;
+ BUTTON.click();
+ }
+
+ function TestEvent(evt)
+ {
+ if (BUTTON == evt.target)
+ {
+ var e;
+ test(function()
+ {
+ BUTTON.removeEventListener(EVENT, TestEvent, true);
+
+ e = document.createEvent("MouseEvent");
+ e.initMouseEvent(EVENT, /* type */
+ false, /* bubbles */
+ true, /* cancelable */
+ window, /* view */
+ 1, /* detail */
+ 0, /* screenX */
+ 0, /* screenY */
+ 0, /* clientX */
+ 0, /* clientY */
+ false, /* ctrlKey */
+ false, /* altKey */
+ false, /* shiftKey */
+ false, /* metaKey */
+ 0, /* button */
+ null /* relatedTarget */);
+
+ assert_array_equals([TARGET.checked, e.type, e.bubbles], [state, EVENT, false]);
+
+ }, "Checkbox state is unchanged before the synthetic click event is dispatched");
+
+ TARGET.dispatchEvent(e);
+ }
+ else if (TARGET == evt.target)
+ {
+ test(function()
+ {
+ assert_array_equals([TARGET.checked, evt.type, evt.bubbles], [!state, EVENT, false]);
+
+ }, description);
+
+ done();
+ }
+ }
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698