1
0
Fork 0
firefox/testing/web-platform/tests/html-aam/roles-dynamic-switch.tentative.window.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

71 lines
2.6 KiB
JavaScript

// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/resources/testdriver-actions.js
promise_test(async () => {
const control = document.createElement("input");
control.type = "checkbox";
control.switch = true;
const role = await test_driver.get_computed_role(control);
assert_equals(role, "");
}, `Disconnected <input type=checkbox switch>`);
promise_test(async t => {
const control = document.createElement("input");
t.add_cleanup(() => control.remove());
control.type = "checkbox";
control.switch = true;
document.body.append(control);
const role = await test_driver.get_computed_role(control);
assert_equals(role, "switch");
}, `Connected <input type=checkbox switch>`);
promise_test(async t => {
const control = document.createElement("input");
t.add_cleanup(() => control.remove());
control.type = "checkbox";
document.body.append(control);
let role = await test_driver.get_computed_role(control);
assert_equals(role, "checkbox");
control.switch = true;
role = await test_driver.get_computed_role(control);
assert_equals(role, "switch");
}, `Connected <input type=checkbox switch>: adding switch attribute`);
promise_test(async t => {
const control = document.createElement("input");
t.add_cleanup(() => control.remove());
control.type = "checkbox";
control.switch = true;
document.body.append(control);
let role = await test_driver.get_computed_role(control);
assert_equals(role, "switch");
control.switch = false;
role = await test_driver.get_computed_role(control);
assert_equals(role, "checkbox");
}, `Connected <input type=checkbox switch>: removing switch attribute`);
promise_test(async t => {
const control = document.createElement("input");
t.add_cleanup(() => control.remove());
control.type = "checkbox";
document.body.append(control);
control.switch = true;
let role = await test_driver.get_computed_role(control);
assert_equals(role, "switch");
control.removeAttribute("type");
role = await test_driver.get_computed_role(control);
assert_equals(role, "textbox");
}, `Connected <input type=checkbox switch>: removing type attribute`);
promise_test(async t => {
const control = document.createElement("input");
t.add_cleanup(() => control.remove());
control.switch = true;
document.body.append(control);
let role = await test_driver.get_computed_role(control);
assert_equals(role, "textbox");
control.type = "checkbox";
role = await test_driver.get_computed_role(control);
assert_equals(role, "switch");
}, `Connected <input type=checkbox switch>: adding type attribute`);