gecko/accessible/tests/mochitest/test_text_caret.html
Alexander Surkov 8a46b1e0a7 Bug 524115 - HyperText accessible should get focus when the caret is positioned inside of it, text is changed or copied into clipboard by ATs, r=marcoz, davidb
--HG--
rename : accessible/tests/mochitest/nsIAccessibleEditableText.js => accessible/tests/mochitest/editabletext.js
rename : accessible/tests/mochitest/test_nsIAccessibleEditableText.html => accessible/tests/mochitest/test_editabletext_1.html
2010-02-20 16:50:50 -08:00

100 lines
2.6 KiB
HTML

<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"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/events.js"></script>
<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>