Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for disabled input clicks #24975

Merged
merged 3 commits into from
Aug 13, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions dom/events/Event-dispatch-click.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,48 @@
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);
domenic marked this conversation as resolved.
Show resolved Hide resolved
}, `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"))`);

test(t => {
const input = document.createElement("input");
input.type = "checkbox";
input.disabled = true;
const label = document.createElement("label");
label.append(input);
dump.append(label);
label.click();
assert_false(input.checked);
label.dispatchEvent(new MouseEvent("click"));
assert_false(input.checked);
}, "disabled checkbox should not be checked from label click");
saschanaz marked this conversation as resolved.
Show resolved Hide resolved

test(t => {
const input = document.createElement("input");
input.type = "checkbox";
input.disabled = true;
const label = document.createElement("label");
label.append(input);
dump.append(label);
label.click();
assert_false(input.checked);
label.dispatchEvent(new MouseEvent("click"));
assert_false(input.checked);
}, "disabled radio should not be checked from label click");

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