mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 20:47:44 +00:00
150 lines
4.4 KiB
HTML
150 lines
4.4 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<title>Accessible value change events testing</title>
|
|
|
|
<link rel="stylesheet" type="text/css"
|
|
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
<script type="application/javascript"
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
src="../common.js"></script>
|
|
<script type="application/javascript"
|
|
src="../events.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
src="../value.js"></script>
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
/**
|
|
* Do tests.
|
|
*/
|
|
var gQueue = null;
|
|
|
|
// Value change invoker
|
|
function changeValue(aNodeOrID, aValuenow, aValuetext)
|
|
{
|
|
this.DOMNode = getNode(aNodeOrID);
|
|
|
|
this.invoke = function changeValue_invoke() {
|
|
|
|
// Note: this should not fire an EVENT_VALUE_CHANGE when aria-valuetext
|
|
// is not empty
|
|
if (aValuenow != undefined)
|
|
this.DOMNode.setAttribute("aria-valuenow", aValuenow);
|
|
|
|
// Note: this should always fire an EVENT_VALUE_CHANGE
|
|
if (aValuetext != undefined)
|
|
this.DOMNode.setAttribute("aria-valuetext", aValuetext);
|
|
}
|
|
|
|
this.check = function changeValue_check() {
|
|
var acc = getAccessible(aNodeOrID, [nsIAccessibleValue]);
|
|
if (!acc)
|
|
return;
|
|
|
|
// Note: always test against valuetext first because the existence of
|
|
// aria-valuetext takes precedence over aria-valuenow in gecko.
|
|
is(acc.value, (aValuetext != undefined)? aValuetext : aValuenow,
|
|
"Wrong value of " + prettyName(aNodeOrID));
|
|
}
|
|
|
|
this.getID = function changeValue_getID() {
|
|
return prettyName(aNodeOrID) + " value changed";
|
|
}
|
|
}
|
|
|
|
function changeInputValue(aID, aValue)
|
|
{
|
|
this.DOMNode = getNode(aID);
|
|
|
|
this.invoke = function changeInputValue_invoke()
|
|
{
|
|
this.DOMNode.value = aValue;
|
|
}
|
|
|
|
this.check = function changeInputValue_check()
|
|
{
|
|
var acc = getAccessible(this.DOMNode);
|
|
is(acc.value, aValue, "Wrong value for " + prettyName(aID));
|
|
}
|
|
|
|
this.getID = function changeInputValue_getID()
|
|
{
|
|
return prettyName(aID) + " value changed";
|
|
}
|
|
}
|
|
|
|
function doTests()
|
|
{
|
|
// Test initial values
|
|
testValue("slider_vn", "5", 5, 0, 1000, 0);
|
|
testValue("slider_vnvt", "plain", 0, 0, 5, 0);
|
|
testValue("slider_vt", "hi", 0, 0, 3, 0);
|
|
testValue("scrollbar", "5", 5, 0, 1000, 0);
|
|
|
|
// Test value change events
|
|
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_VALUE_CHANGE);
|
|
|
|
gQueue.push(new changeValue("slider_vn", "6", undefined));
|
|
gQueue.push(new changeValue("slider_vt", undefined, "hey!"));
|
|
gQueue.push(new changeValue("slider_vnvt", "3", "sweet"));
|
|
gQueue.push(new changeValue("scrollbar", "6", undefined));
|
|
|
|
gQueue.push(new changeInputValue("combobox", "hello"));
|
|
|
|
gQueue.invoke(); // Will call SimpleTest.finish();
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
addA11yLoadEvent(doTests);
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank"
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=478032"
|
|
title=" Fire delayed value changed event for aria-valuetext changes">
|
|
Mozilla Bug 478032
|
|
</a>
|
|
<a target="_blank"
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289"
|
|
title="We dont expose new aria role 'scrollbar' and property aria-orientation">
|
|
Mozilla Bug 529289
|
|
</a>
|
|
<a target="_blank"
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=703202"
|
|
title="ARIA comboboxes don't fire value change events">
|
|
Mozilla Bug 703202
|
|
</a>
|
|
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none"></div>
|
|
<pre id="test">
|
|
</pre>
|
|
<div id="eventdump"></div>
|
|
|
|
<!-- ARIA sliders -->
|
|
<div id="slider_vn" role="slider" aria-valuenow="5"
|
|
aria-valuemin="0" aria-valuemax="1000">slider</div>
|
|
|
|
<div id="slider_vt" role="slider" aria-valuetext="hi"
|
|
aria-valuemin="0" aria-valuemax="3">greeting slider</div>
|
|
|
|
<div id="slider_vnvt" role="slider" aria-valuenow="0" aria-valuetext="plain"
|
|
aria-valuemin="0" aria-valuemax="5">sweetness slider</div>
|
|
|
|
<!-- ARIA scrollbar -->
|
|
<div id="scrollbar" role="scrollbar" aria-valuenow="5"
|
|
aria-valuemin="0" aria-valuemax="1000">slider</div>
|
|
|
|
<!-- ARIA combobox -->
|
|
<input id="combobox" role="combobox" aria-autocomplete="inline">
|
|
</body>
|
|
</html>
|