blob: 2eab48fa66f31e03a261f5ee1265290a8b1cdbc1 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="../../editing/editing.js"></script>
</head>
<body id="body">
<div role="textbox" tabindex=0 id="textbox" contenteditable=true>01234567890</div>
<p id="description"></p>
<div id="console"></div>
<div id="notifications"></div>
<script>
description("This tests value change notifications user info data.");
var AXTextStateChangeTypeEdit = 1;
var AXTextEditTypeDelete = 1;
var AXTextEditTypeInsert = AXTextEditTypeDelete + 1;
var AXTextEditTypeTyping = AXTextEditTypeInsert + 1;
var AXTextEditTypeDictation = AXTextEditTypeTyping + 1;
var AXTextEditTypeCut = AXTextEditTypeDictation + 1
var AXTextEditTypePaste = AXTextEditTypeCut + 1;
var webArea = 0;
var count = 0;
var results = [];
var resultIndex = 0;
function notificationCallback(notification, userInfo) {
if (notification == "AXValueChanged") {
count++;
results.push(userInfo);
if (count == 6) {
shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"0\"");
shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypeCut");
resultIndex++;
shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"1\"");
shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypeDelete");
resultIndex++;
shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"0\"");
shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypePaste");
resultIndex++;
shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"234567890\"");
shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypePaste");
resultIndex++;
shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"1\"");
shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypeTyping");
resultIndex++;
shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"1\"");
shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypeDelete");
webArea.removeNotificationListener();
window.testRunner.notifyDone();
}
}
}
if (window.accessibilityController) {
window.testRunner.waitUntilDone();
accessibilityController.enableEnhancedAccessibility(true);
webArea = accessibilityController.rootElement.childAtIndex(0);
var addedNotification = webArea.addNotificationListener(notificationCallback);
shouldBe("addedNotification", "true");
var textbox = document.getElementById("textbox");
textbox.focus();
execSetSelectionCommand(textbox, 0);
execExtendSelectionRightByCharacterCommand();
cutCommand();
execExtendSelectionRightByCharacterCommand();
pasteCommand();
eventSender.keyDown("1");
deleteCommand();
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>