2009-01-14 15:19:35 +03:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>Accessible mutation events testing</title>
|
|
|
|
|
|
|
|
<link rel="stylesheet" type="text/css"
|
|
|
|
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
|
|
|
|
<style>
|
|
|
|
div.displayNone a { display:none; }
|
|
|
|
div.visibilityHidden a { visibility:hidden; }
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
2010-09-02 02:09:56 +04:00
|
|
|
src="../common.js"></script>
|
2009-01-25 07:42:21 +03:00
|
|
|
<script type="application/javascript"
|
2010-09-02 02:09:56 +04:00
|
|
|
src="../events.js"></script>
|
2009-01-14 15:19:35 +03:00
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
/**
|
|
|
|
* Invokers.
|
|
|
|
*/
|
|
|
|
var kNoEvents = 0;
|
|
|
|
|
|
|
|
var kShowEvent = 1;
|
|
|
|
var kHideEvent = 2;
|
|
|
|
var kReorderEvent = 4;
|
|
|
|
var kShowEvents = kShowEvent | kReorderEvent;
|
|
|
|
var kHideEvents = kHideEvent | kReorderEvent;
|
|
|
|
var kHideAndShowEvents = kHideEvents | kShowEvent;
|
|
|
|
|
2009-02-05 09:23:18 +03:00
|
|
|
/**
|
|
|
|
* Base class to test mutation a11y events.
|
|
|
|
*
|
|
|
|
* @param aNodeOrID [in] node invoker's action is executed for
|
|
|
|
* @param aEventTypes [in] events to register (see constants above)
|
|
|
|
* @param aDoNotExpectEvents [in] boolean indicates if events are expected
|
|
|
|
*/
|
2009-09-09 13:03:14 +04:00
|
|
|
function mutateA11yTree(aNodeOrID, aEventTypes, aDoNotExpectEvents)
|
2009-01-14 15:19:35 +03:00
|
|
|
{
|
2009-02-05 09:23:18 +03:00
|
|
|
// Interface
|
2009-01-14 15:19:35 +03:00
|
|
|
this.DOMNode = getNode(aNodeOrID);
|
2009-02-05 09:23:18 +03:00
|
|
|
this.doNotExpectEvents = aDoNotExpectEvents;
|
2009-01-14 15:19:35 +03:00
|
|
|
this.eventSeq = [];
|
2009-09-03 06:01:18 +04:00
|
|
|
this.unexpectedEventSeq = [];
|
2009-01-14 15:19:35 +03:00
|
|
|
|
2009-05-27 09:31:23 +04:00
|
|
|
/**
|
|
|
|
* Change default target (aNodeOrID) registered for the given event type.
|
|
|
|
*/
|
2009-02-05 09:23:18 +03:00
|
|
|
this.setTarget = function mutateA11yTree_setTarget(aEventType, aTarget)
|
|
|
|
{
|
|
|
|
var type = this.getA11yEventType(aEventType);
|
2009-09-03 06:01:18 +04:00
|
|
|
for (var idx = 0; idx < this.getEventSeq().length; idx++) {
|
|
|
|
if (this.getEventSeq()[idx].type == type) {
|
|
|
|
this.getEventSeq()[idx].target = aTarget;
|
2009-05-27 09:31:23 +04:00
|
|
|
return idx;
|
2009-02-05 09:23:18 +03:00
|
|
|
}
|
|
|
|
}
|
2009-05-27 09:31:23 +04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Replace the default target currently registered for a given event type
|
|
|
|
* with the nodes in the targets array.
|
|
|
|
*/
|
|
|
|
this.setTargets = function mutateA11yTree_setTargets(aEventType, aTargets) {
|
|
|
|
var targetIdx = this.setTarget(aEventType, aTargets[0]);
|
|
|
|
|
|
|
|
var type = this.getA11yEventType(aEventType);
|
2009-07-28 06:28:06 +04:00
|
|
|
for (var i = 1; i < aTargets.length; i++) {
|
|
|
|
var checker = new invokerChecker(type, aTargets[i]);
|
2009-09-03 06:01:18 +04:00
|
|
|
this.getEventSeq().splice(++targetIdx, 0, checker);
|
2009-07-28 06:28:06 +04:00
|
|
|
}
|
2009-02-05 09:23:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Implementation
|
|
|
|
this.getA11yEventType = function mutateA11yTree_getA11yEventType(aEventType)
|
|
|
|
{
|
|
|
|
if (aEventType == kReorderEvent)
|
|
|
|
return nsIAccessibleEvent.EVENT_REORDER;
|
|
|
|
|
2009-09-09 13:03:14 +04:00
|
|
|
if (aEventType == kHideEvent)
|
|
|
|
return nsIAccessibleEvent.EVENT_HIDE;
|
2009-02-05 09:23:18 +03:00
|
|
|
|
2009-09-09 13:03:14 +04:00
|
|
|
if (aEventType == kShowEvent)
|
|
|
|
return nsIAccessibleEvent.EVENT_SHOW;
|
2009-01-14 15:19:35 +03:00
|
|
|
}
|
|
|
|
|
2009-09-03 06:01:18 +04:00
|
|
|
this.getEventSeq = function mutateA11yTree_getEventSeq()
|
|
|
|
{
|
|
|
|
return this.doNotExpectEvents ? this.unexpectedEventSeq : this.eventSeq;
|
|
|
|
}
|
|
|
|
|
2009-07-28 06:28:06 +04:00
|
|
|
if (aEventTypes & kHideEvent) {
|
|
|
|
var checker = new invokerChecker(this.getA11yEventType(kHideEvent),
|
|
|
|
this.DOMNode);
|
2009-09-03 06:01:18 +04:00
|
|
|
this.getEventSeq().push(checker);
|
2009-07-28 06:28:06 +04:00
|
|
|
}
|
2009-02-05 09:23:18 +03:00
|
|
|
|
2009-07-28 06:28:06 +04:00
|
|
|
if (aEventTypes & kShowEvent) {
|
|
|
|
var checker = new invokerChecker(this.getA11yEventType(kShowEvent),
|
|
|
|
this.DOMNode);
|
2009-09-03 06:01:18 +04:00
|
|
|
this.getEventSeq().push(checker);
|
2009-07-28 06:28:06 +04:00
|
|
|
}
|
2009-02-05 09:23:18 +03:00
|
|
|
|
2009-07-28 06:28:06 +04:00
|
|
|
if (aEventTypes & kReorderEvent) {
|
|
|
|
var checker = new invokerChecker(this.getA11yEventType(kReorderEvent),
|
|
|
|
this.DOMNode.parentNode);
|
2009-09-03 06:01:18 +04:00
|
|
|
this.getEventSeq().push(checker);
|
2009-07-28 06:28:06 +04:00
|
|
|
}
|
2009-01-14 15:19:35 +03:00
|
|
|
}
|
|
|
|
|
2009-02-05 09:23:18 +03:00
|
|
|
/**
|
|
|
|
* Change CSS style for the given node.
|
|
|
|
*/
|
2009-01-14 15:19:35 +03:00
|
|
|
function changeStyle(aNodeOrID, aProp, aValue, aEventTypes)
|
|
|
|
{
|
2009-09-09 13:03:14 +04:00
|
|
|
this.__proto__ = new mutateA11yTree(aNodeOrID, aEventTypes, false);
|
2009-01-14 15:19:35 +03:00
|
|
|
|
|
|
|
this.invoke = function changeStyle_invoke()
|
|
|
|
{
|
|
|
|
this.DOMNode.style[aProp] = aValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function changeStyle_getID()
|
|
|
|
{
|
|
|
|
return aNodeOrID + " change style " + aProp + " on value " + aValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-05 09:23:18 +03:00
|
|
|
/**
|
|
|
|
* Change class name for the given node.
|
|
|
|
*/
|
2009-01-14 15:19:35 +03:00
|
|
|
function changeClass(aParentNodeOrID, aNodeOrID, aClassName, aEventTypes)
|
|
|
|
{
|
2009-09-09 13:03:14 +04:00
|
|
|
this.__proto__ = new mutateA11yTree(aNodeOrID, aEventTypes, false);
|
2009-01-14 15:19:35 +03:00
|
|
|
|
|
|
|
this.invoke = function changeClass_invoke()
|
|
|
|
{
|
|
|
|
this.parentDOMNode.className = aClassName;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function changeClass_getID()
|
|
|
|
{
|
|
|
|
return aNodeOrID + " change class " + aClassName;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.parentDOMNode = getNode(aParentNodeOrID);
|
|
|
|
}
|
|
|
|
|
2009-02-05 09:23:18 +03:00
|
|
|
/**
|
|
|
|
* Clone the node and append it to its parent.
|
|
|
|
*/
|
|
|
|
function cloneAndAppendToDOM(aNodeOrID, aEventTypes,
|
2009-05-27 09:31:23 +04:00
|
|
|
aTargetsFunc, aReorderTargetFunc)
|
2009-01-14 15:19:35 +03:00
|
|
|
{
|
|
|
|
var eventTypes = aEventTypes || kShowEvents;
|
|
|
|
var doNotExpectEvents = (aEventTypes == kNoEvents);
|
|
|
|
|
|
|
|
this.__proto__ = new mutateA11yTree(aNodeOrID, eventTypes,
|
2009-09-09 13:03:14 +04:00
|
|
|
doNotExpectEvents);
|
2009-01-14 15:19:35 +03:00
|
|
|
|
|
|
|
this.invoke = function cloneAndAppendToDOM_invoke()
|
|
|
|
{
|
|
|
|
var newElm = this.DOMNode.cloneNode(true);
|
|
|
|
newElm.removeAttribute('id');
|
2009-02-05 09:23:18 +03:00
|
|
|
|
2009-05-27 09:31:23 +04:00
|
|
|
var targets = aTargetsFunc ?
|
|
|
|
aTargetsFunc.call(null, newElm) : [newElm];
|
|
|
|
this.setTargets(kShowEvent, targets);
|
2009-02-05 09:23:18 +03:00
|
|
|
|
2009-05-27 09:31:23 +04:00
|
|
|
if (aReorderTargetFunc) {
|
|
|
|
var reorderTarget = aReorderTargetFunc.call(null, this.DOMNode);
|
2009-02-05 09:23:18 +03:00
|
|
|
this.setTarget(kReorderEvent, reorderTarget);
|
|
|
|
}
|
|
|
|
|
2009-01-14 15:19:35 +03:00
|
|
|
this.DOMNode.parentNode.appendChild(newElm);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function cloneAndAppendToDOM_getID()
|
|
|
|
{
|
|
|
|
return aNodeOrID + " clone and append to DOM.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-05 09:23:18 +03:00
|
|
|
/**
|
|
|
|
* Removes the node from DOM.
|
|
|
|
*/
|
|
|
|
function removeFromDOM(aNodeOrID, aEventTypes,
|
2009-05-27 09:31:23 +04:00
|
|
|
aTargetsFunc, aReorderTargetFunc)
|
2009-01-14 15:19:35 +03:00
|
|
|
{
|
|
|
|
var eventTypes = aEventTypes || kHideEvents;
|
|
|
|
var doNotExpectEvents = (aEventTypes == kNoEvents);
|
|
|
|
|
|
|
|
this.__proto__ = new mutateA11yTree(aNodeOrID, eventTypes,
|
2009-09-09 13:03:14 +04:00
|
|
|
doNotExpectEvents);
|
2009-01-14 15:19:35 +03:00
|
|
|
|
|
|
|
this.invoke = function removeFromDOM_invoke()
|
|
|
|
{
|
|
|
|
this.DOMNode.parentNode.removeChild(this.DOMNode);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function removeFromDOM_getID()
|
|
|
|
{
|
2009-06-11 23:57:29 +04:00
|
|
|
return prettyName(aNodeOrID) + " remove from DOM.";
|
2009-01-14 15:19:35 +03:00
|
|
|
}
|
2009-02-05 09:23:18 +03:00
|
|
|
|
2009-05-27 09:31:23 +04:00
|
|
|
if (aTargetsFunc && (eventTypes & kHideEvent))
|
|
|
|
this.setTargets(kHideEvent, aTargetsFunc.call(null, this.DOMNode));
|
2009-02-05 09:23:18 +03:00
|
|
|
|
|
|
|
if (aReorderTargetFunc && (eventTypes & kReorderEvent))
|
|
|
|
this.setTarget(kReorderEvent,
|
|
|
|
aReorderTargetFunc.call(null, this.DOMNode));
|
2009-01-14 15:19:35 +03:00
|
|
|
}
|
|
|
|
|
2009-02-05 09:23:18 +03:00
|
|
|
/**
|
|
|
|
* Clone the node and replace the original node by cloned one.
|
|
|
|
*/
|
2009-01-14 15:19:35 +03:00
|
|
|
function cloneAndReplaceInDOM(aNodeOrID)
|
|
|
|
{
|
|
|
|
this.__proto__ = new mutateA11yTree(aNodeOrID, kHideAndShowEvents,
|
2009-09-09 13:03:14 +04:00
|
|
|
false);
|
2009-01-14 15:19:35 +03:00
|
|
|
|
|
|
|
this.invoke = function cloneAndReplaceInDOM_invoke()
|
|
|
|
{
|
2010-10-21 08:16:10 +04:00
|
|
|
this.DOMNode.parentNode.replaceChild(this.newElm, this.DOMNode);
|
2009-01-14 15:19:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function cloneAndReplaceInDOM_getID()
|
|
|
|
{
|
|
|
|
return aNodeOrID + " clone and replace in DOM.";
|
|
|
|
}
|
2010-10-21 08:16:10 +04:00
|
|
|
|
|
|
|
this.newElm = this.DOMNode.cloneNode(true);
|
|
|
|
this.newElm.removeAttribute('id');
|
|
|
|
this.setTarget(kShowEvent, this.newElm);
|
2009-01-14 15:19:35 +03:00
|
|
|
}
|
|
|
|
|
2011-01-18 11:03:38 +03:00
|
|
|
/**
|
2012-11-13 10:29:22 +04:00
|
|
|
* Trigger content insertion (flush layout), removal and insertion of
|
|
|
|
* the same element for the same parent.
|
2011-01-18 11:03:38 +03:00
|
|
|
*/
|
|
|
|
function test1(aContainerID)
|
|
|
|
{
|
|
|
|
this.divNode = document.createElement("div");
|
|
|
|
this.divNode.setAttribute("id", "div-test1");
|
|
|
|
this.containerNode = getNode(aContainerID);
|
|
|
|
|
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_SHOW, this.divNode),
|
|
|
|
new invokerChecker(EVENT_REORDER, this.containerNode)
|
|
|
|
];
|
|
|
|
|
|
|
|
this.invoke = function test1_invoke()
|
|
|
|
{
|
|
|
|
this.containerNode.appendChild(this.divNode);
|
|
|
|
getComputedStyle(this.divNode, "").color;
|
|
|
|
this.containerNode.removeChild(this.divNode);
|
|
|
|
this.containerNode.appendChild(this.divNode);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function test1_getID()
|
|
|
|
{
|
2012-11-13 10:29:22 +04:00
|
|
|
return "fuzzy test #1: content insertion (flush layout), removal and" +
|
|
|
|
"reinsertion";
|
2011-01-18 11:03:38 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-11-13 10:29:22 +04:00
|
|
|
* Trigger content insertion (flush layout), removal and insertion of
|
|
|
|
* the same element for the different parents.
|
2011-01-18 11:03:38 +03:00
|
|
|
*/
|
|
|
|
function test2(aContainerID, aTmpContainerID)
|
|
|
|
{
|
|
|
|
this.divNode = document.createElement("div");
|
|
|
|
this.divNode.setAttribute("id", "div-test2");
|
|
|
|
this.containerNode = getNode(aContainerID);
|
|
|
|
this.tmpContainerNode = getNode(aTmpContainerID);
|
|
|
|
this.container = getAccessible(this.containerNode);
|
|
|
|
this.tmpContainer = getAccessible(this.tmpContainerNode);
|
|
|
|
|
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_SHOW, this.divNode),
|
|
|
|
new invokerChecker(EVENT_REORDER, this.containerNode)
|
|
|
|
];
|
|
|
|
|
|
|
|
this.unexpectedEventSeq = [
|
|
|
|
new invokerChecker(EVENT_REORDER, this.tmpContainerNode)
|
|
|
|
];
|
|
|
|
|
|
|
|
this.invoke = function test2_invoke()
|
|
|
|
{
|
|
|
|
this.tmpContainerNode.appendChild(this.divNode);
|
|
|
|
getComputedStyle(this.divNode, "").color;
|
|
|
|
this.tmpContainerNode.removeChild(this.divNode);
|
|
|
|
this.containerNode.appendChild(this.divNode);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function test2_getID()
|
|
|
|
{
|
2012-11-13 10:29:22 +04:00
|
|
|
return "fuzzy test #2: content insertion (flush layout), removal and" +
|
|
|
|
"reinsertion under another container";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Content insertion (flush layout) and then removal (nothing was changed).
|
|
|
|
*/
|
|
|
|
function test3(aContainerID)
|
|
|
|
{
|
|
|
|
this.divNode = document.createElement("div");
|
|
|
|
this.divNode.setAttribute("id", "div-test3");
|
|
|
|
this.containerNode = getNode(aContainerID);
|
|
|
|
|
|
|
|
this.unexpectedEventSeq = [
|
|
|
|
new invokerChecker(EVENT_SHOW, this.divNode),
|
|
|
|
new invokerChecker(EVENT_HIDE, this.divNode),
|
|
|
|
new invokerChecker(EVENT_REORDER, this.containerNode)
|
|
|
|
];
|
|
|
|
|
|
|
|
this.invoke = function test3_invoke()
|
|
|
|
{
|
|
|
|
this.containerNode.appendChild(this.divNode);
|
|
|
|
getComputedStyle(this.divNode, "").color;
|
|
|
|
this.containerNode.removeChild(this.divNode);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function test3_getID()
|
|
|
|
{
|
|
|
|
return "fuzzy test #3: content insertion (flush layout) and removal";
|
2011-01-18 11:03:38 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-30 23:43:49 +03:00
|
|
|
function insertReferredElm(aContainerID)
|
|
|
|
{
|
|
|
|
this.containerNode = getNode(aContainerID);
|
|
|
|
|
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_SHOW, function(aNode) { return aNode.lastChild; }, this.containerNode),
|
|
|
|
new invokerChecker(EVENT_SHOW, function(aNode) { return aNode.firstChild; }, this.containerNode),
|
|
|
|
new invokerChecker(EVENT_REORDER, this.containerNode)
|
|
|
|
];
|
|
|
|
|
|
|
|
this.invoke = function insertReferredElm_invoke()
|
|
|
|
{
|
|
|
|
this.containerNode.innerHTML =
|
|
|
|
"<span id='insertReferredElms_span'></span><input aria-labelledby='insertReferredElms_span'>";
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function insertReferredElm_getID()
|
|
|
|
{
|
|
|
|
return "insert inaccessible element and then insert referring element to make it accessible";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-27 09:31:23 +04:00
|
|
|
/**
|
|
|
|
* Target getters.
|
|
|
|
*/
|
|
|
|
function getFirstChild(aNode)
|
|
|
|
{
|
|
|
|
return [aNode.firstChild];
|
|
|
|
}
|
2014-12-30 23:43:49 +03:00
|
|
|
function getLastChild(aNode)
|
|
|
|
{
|
|
|
|
return [aNode.lastChild];
|
|
|
|
}
|
2009-05-27 09:31:23 +04:00
|
|
|
|
|
|
|
function getNEnsureFirstChild(aNode)
|
|
|
|
{
|
|
|
|
var node = aNode.firstChild;
|
|
|
|
getAccessible(node);
|
|
|
|
return [node];
|
|
|
|
}
|
|
|
|
|
|
|
|
function getNEnsureChildren(aNode)
|
|
|
|
{
|
|
|
|
var children = [];
|
|
|
|
var node = aNode.firstChild;
|
|
|
|
do {
|
|
|
|
children.push(node);
|
|
|
|
getAccessible(node);
|
|
|
|
node = node.nextSibling;
|
|
|
|
} while (node);
|
|
|
|
|
|
|
|
return children;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getParent(aNode)
|
|
|
|
{
|
|
|
|
return aNode.parentNode;
|
|
|
|
}
|
2009-02-05 09:23:18 +03:00
|
|
|
|
2009-01-14 15:19:35 +03:00
|
|
|
/**
|
|
|
|
* Do tests.
|
|
|
|
*/
|
|
|
|
var gQueue = null;
|
2012-11-13 10:29:22 +04:00
|
|
|
//gA11yEventDumpToConsole = true; // debug stuff
|
2009-01-14 15:19:35 +03:00
|
|
|
|
|
|
|
function doTests()
|
|
|
|
{
|
|
|
|
gQueue = new eventQueue();
|
|
|
|
|
|
|
|
// Show/hide events by changing of display style of accessible DOM node
|
|
|
|
// from 'inline' to 'none', 'none' to 'inline'.
|
|
|
|
var id = "link1";
|
|
|
|
getAccessible(id); // ensure accessible is created
|
|
|
|
gQueue.push(new changeStyle(id, "display", "none", kHideEvents));
|
2009-02-05 09:23:18 +03:00
|
|
|
gQueue.push(new changeStyle(id, "display", "inline", kShowEvents));
|
2009-01-14 15:19:35 +03:00
|
|
|
|
2010-11-13 20:49:26 +03:00
|
|
|
// Show/hide events by changing of visibility style of accessible DOM node
|
|
|
|
// from 'visible' to 'hidden', 'hidden' to 'visible'.
|
|
|
|
var id = "link2";
|
|
|
|
getAccessible(id);
|
|
|
|
gQueue.push(new changeStyle(id, "visibility", "hidden", kHideEvents));
|
|
|
|
gQueue.push(new changeStyle(id, "visibility", "visible", kShowEvents));
|
|
|
|
|
2009-01-14 15:19:35 +03:00
|
|
|
// Show/hide events by changing of display style of accessible DOM node
|
|
|
|
// from 'inline' to 'block', 'block' to 'inline'.
|
|
|
|
var id = "link3";
|
|
|
|
getAccessible(id); // ensure accessible is created
|
|
|
|
gQueue.push(new changeStyle(id, "display", "block", kHideAndShowEvents));
|
|
|
|
gQueue.push(new changeStyle(id, "display", "inline", kHideAndShowEvents));
|
|
|
|
|
2010-11-13 20:49:26 +03:00
|
|
|
// Show/hide events by changing of visibility style of accessible DOM node
|
|
|
|
// from 'collapse' to 'visible', 'visible' to 'collapse'.
|
|
|
|
var id = "link4";
|
|
|
|
gQueue.push(new changeStyle(id, "visibility", "visible", kShowEvents));
|
|
|
|
gQueue.push(new changeStyle(id, "visibility", "collapse", kHideEvents));
|
|
|
|
|
2009-01-14 15:19:35 +03:00
|
|
|
// Show/hide events by adding new accessible DOM node and removing old one.
|
|
|
|
var id = "link5";
|
2009-02-05 09:23:18 +03:00
|
|
|
gQueue.push(new cloneAndAppendToDOM(id));
|
2009-01-14 15:19:35 +03:00
|
|
|
gQueue.push(new removeFromDOM(id));
|
|
|
|
|
|
|
|
// No show/hide events by adding new not accessible DOM node and removing
|
|
|
|
// old one, no reorder event for their parent.
|
|
|
|
var id = "child1";
|
|
|
|
gQueue.push(new cloneAndAppendToDOM(id, kNoEvents));
|
|
|
|
gQueue.push(new removeFromDOM(id, kNoEvents));
|
|
|
|
|
|
|
|
// Show/hide events by adding new accessible DOM node and removing
|
|
|
|
// old one, there is reorder event for their parent.
|
|
|
|
var id = "child2";
|
2009-02-05 09:23:18 +03:00
|
|
|
gQueue.push(new cloneAndAppendToDOM(id));
|
2009-01-14 15:19:35 +03:00
|
|
|
gQueue.push(new removeFromDOM(id));
|
|
|
|
|
2009-02-05 09:23:18 +03:00
|
|
|
// Show/hide events by adding new DOM node containing accessible DOM and
|
|
|
|
// removing old one, there is reorder event for their parent.
|
|
|
|
var id = "child3";
|
|
|
|
gQueue.push(new cloneAndAppendToDOM(id, kShowEvents, getFirstChild,
|
|
|
|
getParent));
|
|
|
|
|
2009-05-27 09:31:23 +04:00
|
|
|
// Hide event for accessible child of unaccessible removed DOM node and
|
|
|
|
// reorder event for its parent.
|
|
|
|
gQueue.push(new removeFromDOM(id, kHideEvents,
|
|
|
|
getNEnsureFirstChild, getParent));
|
|
|
|
|
|
|
|
// Hide events for accessible children of unaccessible removed DOM node
|
|
|
|
// and reorder event for its parent.
|
|
|
|
gQueue.push(new removeFromDOM("child4", kHideEvents,
|
|
|
|
getNEnsureChildren, getParent));
|
2009-02-05 09:23:18 +03:00
|
|
|
|
2009-01-14 15:19:35 +03:00
|
|
|
// Show/hide events by creating new accessible DOM node and replacing
|
|
|
|
// old one.
|
2010-10-21 08:16:10 +04:00
|
|
|
getAccessible("link6"); // ensure accessible is created
|
|
|
|
gQueue.push(new cloneAndReplaceInDOM("link6"));
|
2009-01-14 15:19:35 +03:00
|
|
|
|
|
|
|
// Show/hide events by changing class name on the parent node.
|
2009-02-05 09:23:18 +03:00
|
|
|
gQueue.push(new changeClass("container2", "link7", "", kShowEvents));
|
2009-01-14 15:19:35 +03:00
|
|
|
gQueue.push(new changeClass("container2", "link7", "displayNone",
|
|
|
|
kHideEvents));
|
|
|
|
|
2010-11-13 20:49:26 +03:00
|
|
|
gQueue.push(new changeClass("container3", "link8", "", kShowEvents));
|
|
|
|
gQueue.push(new changeClass("container3", "link8", "visibilityHidden",
|
|
|
|
kHideEvents));
|
|
|
|
|
2011-01-18 11:03:38 +03:00
|
|
|
gQueue.push(new test1("testContainer"));
|
|
|
|
gQueue.push(new test2("testContainer", "testContainer2"));
|
|
|
|
gQueue.push(new test2("testContainer", "testNestedContainer"));
|
2012-11-13 10:29:22 +04:00
|
|
|
gQueue.push(new test3("testContainer"));
|
2014-12-30 23:43:49 +03:00
|
|
|
gQueue.push(new insertReferredElm("testContainer3"));
|
2011-01-18 11:03:38 +03:00
|
|
|
|
2009-01-14 15:19:35 +03: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=469985"
|
|
|
|
title=" turn the test from bug 354745 into mochitest">
|
2011-01-18 11:03:38 +03:00
|
|
|
Mozilla Bug 469985</a>
|
2009-01-14 15:19:35 +03:00
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=472662"
|
|
|
|
title="no reorder event when html:link display property is changed from 'none' to 'inline'">
|
2011-01-18 11:03:38 +03:00
|
|
|
Mozilla Bug 472662</a>
|
2010-10-21 08:16:10 +04:00
|
|
|
<a target="_blank"
|
|
|
|
title="Rework accessible tree update code"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=570275">
|
2011-01-18 11:03:38 +03:00
|
|
|
Mozilla Bug 570275</a>
|
2010-11-13 20:49:26 +03:00
|
|
|
<a target="_blank"
|
|
|
|
title="Develop a way to handle visibility style"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=606125">
|
2011-01-18 11:03:38 +03:00
|
|
|
Mozilla Bug 606125</a>
|
|
|
|
<a target="_blank"
|
|
|
|
title="Update accessible tree on content insertion after layout"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=498015">
|
|
|
|
Mozilla Bug 498015</a>
|
2009-01-14 15:19:35 +03:00
|
|
|
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none"></div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
2009-02-05 09:23:18 +03:00
|
|
|
<div id="eventdump"></div>
|
|
|
|
|
|
|
|
<div id="testContainer">
|
|
|
|
<a id="link1" href="http://www.google.com">Link #1</a>
|
|
|
|
<a id="link2" href="http://www.google.com">Link #2</a>
|
|
|
|
<a id="link3" href="http://www.google.com">Link #3</a>
|
|
|
|
<a id="link4" href="http://www.google.com" style="visibility:collapse">Link #4</a>
|
|
|
|
<a id="link5" href="http://www.google.com">Link #5</a>
|
|
|
|
|
|
|
|
<div id="container" role="list">
|
|
|
|
<span id="child1"></span>
|
|
|
|
<span id="child2" role="listitem"></span>
|
|
|
|
<span id="child3"><span role="listitem"></span></span>
|
2010-12-16 00:22:51 +03:00
|
|
|
<span id="child4"><span id="child4_1" role="listitem"></span><span id="child4_2" role="listitem"></span></span>
|
2009-02-05 09:23:18 +03:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<a id="link6" href="http://www.google.com">Link #6</a>
|
|
|
|
|
|
|
|
<div id="container2" class="displayNone"><a id="link7">Link #7</a></div>
|
|
|
|
<div id="container3" class="visibilityHidden"><a id="link8">Link #8</a></div>
|
2011-01-18 11:03:38 +03:00
|
|
|
<div id="testNestedContainer"></div>
|
2009-02-05 09:23:18 +03:00
|
|
|
</div>
|
2011-01-18 11:03:38 +03:00
|
|
|
<div id="testContainer2"></div>
|
2014-12-30 23:43:49 +03:00
|
|
|
<div id="testContainer3"></div>
|
2009-01-14 15:19:35 +03:00
|
|
|
</body>
|
|
|
|
</html>
|