2009-06-11 19:57:29 +00:00
|
|
|
<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>
|
2013-04-28 00:54:54 +00:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
2009-06-11 19:57:29 +00:00
|
|
|
|
|
|
|
<script type="application/javascript"
|
2010-09-01 22:09:56 +00:00
|
|
|
src="../common.js"></script>
|
2009-06-11 19:57:29 +00:00
|
|
|
<script type="application/javascript"
|
2010-09-01 22:09:56 +00:00
|
|
|
src="../events.js"></script>
|
2009-06-11 19:57:29 +00:00
|
|
|
|
|
|
|
<script type="application/javascript"
|
2010-09-01 22:09:56 +00:00
|
|
|
src="../value.js"></script>
|
2009-06-11 19:57:29 +00:00
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Do tests.
|
|
|
|
*/
|
|
|
|
var gQueue = null;
|
|
|
|
|
|
|
|
// Value change invoker
|
2012-10-16 03:05:20 +00:00
|
|
|
function changeARIAValue(aNodeOrID, aValuenow, aValuetext)
|
2009-06-11 19:57:29 +00:00
|
|
|
{
|
|
|
|
this.DOMNode = getNode(aNodeOrID);
|
|
|
|
|
2012-10-16 03:05:20 +00:00
|
|
|
this.invoke = function changeARIAValue_invoke() {
|
2009-06-11 19:57:29 +00:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
}
|
|
|
|
|
2012-10-16 03:05:20 +00:00
|
|
|
this.check = function changeARIAValue_check() {
|
2009-06-11 19:57:29 +00:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
2012-10-16 03:05:20 +00:00
|
|
|
this.getID = function changeARIAValue_getID() {
|
2009-06-11 19:57:29 +00:00
|
|
|
return prettyName(aNodeOrID) + " value changed";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-16 03:05:20 +00:00
|
|
|
function changeValue(aID, aValue)
|
2011-12-01 16:12:02 +00:00
|
|
|
{
|
|
|
|
this.DOMNode = getNode(aID);
|
|
|
|
|
2012-10-16 03:05:20 +00:00
|
|
|
this.invoke = function changeValue_invoke()
|
2011-12-01 16:12:02 +00:00
|
|
|
{
|
|
|
|
this.DOMNode.value = aValue;
|
|
|
|
}
|
|
|
|
|
2012-10-16 03:05:20 +00:00
|
|
|
this.check = function changeValue_check()
|
2011-12-01 16:12:02 +00:00
|
|
|
{
|
|
|
|
var acc = getAccessible(this.DOMNode);
|
|
|
|
is(acc.value, aValue, "Wrong value for " + prettyName(aID));
|
|
|
|
}
|
|
|
|
|
2012-10-16 03:05:20 +00:00
|
|
|
this.getID = function changeValue_getID()
|
2011-12-01 16:12:02 +00:00
|
|
|
{
|
|
|
|
return prettyName(aID) + " value changed";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-28 00:54:54 +00:00
|
|
|
function changeProgressValue(aID, aValue)
|
|
|
|
{
|
|
|
|
this.DOMNode = getNode(aID);
|
|
|
|
|
|
|
|
this.invoke = function changeProgressValue_invoke()
|
|
|
|
{
|
|
|
|
this.DOMNode.value = aValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.check = function changeProgressValue_check()
|
|
|
|
{
|
|
|
|
var acc = getAccessible(this.DOMNode);
|
|
|
|
is(acc.value, aValue+"%", "Wrong value for " + prettyName(aID));
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function changeProgressValue_getID()
|
|
|
|
{
|
|
|
|
return prettyName(aID) + " value changed";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function changeRangeValue(aID)
|
|
|
|
{
|
|
|
|
this.DOMNode = getNode(aID);
|
2012-10-16 03:05:20 +00:00
|
|
|
|
2013-04-28 00:54:54 +00:00
|
|
|
this.invoke = function changeRangeValue_invoke()
|
|
|
|
{
|
|
|
|
synthesizeMouse(getNode(aID), 5, 5, { });
|
|
|
|
}
|
2012-10-16 03:05:20 +00:00
|
|
|
|
2013-04-28 00:54:54 +00:00
|
|
|
this.finalCheck = function changeRangeValue_finalCheck()
|
|
|
|
{
|
|
|
|
var acc = getAccessible(this.DOMNode);
|
|
|
|
is(acc.value, "0", "Wrong value for " + prettyName(aID));
|
|
|
|
}
|
2012-10-16 03:05:20 +00:00
|
|
|
|
2013-04-28 00:54:54 +00:00
|
|
|
this.getID = function changeRangeValue_getID()
|
|
|
|
{
|
|
|
|
return prettyName(aID) + " range value changed";
|
|
|
|
}
|
2012-10-16 03:05:20 +00:00
|
|
|
}
|
|
|
|
|
2009-06-11 19:57:29 +00:00
|
|
|
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);
|
2009-12-15 16:03:39 +00:00
|
|
|
testValue("scrollbar", "5", 5, 0, 1000, 0);
|
2012-10-16 03:05:20 +00:00
|
|
|
testValue("progress", "22%", 22, 0, 100, 0);
|
2013-04-28 00:54:54 +00:00
|
|
|
testValue("range", "6", 6, 0, 10, 1);
|
2009-06-11 19:57:29 +00:00
|
|
|
|
|
|
|
// Test value change events
|
|
|
|
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_VALUE_CHANGE);
|
|
|
|
|
2012-10-16 03:05:20 +00:00
|
|
|
gQueue.push(new changeARIAValue("slider_vn", "6", undefined));
|
|
|
|
gQueue.push(new changeARIAValue("slider_vt", undefined, "hey!"));
|
|
|
|
gQueue.push(new changeARIAValue("slider_vnvt", "3", "sweet"));
|
|
|
|
gQueue.push(new changeARIAValue("scrollbar", "6", undefined));
|
|
|
|
|
|
|
|
gQueue.push(new changeValue("combobox", "hello"));
|
2009-06-11 19:57:29 +00:00
|
|
|
|
2013-04-28 00:54:54 +00:00
|
|
|
gQueue.push(new changeProgressValue("progress", "50"));
|
|
|
|
gQueue.push(new changeRangeValue("range"));
|
2011-12-01 16:12:02 +00:00
|
|
|
|
2009-06-11 19:57:29 +00:00
|
|
|
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>
|
2009-12-15 16:03:39 +00:00
|
|
|
<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>
|
2013-04-28 00:54:54 +00:00
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=559764"
|
|
|
|
title="Make HTML5 input@type=range element accessible">
|
|
|
|
Mozilla Bug 559764
|
|
|
|
</a>
|
2011-12-01 16:12:02 +00:00
|
|
|
<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>
|
2012-10-16 03:05:20 +00:00
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=761901"
|
|
|
|
title=" HTML5 progress accessible should fire value change event">
|
|
|
|
Mozilla Bug 761901
|
|
|
|
</a>
|
|
|
|
|
2009-06-11 19:57:29 +00:00
|
|
|
|
|
|
|
<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"
|
2009-12-15 16:03:39 +00:00
|
|
|
aria-valuemin="0" aria-valuemax="1000">slider</div>
|
2009-06-11 19:57:29 +00:00
|
|
|
|
|
|
|
<div id="slider_vt" role="slider" aria-valuetext="hi"
|
2009-12-15 16:03:39 +00:00
|
|
|
aria-valuemin="0" aria-valuemax="3">greeting slider</div>
|
2009-06-11 19:57:29 +00:00
|
|
|
|
|
|
|
<div id="slider_vnvt" role="slider" aria-valuenow="0" aria-valuetext="plain"
|
2009-12-15 16:03:39 +00:00
|
|
|
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>
|
2011-12-01 16:12:02 +00:00
|
|
|
|
|
|
|
<!-- ARIA combobox -->
|
|
|
|
<input id="combobox" role="combobox" aria-autocomplete="inline">
|
2012-10-16 03:05:20 +00:00
|
|
|
|
|
|
|
<!-- progress bar -->
|
|
|
|
<progress id="progress" value="22" max="100"></progress>
|
|
|
|
|
2013-04-28 00:54:54 +00:00
|
|
|
<!-- input@type="range" -->
|
|
|
|
<input type="range" id="range" min="0" max="10" value="6">
|
|
|
|
|
2009-06-11 19:57:29 +00:00
|
|
|
</body>
|
|
|
|
</html>
|