From 16f6ab825d16b0198c7b5d8ee66030f1e857e45e Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 20 Aug 2020 18:51:20 +0000 Subject: [PATCH] Bug 1658748 [wpt PR 24975] - Add tests for disabled input clicks, a=testonly Automatic update from web-platform-tests Add tests for disabled input clicks See https://github.com/whatwg/html/pull/5805; this tests the scenario there plus others. -- wpt-commits: ed728bc7b01fed9c0cf7f4794d592fb2f1e151fa wpt-pr: 24975 --- .../dom/events/Event-dispatch-click.html | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/testing/web-platform/tests/dom/events/Event-dispatch-click.html b/testing/web-platform/tests/dom/events/Event-dispatch-click.html index 7690f753d9cd0..4b07103027139 100644 --- a/testing/web-platform/tests/dom/events/Event-dispatch-click.html +++ b/testing/web-platform/tests/dom/events/Event-dispatch-click.html @@ -209,6 +209,38 @@ input.dispatchEvent(new MouseEvent('click')); }, `disconnected radio should be checked from dispatchEvent(new MouseEvent('click'))`); +test(() => { + const input = document.createElement("input"); + input.type = "checkbox"; + input.disabled = true; + input.dispatchEvent(new MouseEvent("click")); + assert_true(input.checked); +}, `disabled checkbox should be checked from dispatchEvent(new MouseEvent("click"))`); + +test(() => { + const input = document.createElement("input"); + input.type = "radio"; + input.disabled = true; + input.dispatchEvent(new MouseEvent("click")); + assert_true(input.checked); +}, `disabled radio should be checked from dispatchEvent(new MouseEvent("click"))`); + +async_test(t => { + const input = document.createElement("input"); + input.type = "checkbox"; + input.disabled = true; + input.onclick = t.step_func_done(); + input.dispatchEvent(new MouseEvent("click")); +}, `disabled checkbox should fire onclick`); + +async_test(t => { + const input = document.createElement("input"); + input.type = "radio"; + input.disabled = true; + input.onclick = t.step_func_done(); + input.dispatchEvent(new MouseEvent("click")); +}, `disabled radio should fire onclick`); + async_test(function(t) { var form = document.createElement("form") var didSubmit = false