Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | <html> |
michael@0 | 2 | |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Accessible text selection change events testing</title> |
michael@0 | 5 | |
michael@0 | 6 | <link rel="stylesheet" type="text/css" |
michael@0 | 7 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 13 | |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../common.js"></script> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../text.js"></script> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../events.js"></script> |
michael@0 | 20 | |
michael@0 | 21 | <script type="application/javascript"> |
michael@0 | 22 | var gQueue = null; |
michael@0 | 23 | |
michael@0 | 24 | // gA11yEventDumpID = "eventdump"; // debug stuff |
michael@0 | 25 | //gA11yEventDumpToConsole = true; |
michael@0 | 26 | |
michael@0 | 27 | function getOnclickSeq(aID) |
michael@0 | 28 | { |
michael@0 | 29 | return [ |
michael@0 | 30 | new caretMoveChecker(0, aID), |
michael@0 | 31 | new unexpectedInvokerChecker(EVENT_TEXT_SELECTION_CHANGED, aID) |
michael@0 | 32 | ]; |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | function doTests() |
michael@0 | 36 | { |
michael@0 | 37 | // test caret move events and caret offsets |
michael@0 | 38 | gQueue = new eventQueue(); |
michael@0 | 39 | |
michael@0 | 40 | gQueue.push(new synthClick("c1_p1", getOnclickSeq("c1_p1"))); |
michael@0 | 41 | gQueue.push(new synthDownKey("c1", new textSelectionChecker("c1", 0, 1), { shiftKey: true })); |
michael@0 | 42 | gQueue.push(new synthDownKey("c1", new textSelectionChecker("c1", 0, 2), { shiftKey: true })); |
michael@0 | 43 | |
michael@0 | 44 | gQueue.push(new synthClick("ta1", getOnclickSeq("ta1"))); |
michael@0 | 45 | gQueue.push(new synthRightKey("ta1", |
michael@0 | 46 | new textSelectionChecker("ta1", 0, 1), |
michael@0 | 47 | { shiftKey: true })); |
michael@0 | 48 | gQueue.push(new synthLeftKey("ta1", |
michael@0 | 49 | new textSelectionChecker("ta1", 0, 0))); |
michael@0 | 50 | |
michael@0 | 51 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 55 | addA11yLoadEvent(doTests); |
michael@0 | 56 | </script> |
michael@0 | 57 | </head> |
michael@0 | 58 | |
michael@0 | 59 | <body> |
michael@0 | 60 | |
michael@0 | 61 | <a target="_blank" |
michael@0 | 62 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=762934" |
michael@0 | 63 | title="Text selection change event has a wrong target when selection is spanned through several objects"> |
michael@0 | 64 | Bug 762934 |
michael@0 | 65 | </a> |
michael@0 | 66 | <a target="_blank" |
michael@0 | 67 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=956032" |
michael@0 | 68 | title="Text selection change event missed when selected text becomes unselected"> |
michael@0 | 69 | Bug 956032 |
michael@0 | 70 | </a> |
michael@0 | 71 | <p id="display"></p> |
michael@0 | 72 | <div id="content" style="display: none"></div> |
michael@0 | 73 | <pre id="test"> |
michael@0 | 74 | </pre> |
michael@0 | 75 | |
michael@0 | 76 | <div id="c1" contentEditable="true"> |
michael@0 | 77 | <p id="c1_p1">paragraph</p> |
michael@0 | 78 | <p id="c1_p2">paragraph</p> |
michael@0 | 79 | </div> |
michael@0 | 80 | |
michael@0 | 81 | <textarea id="ta1">Hello world</textarea> |
michael@0 | 82 | |
michael@0 | 83 | <div id="eventdump"></div> |
michael@0 | 84 | </body> |
michael@0 | 85 | </html> |