mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
128 lines
3.4 KiB
HTML
128 lines
3.4 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<title>Accessible state change event testing</title>
|
|
|
|
<link rel="stylesheet" type="text/css"
|
|
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
<script type="application/javascript"
|
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
<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="../states.js"></script>
|
|
|
|
<script type="application/javascript">
|
|
////////////////////////////////////////////////////////////////////////////
|
|
// Invokers
|
|
|
|
function makeEditableDoc(aDocNode, aIsEnabled)
|
|
{
|
|
this.DOMNode = aDocNode;
|
|
|
|
this.invoke = function editabledoc_invoke() {
|
|
// Note: this should fire an EVENT_STATE_CHANGE
|
|
this.DOMNode.designMode = 'on';
|
|
};
|
|
|
|
this.check = function editabledoc_check(aEvent) {
|
|
|
|
testStates(aDocNode, 0, EXT_STATE_EDITABLE);
|
|
|
|
var event = null;
|
|
try {
|
|
var event = aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
|
|
} catch (e) {
|
|
ok(false, "State change event was expected");
|
|
}
|
|
|
|
if (!event) { return; }
|
|
|
|
ok(event.isExtraState(), "Extra state change was expected");
|
|
is(event.state, EXT_STATE_EDITABLE, "Wrong state of statechange event");
|
|
ok(event.isEnabled(), "Expected editable state to be enabled");
|
|
}
|
|
|
|
this.getID = function editabledoc_getID() {
|
|
return prettyName(aDocNode) + " editable state changed";
|
|
};
|
|
}
|
|
|
|
function invalidInput(aNodeOrID)
|
|
{
|
|
this.DOMNode = getNode(aNodeOrID);
|
|
|
|
this.invoke = function invalidInput_invoke() {
|
|
// Note: this should fire an EVENT_STATE_CHANGE
|
|
this.DOMNode.value = "I am not an email";
|
|
};
|
|
|
|
this.check = function invalidInput_check() {
|
|
testStates(aNodeOrID, STATE_INVALID);
|
|
};
|
|
|
|
this.getID = function invalidInput_getID() {
|
|
return prettyName(aNodeOrID) + " became invalid";
|
|
};
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
// Do tests
|
|
|
|
var gQueue = null;
|
|
|
|
// var gA11yEventDumpID = "eventdump"; // debug stuff
|
|
|
|
function doTests()
|
|
{
|
|
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_STATE_CHANGE);
|
|
|
|
// Test delayed editable state change
|
|
var doc = document.getElementById("iframe").contentDocument;
|
|
gQueue.push(new makeEditableDoc(doc));
|
|
|
|
// invalid state change
|
|
gQueue.push(new invalidInput("email"));
|
|
|
|
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=564471"
|
|
title="Make state change events async">
|
|
Mozilla Bug 564471
|
|
</a><br>
|
|
<a target="_blank"
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=555728"
|
|
title="Fire a11y event based on HTML5 constraint validation">
|
|
Mozilla Bug 555728
|
|
</a>
|
|
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none"></div>
|
|
<pre id="test">
|
|
</pre>
|
|
|
|
<div id="testContainer">
|
|
<iframe id="iframe"></iframe>
|
|
</div>
|
|
|
|
<input id="email" type='email'>
|
|
|
|
<div id="eventdump"></div>
|
|
</body>
|
|
</html>
|