blob: 94fe3743e419ee036b2300cf3f13badedc1f7f54 [file] [edit]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/accessibility-helper.js"></script>
<script src="../resources/js-test.js"></script>
</head>
<body>
<!-- This tests that elements that are not live regions do not have the live region attrs. -->
<h3 tabindex=0 id="h3">no live region</h3>
<!-- These test that they have the correct default values for aria-live. -->
<div tabindex=0 id="alert" role="alert">test</div>
<div tabindex=0 id="alertdialog" role="alertdialog">test</div>
<div tabindex=0 id="log" role="log">test</div>
<div tabindex=0 id="status" role="status">test</div>
<div tabindex=0 id="timer" role="timer">test</div>
<!-- These test that elements with live regions on have the right attributes -->
<div tabindex=0 id="liveregion" role="group" aria-busy="true" aria-live="polite" aria-relevant="additions">
<h3 tabindex=0 aria-atomic="true" id="h3live">h3</h3>
</div>
<div tabindex=0 id="liveregion2" role="group" aria-live="polite"></div>
<!-- Default live region values per role. -->
<div tabindex=0 id="liveregion_alert" role="alert"><!-- atomic=true, live=assertive --></div>
<div tabindex=0 id="liveregion_status" role="status"><!-- atomic=true, live=polite --></div>
<div tabindex=0 id="liveregion_log" role="log"><!-- atomic=false, live=polite --></div>
<div tabindex=0 id="liveregion_timer" role="timer"><!-- atomic=false, live=off --></div>
<div tabindex=0 id="liveregion_marquee" role="marquee"><!-- atomic=false, live=off --></div>
<script>
description("This tests that the attributes used for ARIA live regions behave correctly.");
if (window.accessibilityController) {
window.jsTestIsAsync = true;
setTimeout(async function() {
// Make sure that regular elements are not exposing ARIA live attributes.
await waitForFocus("h3");
shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXElementBusy')", "true");
shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIARelevant')", "false");
shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIAAtomic')", "false");
shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIALive')", "false");
// Make sure that specific aria roles get the right aria live values.
await waitForFocus("alert");
shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'assertive'");
await waitForFocus("alertdialog");
shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'assertive'");
await waitForFocus("log");
shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'polite'");
await waitForFocus("status");
shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'polite'");
await waitForFocus("timer");
shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'off'");
// Test the other attributes for a live region
await waitForFocus("liveregion");
shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'polite'");
shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIARelevant')", "'additions'");
shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXElementBusy')", "true");
await waitForFocus("h3live");
shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIALive')", "false");
shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIARelevant')", "false");
shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXARIAAtomic')", "true");
shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXElementBusy')", "false");
// when an element has no specific aria-relevant, it should be additions text by default.
await waitForFocus("liveregion2");
shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIARelevant')", "'additions text'");
await waitForFocus("liveregion_alert");
shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'assertive'");
shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXARIAAtomic')", "true");
await waitForFocus("liveregion_status");
shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'polite'");
shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXARIAAtomic')", "true");
await waitForFocus("liveregion_log");
shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'polite'");
shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXARIAAtomic')", "false");
await waitForFocus("liveregion_timer");
shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIALive')", "false");
shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXARIAAtomic')", "false");
await waitForFocus("liveregion_marquee");
shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIALive')", "false");
shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXARIAAtomic')", "false");
finishJSTest();
}, 0);
}
</script>
</body>
</html>