39 lines
1.1 KiB
HTML
39 lines
1.1 KiB
HTML
<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>
|