<script type="application/javascript">
/**
* Do tests.
*/ var gQueue = null;
// Value change invoker
function changeARIAValue(aNodeOrID, aValuenow, aValuetext) {
this.DOMNode = getNode(aNodeOrID);
this.eventSeq = [ new invokerChecker(aValuetext ?
EVENT_TEXT_VALUE_CHANGE :
EVENT_VALUE_CHANGE, this.DOMNode),
];
this.invoke = function changeARIAValue_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 changeARIAValue_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 changeARIAValue_getID() {
return prettyName(aNodeOrID) + " value changed";
};
}
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";
};
}
this.finalCheck = function changeRangeValue_finalCheck() { var acc = getAccessible(this.DOMNode);
is(acc.value, "0", "Wrong value for " + prettyName(aID));
};
this.getID = function changeRangeValue_getID() {
return prettyName(aID) + " range value changed";
};
}
function changeRangeValueWithA11yAPI(aID) {
this.DOMNode = getNode(aID);
let inputChecker = new invokerChecker("input", this.DOMNode);
inputChecker.eventTarget = "element";
let changeChecker = new invokerChecker("change", this.DOMNode);
changeChecker.eventTarget = "element";
this.eventSeq = [
inputChecker,
changeChecker,
new invokerChecker(EVENT_VALUE_CHANGE, this.DOMNode),
];
this.invoke = function changeRangeValue_invoke() {
this.DOMNode.focus();
let acc = getAccessible(this.DOMNode, [nsIAccessibleValue]);
acc.currentValue = 0;
this.DOMNode.blur();
};
this.finalCheck = function changeRangeValue_finalCheck() { var acc = getAccessible(this.DOMNode);
is(acc.value, "0", "Wrong value for " + prettyName(aID));
};
this.getID = function changeRangeValue_getID() {
return prettyName(aID) + " range value changed";
};
}
function changeSelectValue(aID, aKey, aValue) {
this.eventSeq =
[ new invokerChecker(EVENT_TEXT_VALUE_CHANGE, getAccessible(aID)) ];
this.invoke = function changeSelectValue_invoke() {
getAccessible(aID).takeFocus();
synthesizeKey(aKey, {}, window);
};
this.finalCheck = function changeSelectValue_finalCheck() {
is(getAccessible(aID).value, aValue, "Wrong value for " + prettyName(aID));
};
this.getID = function changeSelectValue_getID() {
return `${prettyName(aID)} closed select value change on '${aKey}'' key press`;
};
}
// enableLogging("DOMEvents");
// gA11yEventDumpToConsole = true;
function doTests() {
// Test that elements which should not expose values do not
let separatorVal = getAccessible("separator", [nsIAccessibleValue], null, DONOTFAIL_IF_NO_INTERFACE);
ok(!separatorVal, "value interface is not exposed for separator");
let separatorAcc = getAccessible("separator");
ok(!separatorAcc.value, "Value text is not exposed for separator");
// Test value change events
gQueue = new eventQueue();
<!-- ARIA separator which is focusable (i.e. a splitter) -->
<div id="splitter" role="separator" tabindex="0" aria-valuenow="5"
aria-valuemin="0" aria-valuemax="1000">splitter</div>
<!-- ARIA separator which is not focusable and should not expose values -->
<div id="separator" role="separator" aria-valuenow="5"
aria-valuemin="0" aria-valuemax="1000">splitter</div>
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.