Skip to content

Commit

Permalink
Add tests for disabled input clicks
Browse files Browse the repository at this point in the history
See whatwg/html#5805; this tests the scenario there plus others.
  • Loading branch information
saschanaz committed Aug 13, 2020
1 parent 1680a1d commit ed728bc
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions dom/events/Event-dispatch-click.html
Expand Up @@ -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
Expand Down

0 comments on commit ed728bc

Please sign in to comment.