2010-02-20 16:50:50 -08:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>Text accessible caret 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"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="common.js"></script>
|
2010-02-20 16:50:50 -08:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="events.js"></script>
|
2010-02-20 16:50:50 -08:00
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checkers.
|
|
|
|
*/
|
|
|
|
function caretMovedChecker(aID, aOffset)
|
|
|
|
{
|
|
|
|
this.__proto__ = new invokerChecker(EVENT_TEXT_CARET_MOVED, aID);
|
|
|
|
|
|
|
|
this.check = function caretMovedChecker_check(aEvent)
|
|
|
|
{
|
|
|
|
is(aEvent.QueryInterface(nsIAccessibleCaretMoveEvent).caretOffset,
|
|
|
|
aOffset,
|
|
|
|
"Wrong caret offset for " + prettyName(aEvent.target));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invokers.
|
|
|
|
*/
|
|
|
|
function setCaretOffsetInvoker(aID, aOffset)
|
|
|
|
{
|
|
|
|
this.target = getAccessible(aID, [nsIAccessibleText]);
|
|
|
|
|
|
|
|
this.invoke = function setCaretOffsetInvoker_invoke()
|
|
|
|
{
|
|
|
|
this.target.caretOffset = aOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function setCaretOffsetInvoker_getID()
|
|
|
|
{
|
|
|
|
"nsIAccessibleText::caretOffset test"
|
|
|
|
}
|
|
|
|
|
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_FOCUS, this.target),
|
|
|
|
new caretMovedChecker(this.target, aOffset)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Do tests.
|
|
|
|
*/
|
|
|
|
var gQueue = null;
|
|
|
|
|
|
|
|
// gA11yEventDumpID = "eventdump"; // debug stuff
|
|
|
|
|
|
|
|
function doTests()
|
|
|
|
{
|
|
|
|
// test caret move events and caret offsets
|
|
|
|
gQueue = new eventQueue();
|
|
|
|
|
|
|
|
gQueue.push(new setCaretOffsetInvoker("textbox", 1));
|
|
|
|
gQueue.push(new setCaretOffsetInvoker("link", 1));
|
|
|
|
|
|
|
|
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=524115"
|
|
|
|
title="HyperText accessible should get focus when the caret is positioned inside of it, text is changed or copied into clipboard by ATs">
|
|
|
|
Mozilla Bug 524115
|
|
|
|
</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none"></div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<input id="textbox" value="hello"/>
|
|
|
|
<a id="link" href="about:">about mozilla</a>
|
|
|
|
|
|
|
|
<div id="eventdump"></div>
|
|
|
|
</body>
|
|
|
|
</html>
|