accessible/tests/mochitest/events/test_valuechange.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <html>
michael@0 2
michael@0 3 <head>
michael@0 4 <title>Accessible value 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="../events.js"></script>
michael@0 18
michael@0 19 <script type="application/javascript"
michael@0 20 src="../value.js"></script>
michael@0 21
michael@0 22 <script type="application/javascript">
michael@0 23
michael@0 24
michael@0 25 /**
michael@0 26 * Do tests.
michael@0 27 */
michael@0 28 var gQueue = null;
michael@0 29
michael@0 30 // Value change invoker
michael@0 31 function changeARIAValue(aNodeOrID, aValuenow, aValuetext)
michael@0 32 {
michael@0 33 this.DOMNode = getNode(aNodeOrID);
michael@0 34
michael@0 35 this.invoke = function changeARIAValue_invoke() {
michael@0 36
michael@0 37 // Note: this should not fire an EVENT_VALUE_CHANGE when aria-valuetext
michael@0 38 // is not empty
michael@0 39 if (aValuenow != undefined)
michael@0 40 this.DOMNode.setAttribute("aria-valuenow", aValuenow);
michael@0 41
michael@0 42 // Note: this should always fire an EVENT_VALUE_CHANGE
michael@0 43 if (aValuetext != undefined)
michael@0 44 this.DOMNode.setAttribute("aria-valuetext", aValuetext);
michael@0 45 }
michael@0 46
michael@0 47 this.check = function changeARIAValue_check() {
michael@0 48 var acc = getAccessible(aNodeOrID, [nsIAccessibleValue]);
michael@0 49 if (!acc)
michael@0 50 return;
michael@0 51
michael@0 52 // Note: always test against valuetext first because the existence of
michael@0 53 // aria-valuetext takes precedence over aria-valuenow in gecko.
michael@0 54 is(acc.value, (aValuetext != undefined)? aValuetext : aValuenow,
michael@0 55 "Wrong value of " + prettyName(aNodeOrID));
michael@0 56 }
michael@0 57
michael@0 58 this.getID = function changeARIAValue_getID() {
michael@0 59 return prettyName(aNodeOrID) + " value changed";
michael@0 60 }
michael@0 61 }
michael@0 62
michael@0 63 function changeValue(aID, aValue)
michael@0 64 {
michael@0 65 this.DOMNode = getNode(aID);
michael@0 66
michael@0 67 this.invoke = function changeValue_invoke()
michael@0 68 {
michael@0 69 this.DOMNode.value = aValue;
michael@0 70 }
michael@0 71
michael@0 72 this.check = function changeValue_check()
michael@0 73 {
michael@0 74 var acc = getAccessible(this.DOMNode);
michael@0 75 is(acc.value, aValue, "Wrong value for " + prettyName(aID));
michael@0 76 }
michael@0 77
michael@0 78 this.getID = function changeValue_getID()
michael@0 79 {
michael@0 80 return prettyName(aID) + " value changed";
michael@0 81 }
michael@0 82 }
michael@0 83
michael@0 84 function changeProgressValue(aID, aValue)
michael@0 85 {
michael@0 86 this.DOMNode = getNode(aID);
michael@0 87
michael@0 88 this.invoke = function changeProgressValue_invoke()
michael@0 89 {
michael@0 90 this.DOMNode.value = aValue;
michael@0 91 }
michael@0 92
michael@0 93 this.check = function changeProgressValue_check()
michael@0 94 {
michael@0 95 var acc = getAccessible(this.DOMNode);
michael@0 96 is(acc.value, aValue+"%", "Wrong value for " + prettyName(aID));
michael@0 97 }
michael@0 98
michael@0 99 this.getID = function changeProgressValue_getID()
michael@0 100 {
michael@0 101 return prettyName(aID) + " value changed";
michael@0 102 }
michael@0 103 }
michael@0 104
michael@0 105 function changeRangeValue(aID)
michael@0 106 {
michael@0 107 this.DOMNode = getNode(aID);
michael@0 108
michael@0 109 this.invoke = function changeRangeValue_invoke()
michael@0 110 {
michael@0 111 synthesizeMouse(getNode(aID), 5, 5, { });
michael@0 112 }
michael@0 113
michael@0 114 this.finalCheck = function changeRangeValue_finalCheck()
michael@0 115 {
michael@0 116 var acc = getAccessible(this.DOMNode);
michael@0 117 is(acc.value, "0", "Wrong value for " + prettyName(aID));
michael@0 118 }
michael@0 119
michael@0 120 this.getID = function changeRangeValue_getID()
michael@0 121 {
michael@0 122 return prettyName(aID) + " range value changed";
michael@0 123 }
michael@0 124 }
michael@0 125
michael@0 126 function doTests()
michael@0 127 {
michael@0 128 // Test initial values
michael@0 129 testValue("slider_vn", "5", 5, 0, 1000, 0);
michael@0 130 testValue("slider_vnvt", "plain", 0, 0, 5, 0);
michael@0 131 testValue("slider_vt", "hi", 0, 0, 3, 0);
michael@0 132 testValue("scrollbar", "5", 5, 0, 1000, 0);
michael@0 133 testValue("progress", "22%", 22, 0, 100, 0);
michael@0 134 testValue("range", "6", 6, 0, 10, 1);
michael@0 135
michael@0 136 // Test value change events
michael@0 137 gQueue = new eventQueue(nsIAccessibleEvent.EVENT_VALUE_CHANGE);
michael@0 138
michael@0 139 gQueue.push(new changeARIAValue("slider_vn", "6", undefined));
michael@0 140 gQueue.push(new changeARIAValue("slider_vt", undefined, "hey!"));
michael@0 141 gQueue.push(new changeARIAValue("slider_vnvt", "3", "sweet"));
michael@0 142 gQueue.push(new changeARIAValue("scrollbar", "6", undefined));
michael@0 143
michael@0 144 gQueue.push(new changeValue("combobox", "hello"));
michael@0 145
michael@0 146 gQueue.push(new changeProgressValue("progress", "50"));
michael@0 147 gQueue.push(new changeRangeValue("range"));
michael@0 148
michael@0 149 gQueue.invoke(); // Will call SimpleTest.finish();
michael@0 150 }
michael@0 151
michael@0 152 SimpleTest.waitForExplicitFinish();
michael@0 153 addA11yLoadEvent(doTests);
michael@0 154 </script>
michael@0 155 </head>
michael@0 156
michael@0 157 <body>
michael@0 158
michael@0 159 <a target="_blank"
michael@0 160 href="https://bugzilla.mozilla.org/show_bug.cgi?id=478032"
michael@0 161 title=" Fire delayed value changed event for aria-valuetext changes">
michael@0 162 Mozilla Bug 478032
michael@0 163 </a>
michael@0 164 <a target="_blank"
michael@0 165 href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289"
michael@0 166 title="We dont expose new aria role 'scrollbar' and property aria-orientation">
michael@0 167 Mozilla Bug 529289
michael@0 168 </a>
michael@0 169 <a target="_blank"
michael@0 170 href="https://bugzilla.mozilla.org/show_bug.cgi?id=559764"
michael@0 171 title="Make HTML5 input@type=range element accessible">
michael@0 172 Mozilla Bug 559764
michael@0 173 </a>
michael@0 174 <a target="_blank"
michael@0 175 href="https://bugzilla.mozilla.org/show_bug.cgi?id=703202"
michael@0 176 title="ARIA comboboxes don't fire value change events">
michael@0 177 Mozilla Bug 703202
michael@0 178 </a>
michael@0 179 <a target="_blank"
michael@0 180 href="https://bugzilla.mozilla.org/show_bug.cgi?id=761901"
michael@0 181 title=" HTML5 progress accessible should fire value change event">
michael@0 182 Mozilla Bug 761901
michael@0 183 </a>
michael@0 184
michael@0 185
michael@0 186 <p id="display"></p>
michael@0 187 <div id="content" style="display: none"></div>
michael@0 188 <pre id="test">
michael@0 189 </pre>
michael@0 190 <div id="eventdump"></div>
michael@0 191
michael@0 192 <!-- ARIA sliders -->
michael@0 193 <div id="slider_vn" role="slider" aria-valuenow="5"
michael@0 194 aria-valuemin="0" aria-valuemax="1000">slider</div>
michael@0 195
michael@0 196 <div id="slider_vt" role="slider" aria-valuetext="hi"
michael@0 197 aria-valuemin="0" aria-valuemax="3">greeting slider</div>
michael@0 198
michael@0 199 <div id="slider_vnvt" role="slider" aria-valuenow="0" aria-valuetext="plain"
michael@0 200 aria-valuemin="0" aria-valuemax="5">sweetness slider</div>
michael@0 201
michael@0 202 <!-- ARIA scrollbar -->
michael@0 203 <div id="scrollbar" role="scrollbar" aria-valuenow="5"
michael@0 204 aria-valuemin="0" aria-valuemax="1000">slider</div>
michael@0 205
michael@0 206 <!-- ARIA combobox -->
michael@0 207 <input id="combobox" role="combobox" aria-autocomplete="inline">
michael@0 208
michael@0 209 <!-- progress bar -->
michael@0 210 <progress id="progress" value="22" max="100"></progress>
michael@0 211
michael@0 212 <!-- input@type="range" -->
michael@0 213 <input type="range" id="range" min="0" max="10" value="6">
michael@0 214
michael@0 215 </body>
michael@0 216 </html>

mercurial