Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Tests AccessFu TraversalRules</title> |
michael@0 | 5 | <meta charset="utf-8" /> |
michael@0 | 6 | <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 7 | |
michael@0 | 8 | <script type="application/javascript" |
michael@0 | 9 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"> |
michael@0 | 10 | </script> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/chrome-harness.js"> |
michael@0 | 13 | </script> |
michael@0 | 14 | |
michael@0 | 15 | <script type="application/javascript" src="../common.js"></script> |
michael@0 | 16 | <script type="application/javascript" src="../browser.js"></script> |
michael@0 | 17 | <script type="application/javascript" src="../events.js"></script> |
michael@0 | 18 | <script type="application/javascript" src="../role.js"></script> |
michael@0 | 19 | <script type="application/javascript" src="../states.js"></script> |
michael@0 | 20 | <script type="application/javascript" src="../pivot.js"></script> |
michael@0 | 21 | <script type="application/javascript" src="../layout.js"></script> |
michael@0 | 22 | |
michael@0 | 23 | <script type="application/javascript"> |
michael@0 | 24 | Components.utils.import("resource://gre/modules/accessibility/TraversalRules.jsm"); |
michael@0 | 25 | var gBrowserWnd = null; |
michael@0 | 26 | var gQueue = null; |
michael@0 | 27 | |
michael@0 | 28 | function doTest() |
michael@0 | 29 | { |
michael@0 | 30 | var doc = currentTabDocument(); |
michael@0 | 31 | var docAcc = getAccessible(doc, [nsIAccessibleDocument]); |
michael@0 | 32 | |
michael@0 | 33 | gQueue = new eventQueue(); |
michael@0 | 34 | |
michael@0 | 35 | gQueue.onFinish = function onFinish() |
michael@0 | 36 | { |
michael@0 | 37 | closeBrowserWindow(); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | queueTraversalSequence(gQueue, docAcc, TraversalRules.Heading, null, |
michael@0 | 41 | ['heading-1', 'heading-2', 'heading-3', 'heading-5']); |
michael@0 | 42 | |
michael@0 | 43 | queueTraversalSequence(gQueue, docAcc, TraversalRules.Entry, null, |
michael@0 | 44 | ['input-1-1', 'label-1-2', 'input-1-3', |
michael@0 | 45 | 'input-1-4', 'input-1-5']); |
michael@0 | 46 | |
michael@0 | 47 | // move back an element to hit all the form elements, because the VC is |
michael@0 | 48 | // currently at the first input element |
michael@0 | 49 | gQueue.push(new setVCPosInvoker(docAcc, "movePrevious", |
michael@0 | 50 | TraversalRules.Heading, "heading-1")); |
michael@0 | 51 | |
michael@0 | 52 | queueTraversalSequence(gQueue, docAcc, TraversalRules.FormElement, null, |
michael@0 | 53 | ['input-1-1', 'label-1-2', 'button-1-1', |
michael@0 | 54 | 'radio-1-1', 'radio-1-2', 'input-1-3', |
michael@0 | 55 | 'input-1-4', 'button-1-2', 'checkbox-1-1', |
michael@0 | 56 | 'select-1-1', 'select-1-2', 'checkbox-1-2', |
michael@0 | 57 | 'select-1-3', 'input-1-5', 'button-1-3', |
michael@0 | 58 | 'button-2-1', 'button-2-2', 'button-2-3', |
michael@0 | 59 | 'button-2-4']); |
michael@0 | 60 | |
michael@0 | 61 | queueTraversalSequence(gQueue, docAcc, TraversalRules.Button, null, |
michael@0 | 62 | ['button-1-1', 'button-1-2', 'button-1-3', |
michael@0 | 63 | 'button-2-1', 'button-2-2', 'button-2-3', |
michael@0 | 64 | 'button-2-4']); |
michael@0 | 65 | |
michael@0 | 66 | queueTraversalSequence(gQueue, docAcc, TraversalRules.RadioButton, null, |
michael@0 | 67 | ['radio-1-1', 'radio-1-2']); |
michael@0 | 68 | |
michael@0 | 69 | queueTraversalSequence(gQueue, docAcc, TraversalRules.Checkbox, null, |
michael@0 | 70 | ['checkbox-1-1', 'checkbox-1-2']); |
michael@0 | 71 | |
michael@0 | 72 | queueTraversalSequence(gQueue, docAcc, TraversalRules.Combobox, null, |
michael@0 | 73 | ['select-1-1', 'select-1-2', 'select-1-3']); |
michael@0 | 74 | |
michael@0 | 75 | queueTraversalSequence(gQueue, docAcc, TraversalRules.List, null, |
michael@0 | 76 | ['list-1', 'list-2', 'list-3']); |
michael@0 | 77 | |
michael@0 | 78 | queueTraversalSequence(gQueue, docAcc, TraversalRules.ListItem, null, |
michael@0 | 79 | ['listitem-1-1', 'listitem-2-1', 'listitem-2-2', |
michael@0 | 80 | 'listitem-3-1', 'listitem-3-2', 'listitem-3-3', |
michael@0 | 81 | 'listitem-2-3']); |
michael@0 | 82 | |
michael@0 | 83 | queueTraversalSequence(gQueue, docAcc, TraversalRules.Graphic, null, |
michael@0 | 84 | ['image-2', 'image-3']); |
michael@0 | 85 | |
michael@0 | 86 | queueTraversalSequence(gQueue, docAcc, TraversalRules.Link, null, |
michael@0 | 87 | ['link-1', 'link-2', 'link-3']); |
michael@0 | 88 | |
michael@0 | 89 | queueTraversalSequence(gQueue, docAcc, TraversalRules.Anchor, null, |
michael@0 | 90 | ['anchor-1', 'anchor-2']); |
michael@0 | 91 | |
michael@0 | 92 | queueTraversalSequence(gQueue, docAcc, TraversalRules.Separator, null, |
michael@0 | 93 | ['separator-1', 'separator-2']); |
michael@0 | 94 | |
michael@0 | 95 | queueTraversalSequence(gQueue, docAcc, TraversalRules.Table, null, |
michael@0 | 96 | ['table-1', 'table-2']); |
michael@0 | 97 | |
michael@0 | 98 | queueTraversalSequence(gQueue, docAcc, TraversalRules.Simple, null, |
michael@0 | 99 | ['heading-1', 'Name:', 'input-1-1', 'label-1-2', |
michael@0 | 100 | 'button-1-1', 'Radios are old: ', 'radio-1-1', |
michael@0 | 101 | 'Radios are new: ', 'radio-1-2', 'Password:', |
michael@0 | 102 | 'input-1-3', 'Unlucky number:', 'input-1-4', |
michael@0 | 103 | 'button-1-2', 'Check me: ', 'checkbox-1-1', |
michael@0 | 104 | 'select-1-1', 'Value 1', 'Value 2', 'Value 3', |
michael@0 | 105 | 'Check me too: ', 'checkbox-1-2', 'But not me: ', |
michael@0 | 106 | 'Or me! ', 'Value 1', 'Value 2', 'Value 3', |
michael@0 | 107 | 'Electronic mailing address:', 'input-1-5', |
michael@0 | 108 | 'button-1-3', 'heading-2', 'heading-3', |
michael@0 | 109 | 'button-2-1', 'button-2-2', 'button-2-3', |
michael@0 | 110 | 'button-2-4', 'Programming Language', |
michael@0 | 111 | 'A esoteric weapon wielded by only the most ' + |
michael@0 | 112 | 'formidable warriors, for its unrelenting strict' + |
michael@0 | 113 | ' power is unfathomable.', |
michael@0 | 114 | 'Lists of Programming Languages', 'Lisp ', |
michael@0 | 115 | 'Scheme', 'Racket', 'Clojure', 'JavaScript', 'heading-5', |
michael@0 | 116 | 'image-2', 'image-3', 'Not actually an image', |
michael@0 | 117 | 'link-1', 'anchor-1', 'link-2', 'anchor-2', 'link-3', |
michael@0 | 118 | '3', '1', '4', '1', 'Just an innocuous separator', |
michael@0 | 119 | 'Dirty Words', 'Meaning', 'Mud', 'Wet Dirt', |
michael@0 | 120 | 'Dirt', 'Messy Stuff']); |
michael@0 | 121 | |
michael@0 | 122 | gQueue.invoke(); |
michael@0 | 123 | } |
michael@0 | 124 | |
michael@0 | 125 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 126 | addLoadEvent(function () { |
michael@0 | 127 | /* We open a new browser because we need to test with a top-level content |
michael@0 | 128 | document. */ |
michael@0 | 129 | openBrowserWindow( |
michael@0 | 130 | doTest, |
michael@0 | 131 | getRootDirectory(window.location.href) + "doc_traversal.html"); |
michael@0 | 132 | }); |
michael@0 | 133 | </script> |
michael@0 | 134 | </head> |
michael@0 | 135 | <body id="body"> |
michael@0 | 136 | |
michael@0 | 137 | <a target="_blank" |
michael@0 | 138 | title="Add tests for AccessFu TraversalRules" |
michael@0 | 139 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=933808">Mozilla Bug 933808</a> |
michael@0 | 140 | <p id="display"></p> |
michael@0 | 141 | <div id="content" style="display: none"></div> |
michael@0 | 142 | <pre id="test"> |
michael@0 | 143 | </pre> |
michael@0 | 144 | </body> |
michael@0 | 145 | </html> |