blob: 6e7f7077e4b4312b631a05c7228a396c9c20708b [file] [edit]
<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");
let isCocoa = accessibilityController.platformName == "mac" || accessibilityController.platformName == "ios";
if (isCocoa)
testOutput += `The accessibility description of #time is \"${timeInput.customContent}\"\n`;
else
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() {
if (isCocoa) {
await waitFor(() => timeInput.customContent.includes("Foobar") );
testOutput += `The accessibility description of #time is \"${timeInput.customContent}\"\n`;
} else {
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>