|
1 <html> |
|
2 |
|
3 <head> |
|
4 <title>Event object attributes tests</title> |
|
5 |
|
6 <link rel="stylesheet" type="text/css" |
|
7 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
8 |
|
9 <script type="application/javascript" |
|
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
11 <script type="application/javascript" |
|
12 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
|
13 |
|
14 <script type="application/javascript" |
|
15 src="../common.js"></script> |
|
16 <script type="application/javascript" |
|
17 src="../events.js"></script> |
|
18 <script type="application/javascript" |
|
19 src="../attributes.js"></script> |
|
20 |
|
21 <script type="application/javascript"> |
|
22 |
|
23 /** |
|
24 * Test "event-from-input" object attribute. |
|
25 */ |
|
26 function eventFromInputChecker(aEventType, aID, aValue, aNoTargetID) |
|
27 { |
|
28 this.type = aEventType; |
|
29 this.target = getAccessible(aID); |
|
30 |
|
31 this.noTarget = getNode(aNoTargetID); |
|
32 |
|
33 this.check = function checker_check(aEvent) |
|
34 { |
|
35 testAttrs(aEvent.accessible, { "event-from-input": aValue }, true); |
|
36 |
|
37 var accessible = getAccessible(this.noTarget); |
|
38 testAbsentAttrs(accessible, { "event-from-input": "" }); |
|
39 } |
|
40 } |
|
41 |
|
42 /** |
|
43 * Do tests. |
|
44 */ |
|
45 var gQueue = null; |
|
46 |
|
47 // gA11yEventDumpID = "eventdump"; // debug stuff |
|
48 //gA11yEventDumpToConsole = true; // debug stuff |
|
49 |
|
50 function doTests() |
|
51 { |
|
52 gQueue = new eventQueue(); |
|
53 |
|
54 var id = "textbox", noTargetId = "textarea"; |
|
55 var checker = |
|
56 new eventFromInputChecker(EVENT_FOCUS, id, "false", noTargetId); |
|
57 gQueue.push(new synthFocus(id, checker)); |
|
58 |
|
59 if (!MAC) { // Mac failure is bug 541093 |
|
60 var checker = |
|
61 new eventFromInputChecker(EVENT_TEXT_CARET_MOVED, id, "true", noTargetId); |
|
62 gQueue.push(new synthHomeKey(id, checker)); |
|
63 } |
|
64 |
|
65 gQueue.invoke(); // Will call SimpleTest.finish(); |
|
66 } |
|
67 |
|
68 SimpleTest.waitForExplicitFinish(); |
|
69 addA11yLoadEvent(doTests); |
|
70 </script> |
|
71 </head> |
|
72 |
|
73 <body> |
|
74 |
|
75 <a target="_blank" |
|
76 href="https://bugzilla.mozilla.org/show_bug.cgi?id=540285" |
|
77 title="Event object attributes testing"> |
|
78 Mozilla Bug 540285 |
|
79 </a> |
|
80 <p id="display"></p> |
|
81 <div id="content" style="display: none"></div> |
|
82 <pre id="test"> |
|
83 </pre> |
|
84 |
|
85 <input id="textbox" value="hello"> |
|
86 <textarea id="textarea"></textarea> |
|
87 |
|
88 <div id="eventdump"></div> |
|
89 </body> |
|
90 </html> |