blob: fd3df6b78c3cbb8f7b86a5eb7e78e48bdad06a4e [file] [log] [blame]
<html>
<head>
<script src="../resources/accessibility-helper.js"></script>
<script src="../resources/js-test.js"></script>
</head>
<body>
<div id="content">
<span id="message">This computer will self-destruct in</span>
<input id="time" type="text" value="10" aria-describedby="description1 description2"/>
<span id="unit"> minutes.</span>
<div id="description1">Allows you to specify the number of minutes after</div>
<div id="description2">which the computer will self-destruct.</div>
<div id="description3">Foobar.</div>
</div>
<script>
var testOutput = "This test ensures input elements properly use the aria-describedby in their accessibility description.\n\n";
if (window.accessibilityController) {
window.jsTestIsAsync = true;
var timeInput = accessibilityController.accessibleElementById("time");
testOutput += `The accessibility description of #time is \"${timeInput.helpText}\"\n`;
testOutput += `\nUpdating aria-describedby of #time to #description3.\n`;
document.getElementById("time").setAttribute("aria-describedby", "description3");
setTimeout(async function() {
await waitFor(() => timeInput.helpText.includes("Foobar") );
testOutput += `The accessibility description of #time is \"${timeInput.helpText}\"\n`;
document.getElementById("content").style.visibility = "hidden";
debug(testOutput);
finishJSTest();
}, 0);
}
</script>
</body>
</html>