Skip to content

Commit

Permalink
Bug 1659197 [wpt PR 25020] - Add tests for legacy-activation-behavior…
Browse files Browse the repository at this point in the history
…s, a=testonly

Automatic update from web-platform-tests
Add tests for legacy-activation-behaviors

Corresponds to whatwg/html#5827.
--

wpt-commits: a7a7d482821337441dd86d508f8664b1c0a87146
wpt-pr: 25020
  • Loading branch information
saschanaz authored and moz-wptsync-bot committed Aug 25, 2020
1 parent 49f6b90 commit a5108e6
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions testing/web-platform/tests/dom/events/Event-dispatch-click.html
Expand Up @@ -241,6 +241,54 @@
input.dispatchEvent(new MouseEvent("click"));
}, `disabled radio should fire onclick`);

async_test(t => {
const input = document.createElement("input");
input.type = "checkbox";
input.disabled = true;
input.onclick = t.step_func(ev => {
assert_true(input.checked);
ev.preventDefault();
queueMicrotask(t.step_func_done(() => {
assert_false(input.checked);
}));
});
input.dispatchEvent(new MouseEvent("click", { cancelable: true }));
}, `disabled checkbox should get legacy-canceled-activation behavior`);

async_test(t => {
const input = document.createElement("input");
input.type = "radio";
input.disabled = true;
input.onclick = t.step_func(ev => {
assert_true(input.checked);
ev.preventDefault();
queueMicrotask(t.step_func_done(() => {
assert_false(input.checked);
}));
});
input.dispatchEvent(new MouseEvent("click", { cancelable: true }));
}, `disabled radio should get legacy-canceled-activation behavior`);

test(t => {
const input = document.createElement("input");
input.type = "checkbox";
input.disabled = true;
const ev = new MouseEvent("click", { cancelable: true });
ev.preventDefault();
input.dispatchEvent(ev);
assert_false(input.checked);
}, `disabled checkbox should get legacy-canceled-activation behavior 2`);

test(t => {
const input = document.createElement("input");
input.type = "radio";
input.disabled = true;
const ev = new MouseEvent("click", { cancelable: true });
ev.preventDefault();
input.dispatchEvent(ev);
assert_false(input.checked);
}, `disabled radio should get legacy-canceled-activation behavior 2`);

async_test(function(t) {
var form = document.createElement("form")
var didSubmit = false
Expand Down

0 comments on commit a5108e6

Please sign in to comment.