mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 20:47:44 +00:00
108 lines
3.3 KiB
HTML
108 lines
3.3 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<title>Accessible caret move 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="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
src="../common.js"></script>
|
|
<script type="application/javascript"
|
|
src="../events.js"></script>
|
|
|
|
<script type="application/javascript">
|
|
/**
|
|
* Click checker.
|
|
*/
|
|
function clickChecker(aCaretOffset, aID, aExtraNodeOrID, aExtraCaretOffset)
|
|
{
|
|
this.__proto__ = new caretMoveChecker(aCaretOffset, aID);
|
|
|
|
this.extraNode = getNode(aExtraNodeOrID);
|
|
|
|
this.check = function clickChecker_check(aEvent)
|
|
{
|
|
this.__proto__.check(aEvent);
|
|
|
|
if (this.extraNode) {
|
|
var acc = getAccessible(this.extraNode, [nsIAccessibleText]);
|
|
is(acc.caretOffset, aExtraCaretOffset,
|
|
"Wrong caret offset for " + aExtraNodeOrID);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Do tests.
|
|
*/
|
|
var gQueue = null;
|
|
|
|
// gA11yEventDumpID = "eventdump"; // debug stuff
|
|
//gA11yEventDumpToConsole = true;
|
|
|
|
function doTests()
|
|
{
|
|
// test caret move events and caret offsets
|
|
gQueue = new eventQueue();
|
|
|
|
var id = "textbox";
|
|
gQueue.push(new synthFocus(id, new caretMoveChecker(5, id)));
|
|
gQueue.push(new synthSelectAll(id, new caretMoveChecker(5, id)));
|
|
gQueue.push(new synthClick(id, new caretMoveChecker(0, id)));
|
|
gQueue.push(new synthRightKey(id, new caretMoveChecker(1, id)));
|
|
|
|
id = "textarea";
|
|
gQueue.push(new synthClick(id, new caretMoveChecker(0, id)));
|
|
gQueue.push(new synthRightKey(id, new caretMoveChecker(1, id)));
|
|
gQueue.push(new synthDownKey(id, new caretMoveChecker(12, id)));
|
|
|
|
id = "p";
|
|
gQueue.push(new synthClick(id, new caretMoveChecker(0, id)));
|
|
gQueue.push(new synthRightKey(id, new caretMoveChecker(1, id)));
|
|
gQueue.push(new synthDownKey(id, new caretMoveChecker(6, id)));
|
|
|
|
id = "p1_in_div";
|
|
gQueue.push(new synthClick(id, new clickChecker(0, id, "p2_in_div", -1)));
|
|
|
|
id = "p";
|
|
gQueue.push(new synthShiftTab(id, new caretMoveChecker(0, id)));
|
|
id = "textarea";
|
|
gQueue.push(new synthShiftTab(id, new caretMoveChecker(12, id)));
|
|
id = "p";
|
|
gQueue.push(new synthTab(id, new caretMoveChecker(0, id)));
|
|
|
|
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=454377"
|
|
title="Accessible caret move events testing">
|
|
Mozilla Bug 454377
|
|
</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none"></div>
|
|
<pre id="test">
|
|
</pre>
|
|
|
|
<input id="textbox" value="hello"/>
|
|
<textarea id="textarea">text<br>text</textarea>
|
|
<p id="p" contentEditable="true"><span>text</span><br/>text</p>
|
|
<div id="div" contentEditable="true"><p id="p1_in_div">text</p><p id="p2_in_div">text</p></div>
|
|
|
|
<div id="eventdump"></div>
|
|
</body>
|
|
</html>
|