1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/events/test_attrs.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,90 @@ 1.4 +<html> 1.5 + 1.6 +<head> 1.7 + <title>Event object attributes tests</title> 1.8 + 1.9 + <link rel="stylesheet" type="text/css" 1.10 + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.14 + <script type="application/javascript" 1.15 + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 1.16 + 1.17 + <script type="application/javascript" 1.18 + src="../common.js"></script> 1.19 + <script type="application/javascript" 1.20 + src="../events.js"></script> 1.21 + <script type="application/javascript" 1.22 + src="../attributes.js"></script> 1.23 + 1.24 + <script type="application/javascript"> 1.25 + 1.26 + /** 1.27 + * Test "event-from-input" object attribute. 1.28 + */ 1.29 + function eventFromInputChecker(aEventType, aID, aValue, aNoTargetID) 1.30 + { 1.31 + this.type = aEventType; 1.32 + this.target = getAccessible(aID); 1.33 + 1.34 + this.noTarget = getNode(aNoTargetID); 1.35 + 1.36 + this.check = function checker_check(aEvent) 1.37 + { 1.38 + testAttrs(aEvent.accessible, { "event-from-input": aValue }, true); 1.39 + 1.40 + var accessible = getAccessible(this.noTarget); 1.41 + testAbsentAttrs(accessible, { "event-from-input": "" }); 1.42 + } 1.43 + } 1.44 + 1.45 + /** 1.46 + * Do tests. 1.47 + */ 1.48 + var gQueue = null; 1.49 + 1.50 + // gA11yEventDumpID = "eventdump"; // debug stuff 1.51 + //gA11yEventDumpToConsole = true; // debug stuff 1.52 + 1.53 + function doTests() 1.54 + { 1.55 + gQueue = new eventQueue(); 1.56 + 1.57 + var id = "textbox", noTargetId = "textarea"; 1.58 + var checker = 1.59 + new eventFromInputChecker(EVENT_FOCUS, id, "false", noTargetId); 1.60 + gQueue.push(new synthFocus(id, checker)); 1.61 + 1.62 + if (!MAC) { // Mac failure is bug 541093 1.63 + var checker = 1.64 + new eventFromInputChecker(EVENT_TEXT_CARET_MOVED, id, "true", noTargetId); 1.65 + gQueue.push(new synthHomeKey(id, checker)); 1.66 + } 1.67 + 1.68 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.69 + } 1.70 + 1.71 + SimpleTest.waitForExplicitFinish(); 1.72 + addA11yLoadEvent(doTests); 1.73 + </script> 1.74 +</head> 1.75 + 1.76 +<body> 1.77 + 1.78 + <a target="_blank" 1.79 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=540285" 1.80 + title="Event object attributes testing"> 1.81 + Mozilla Bug 540285 1.82 + </a> 1.83 + <p id="display"></p> 1.84 + <div id="content" style="display: none"></div> 1.85 + <pre id="test"> 1.86 + </pre> 1.87 + 1.88 + <input id="textbox" value="hello"> 1.89 + <textarea id="textarea"></textarea> 1.90 + 1.91 + <div id="eventdump"></div> 1.92 +</body> 1.93 +</html>