haikuwebkit/LayoutTests/accessibility/mac/aria-liveregion-on-image.html

41 lines
1.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body id="body">
<img aria-live="polite" src="test.gif" width=100 height=100 alt="alt text" tabindex=0 id="image">
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that ARIA live regions that is on an image will work when the alt tag is changed.");
var image = 0;
function ariaCallback(notification) {
if (notification == "AXLiveRegionChanged") {
image.removeNotificationListener();
finishJSTest();
}
}
if (window.accessibilityController) {
jsTestIsAsync = true;
document.getElementById("image").focus();
image = window.accessibilityController.focusedElement;
var addedNotification = image.addNotificationListener(ariaCallback);
shouldBe("addedNotification", "true");
// this should also trigger our live region change because its a text alternative change.
document.getElementById("image").setAttribute('alt', "new image text");
}
</script>
</body>
</html>