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

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-input-element/checkbox.html

Issue 1666363003: Import web-platform-tests@27e3d93f88a71a249d1df872a5d613b3243b9588 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed win failiure in TestExpectations Created 4 years, 10 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/html/semantics/forms/the-input-element/checkbox.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-input-element/checkbox.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-input-element/checkbox.html
index d0b029a4f2cf2f13fccbb57b8cdd98acb30ccca3..ffdeecb238ea90e68059dac49b2c4b4911d9744d 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-input-element/checkbox.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/semantics/forms/the-input-element/checkbox.html
@@ -2,7 +2,8 @@
<meta charset=utf-8>
<title>input type checkbox</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
-<link rel=help href="https://html.spec.whatwg.org/multipage/#checkbox-state-(type=checkbox)">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#checkbox-state-(type=checkbox)">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#run-synthetic-click-activation-steps">
<script src="../../../../../../resources/testharness.js"></script>
<script src="../../../../../../resources/testharnessreport.js"></script>
<div id="log"></div>
@@ -19,28 +20,39 @@
checkbox4 = document.getElementById('checkbox4'),
checkbox5 = document.getElementById('checkbox5'),
checkbox6 = document.getElementById('checkbox6'),
- c1_input_fired = false, c1_change_fired = false,
- t1 = async_test("click on mutable checkbox fires the input and change events"),
+ c1_click_fired = false,
+ c1_input_fired = false,
+ c1_change_fired = false,
+ t1 = async_test("click on mutable checkbox fires a click event, then an input event, then a change event"),
t2 = async_test("click on non-mutable checkbox doesn't fire the input or change event"),
t3 = async_test("pre-activation steps on unchecked checkbox"),
t4 = async_test("pre-activation steps on checked checkbox"),
t5 = async_test("canceled activation steps on unchecked checkbox"),
t6 = async_test("canceled activation steps on unchecked checkbox (indeterminate=true in onclick)");
- checkbox1.oninput= t1.step_func(function(e) {
+ checkbox1.onclick = t1.step_func(function () {
+ c1_click_fired = true;
+ assert_false(c1_input_fired, "click event should fire before input event");
+ assert_false(c1_change_fired, "click event should fire before change event");
+ });
+ checkbox1.oninput = t1.step_func(function(e) {
c1_input_fired = true;
+ assert_true(c1_click_fired, "input event should fire after click event");
+ assert_false(c1_change_fired, "input event should fire before change event");
assert_true(e.bubbles, "event should bubble");
assert_true(e.isTrusted, "event should be trusted");
- assert_false(e.cancelable, "event shoud not be cancelable");
+ assert_false(e.cancelable, "event should not be cancelable");
assert_true(checkbox1.checked, "checkbox is checked");
assert_false(checkbox1.indeterminate, "checkbox is not indeterminate");
});
checkbox1.onchange = t1.step_func(function(e) {
c1_change_fired = true;
+ assert_true(c1_click_fired, "change event should fire after click event");
+ assert_true(c1_input_fired, "change event should fire after input event");
assert_true(e.bubbles, "event should bubble")
assert_true(e.isTrusted, "event should be trusted");
- assert_false(e.cancelable, "event shoud not be cancelable");
+ assert_false(e.cancelable, "event should not be cancelable");
assert_true(checkbox1.checked, "checkbox is checked");
assert_false(checkbox1.indeterminate, "checkbox is not indeterminate");
});
@@ -83,9 +95,22 @@
checkbox5.onclick = t5.step_func(function(e) {
e.preventDefault();
- assert_false(checkbox5.checked);
+ /*
+ The prevention of the click doesn't have an effect until after all the
+ click event handlers have been run.
+ */
+ assert_true(checkbox5.checked);
assert_false(checkbox5.indeterminate);
- t5.done();
+ window.setTimeout(t5.step_func(function(e) {
+ /*
+ The click event has finished being dispatched, so the checkedness and
+ determinateness have been toggled back by now because the event
+ was preventDefault-ed.
+ */
+ assert_false(checkbox5.checked);
+ assert_false(checkbox5.indeterminate);
+ t5.done();
+ }), 0);
});
t5.step(function(){
@@ -97,9 +122,22 @@
checkbox6.onclick = t6.step_func(function(e) {
checkbox6.indeterminate = true;
e.preventDefault();
- assert_false(checkbox6.checked);
- assert_false(checkbox6.indeterminate);
- t6.done();
+ /*
+ The prevention of the click doesn't have an effect until after all the
+ click event handlers have been run.
+ */
+ assert_true(checkbox6.checked);
+ assert_true(checkbox6.indeterminate);
+ window.setTimeout(t6.step_func(function(e) {
+ /*
+ The click event has finished being dispatched, so the checkedness and
+ determinateness have been toggled back by now because the event
+ was preventDefault-ed.
+ */
+ assert_false(checkbox6.checked);
+ assert_false(checkbox6.indeterminate);
+ t6.done();
+ }), 0);
});
t6.step(function(){

Powered by Google App Engine
This is Rietveld 408576698