blob: 5426c9a5b7c28068e17de8e00f12a9f6fc951b3d [file] [log] [blame]
simon.fraser@apple.comf75227e2015-08-04 03:00:09 +00001<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<html>
3<head>
4 <script src="../../resources/js-test-pre.js"></script>
5 <script src="../../editing/editing.js"></script>
6</head>
7<body id="body">
8
9 <input type="password" id="securevaluetest">
10
11 <input type="text" id="valuetest">
12
13 <p id="description"></p>
14 <div id="console"></div>
15 <div id="notifications"></div>
16
17 <script>
18
19 description("This tests value change notifications user info data when replacing the contents of an input field.");
20
21 var AXTextStateChangeTypeEdit = 1;
22
23 var AXTextEditTypeDelete = 1;
24 var AXTextEditTypeInsert = AXTextEditTypeDelete + 1;
25
26 var webArea = 0;
27 var count = 0;
28 var results = [];
29 var resultIndex = 0;
30 function notificationCallback(notification, userInfo) {
31 if (notification == "AXValueChanged") {
32 count++;
33 results.push(userInfo);
34 if (count == 2) {
35
36 shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
37 shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"0\"");
38 shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypeDelete");
39 shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
40 shouldBe("results[resultIndex][\"AXTextChangeValues\"][1][\"AXTextChangeValue\"]", "\"1\"");
41 shouldBe("results[resultIndex][\"AXTextChangeValues\"][1][\"AXTextEditType\"]", "AXTextEditTypeInsert");
42
43 // Password notifications will be insert only and the value string will be whitespace
44 resultIndex++;
45 shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
46 shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\" \"");
47 shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypeInsert");
48
49 webArea.removeNotificationListener();
50 window.testRunner.notifyDone();
51 }
52 }
53 }
54
55 function setvalue() {
56 document.getElementById("valuetest").value = "1";
57 }
58
59 function setsecurevalue() {
60 document.getElementById("securevaluetest").value = "1";
61 }
62
63 document.getElementById("valuetest").value = "0";
64 document.getElementById("securevaluetest").value = "0";
65
66 if (window.accessibilityController) {
67 window.testRunner.waitUntilDone();
68
69 accessibilityController.enableEnhancedAccessibility(true);
70
71 webArea = accessibilityController.rootElement.childAtIndex(0);
72 var addedNotification = webArea.addNotificationListener(notificationCallback);
73 shouldBe("addedNotification", "true");
74
75 setvalue();
76
77 setsecurevalue();
78 }
79 </script>
80
81 <script src="../../resources/js-test-post.js"></script>
82</body>
83</html>