// Ensure that clicking the inner checkbox element emits the expected
// events in the correct order.
synthesizeMouseAtCenter(mozCheckbox1.inputEl, {});
await TestUtils.waitForTick();
ok(
mozCheckbox1.checked, "Clicking the inner checkbox should toggle the checked attribute"
);
// Ensure that clicking the inner label element emits the
// expected events in the correct order.
synthesizeMouseAtCenter(mozCheckbox1.labelEl, {});
await TestUtils.waitForTick();
// Since we click the label element, there is an additional
// click event compared to the checkbox element, and this
// first click doesn't update the checked value
verifyEvents([
{ type: "click", localName: "moz-checkbox", checked: true, value: "1" },
{ type: "click", localName: "moz-checkbox", checked: false, value: "1" },
{ type: "input", localName: "moz-checkbox", checked: false, value: "1" },
{ type: "change", localName: "moz-checkbox", checked: false, value: "1" },
]);
ok(
!mozCheckbox1.checked, "Clicking the checkbox should toggle the checked attribute"
);
// Ensure that using the keyboard to activate the inner checkbox
// emits the expected events in the correct order.
mozCheckbox1.focus();
synthesizeKey(" ", {});
await TestUtils.waitForTick();
// Ensure clicking on a disabled moz-checkbox does not send
// any events.
synthesizeMouseAtCenter(mozCheckbox2.inputEl, {});
await TestUtils.waitForTick();
verifyEvents([]);
// Ensure clicking on a description within moz-checkbox does not
// change the value of the checkbox input.
synthesizeMouseAtCenter(mozCheckbox3.descriptionEl, {});
await TestUtils.waitForTick();
verifyEvents([
{ type: "click", localName: "moz-checkbox", checked: false, value: "3" },
]);
is(
mozCheckbox3.checked,
false, "Checkbox input should not change when clicking on description"
);
});
</script>
</pre>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.