gecko/accessible/tests/mochitest/editabletext/test_1.html

116 lines
3.5 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=452161
-->
<head>
<title>nsIAccessibleEditableText chrome tests</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="../common.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript"
src="editabletext.js"></script>
<script type="application/javascript">
function addTestEditable(aID, aTestRun, aTrailChar)
{
var et = new editableTextTest(aID);
//////////////////////////////////////////////////////////////////////////
// setTextContents
et.setTextContents("hello");
et.setTextContents("olleh", aTrailChar); // due to some reason this reports '\n' in the end
et.setTextContents("");
//////////////////////////////////////////////////////////////////////////
// insertText
et.insertText("hello", 0, "hello");
et.insertText("ma ", 0, "ma hello");
et.insertText("ma", 2, "mama hello");
et.insertText(" hello", 10, "mama hello hello");
// XXX: bug 452584
//////////////////////////////////////////////////////////////////////////
// deleteText
// et.deleteText(0, 5, "hello hello");
// et.deleteText(5, 6, "hellohello");
// et.deleteText(5, 10, "hello");
// et.deleteText(0, 5, "");
//////////////////////////////////////////////////////////////////////////
// copyNPasteText
// et.copyNPasteText(0, 0, 0, "");
// et.insertText("hello", 0, "hello");
// et.copyNPasteText(0, 1, 0, "hhello");
// et.copyNPasteText(5, 6, 6, "hhelloo");
// et.copyNPasteText(3, 4, 1, "hehelloo");
//////////////////////////////////////////////////////////////////////////
// // cutNPasteText
// et.cutNPasteText(0, 1, 1, "ehhelloo");
// et.cutNPasteText(1, 2, 0, "hehelloo");
// et.cutNPasteText(7, 8, 8, "hehelloo");
aTestRun.add(et);
}
//gA11yEventDumpToConsole = true; // debug stuff
function runTest()
{
var testRun = new editableTextTestRun();
addTestEditable("input", testRun);
addTestEditable("div", testRun, '\n');
addTestEditable(getNode("frame").contentDocument, testRun, '\n');
testRun.run(); // Will call SimpleTest.finish();
}
function doTest()
{
// Prepare tested elements.
// Design mode on/off trigger document accessible subtree recreation.
var frame = getNode("frame");
waitForEvent(EVENT_REORDER, frame.contentDocument, runTest);
frame.contentDocument.designMode = "on";
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="nsIAccessibleEditableText chrome tests"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=452161">Mozilla Bug 452161</a>
<a target="_blank"
title="Cache rendered text on a11y side"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=626660">
Mozilla Bug 626660
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<input id="input"/>
<div id="div" contentEditable="true"></div>
<iframe id="frame"/>
</body>
</html>