input-checkbox-switch.tentative.window.js (1232B)
1 test(t => { 2 const input = document.body.appendChild(document.createElement("input")); 3 t.add_cleanup(() => input.remove()); 4 input.type = "checkbox"; 5 input.switch = true; 6 assert_equals(getComputedStyle(input).appearance, "auto"); 7 }, "Default appearance value"); 8 9 test(t => { 10 const input = document.body.appendChild(document.createElement("input")); 11 t.add_cleanup(() => input.remove()); 12 input.type = "checkbox"; 13 input.switch = true; 14 input.style.display = "none" 15 assert_equals(getComputedStyle(input).display, "none"); 16 }, "Default appearance value: display:none"); 17 18 test(t => { 19 const input = document.body.appendChild(document.createElement("input")); 20 t.add_cleanup(() => input.remove()); 21 input.type = "checkbox"; 22 input.switch = true; 23 input.style.appearance = "none"; 24 assert_equals(getComputedStyle(input).appearance, "none"); 25 }, "appearance:none should work"); 26 27 test(t => { 28 const input = document.body.appendChild(document.createElement("input")); 29 t.add_cleanup(() => input.remove()); 30 input.type = "checkbox"; 31 input.switch = true; 32 input.style.appearance = "none"; 33 assert_equals(getComputedStyle(input).display, "inline"); 34 }, "appearance:none should work: display gets its initial value");