blob: d20cba374d1624460544a2432afdec63809620ff [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../editing/editing.js"></script>
<script src="value-change-helpers.js"></script>
</head>
<body id="body">
<input type="text" id="textbox" value="789"></input>
<p id="description"></p>
<div id="console"></div>
<div id="notifications"></div>
<script>
description("This tests value change notifications user info data.");
var webArea = 0;
var count = 0;
var resultIndex = -1;
var actualChangeTypes = [];
var actualChangeValues = [];
var actualEditTypes = [];
var expectedValues = [];
function notificationCallback(notification, userInfo) {
if (notification == "AXValueChanged") {
actualChangeTypes[count] = userInfo["AXTextStateChangeType"];
var changes = userInfo["AXTextChangeValues"];
if (changes && changes.length == 1) {
var change = changes[0];
actualChangeValues[count] = change["AXTextChangeValue"];
actualEditTypes[count] = stringForEditType(change["AXTextEditType"])
} else if (changes && changes.length == 2) {
var change1 = changes[0];
var change2 = changes[1];
actualChangeValues[count] = [change1["AXTextChangeValue"], change2["AXTextChangeValue"]];
actualEditTypes[count] = [stringForEditType(change1["AXTextEditType"]), stringForEditType(change2["AXTextEditType"])];
}
count++;
var expectedCount = 9;
if (count == expectedCount) {
shouldBeTyping("6");
shouldBeDelete("6");
shouldBeTypingReplace("7", "8");
shouldBeCut("8");
shouldBePaste("8");
shouldBePasteReplace("9", "8");
shouldBeTypingReplace("8", "9");
shouldBeInsertReplace("9", "8");
shouldBeInsertReplace("8", "9");
webArea.removeNotificationListener();
finishJSTest();
}
}
}
if (window.accessibilityController) {
jsTestIsAsync = true;
accessibilityController.enableEnhancedAccessibility(true);
webArea = accessibilityController.rootElement.childAtIndex(0);
var addedNotification = webArea.addNotificationListener(notificationCallback);
shouldBe("addedNotification", "true");
var textbox = document.getElementById("textbox");
textbox.focus();
execMoveSelectionLeftByCharacterCommand();
eventSender.keyDown("6");
deleteCommand();
execExtendSelectionRightByCharacterCommand();
eventSender.keyDown("8");
execExtendSelectionRightByCharacterCommand();
cutCommand();
pasteCommand();
execExtendSelectionRightByCharacterCommand();
pasteCommand();
execExtendSelectionLeftByCharacterCommand();
eventSender.keyDown("9");
execUndoCommand();
execRedoCommand();
}
</script>
</body>
</html>