blob: dd9125c208660037b817ab8c5ab4fae758000068 [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">
<div role="textbox" id="textbox" contenteditable=true>123</div>
<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++;
if (count == 11) {
shouldBeTyping("1");
shouldBeDelete("1");
shouldBeTyping("\n");
shouldBeDelete("\n");
shouldBeTypingReplace("1", "2");
shouldBeCut("2");
shouldBePaste("2");
shouldBePasteReplace("3", "2");
shouldBeTypingReplace("2", "3");
shouldBeInsertReplace("3", "2");
shouldBeInsertReplace("2", "3");
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();
eventSender.keyDown("1");
deleteCommand();
eventSender.keyDown("\n");
deleteCommand();
execExtendSelectionRightByCharacterCommand();
eventSender.keyDown("2");
execExtendSelectionRightByCharacterCommand();
cutCommand();
pasteCommand();
execExtendSelectionRightByCharacterCommand();
pasteCommand();
execExtendSelectionLeftByCharacterCommand();
eventSender.keyDown("3");
execUndoCommand();
execRedoCommand();
}
</script>
</body>
</html>