blob: 616c7fc59a3a0503885ade85e8b384359969d093 [file] [log] [blame]
<html>
<head>
<script src="../resources/js-test.js"></script>
<script>
function runTest() {
jsTestIsAsync = true;
description("This tests that toggling an aria switch sends a notification.");
var widget = accessibilityController.accessibleElementById("switch");
var notificationCount = 0;
function listener(notification) {
if (notification == "CheckedStateChanged")
notificationCount++;
document.getElementById("console").innerText += "Got notification: " + notification + "\n";
if (notificationCount == 2) {
widget.removeNotificationListener(listener);
finishJSTest();
}
}
widget.addNotificationListener(listener);
document.getElementById('switch').setAttribute('aria-checked', 'true');
document.getElementById('switch').setAttribute('aria-checked', 'false');
};
</script>
</head>
<body onload="runTest()">
<div id="switch" role="switch" aria-checked="false">Test Switch</div>
<p id="description"></p>
<div id="console"></div>
</body>
</html>