Bug 616082 - correct designMode tests, r=marcoz, a=test

This commit is contained in:
Alexander Surkov 2010-12-02 16:48:06 +08:00
Родитель 89ad93649f
Коммит 0bc60410cc
3 изменённых файлов: 127 добавлений и 32 удалений

Просмотреть файл

@ -14,8 +14,60 @@
src="../common.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript">
function designModeOn()
{
this.eventSeq = [
new invokerChecker(EVENT_REORDER, document)
];
this.invoke = function designModeOn_invoke()
{
document.designMode = "on";
}
this.finalCheck = function designModeOn_finalCheck()
{
testStates(document, 0, EXT_STATE_EDITABLE);
testStates("p", 0, EXT_STATE_EDITABLE);
testStates("document", 0, EXT_STATE_EDITABLE);
testStates("editable_document", 0, EXT_STATE_EDITABLE);
}
this.getID = function designModeOn_getID()
{
return "design mode on";
}
}
function designModeOff()
{
this.eventSeq = [
new invokerChecker(EVENT_REORDER, document)
];
this.invoke = function designModeOn_invoke()
{
document.designMode = "off";
}
this.finalCheck = function designModeOn_finalCheck()
{
testStates(document, STATE_READONLY);
testStates("document", STATE_READONLY);
testStates("editable_document", 0, EXT_STATE_EDITABLE);
}
this.getID = function designModeOn_getID()
{
return "design mode off";
}
}
var gQueue = null;
function doTest()
{
// Bug 566542: root accesible should expose active state when focused.
@ -36,20 +88,11 @@
testStates("document", STATE_READONLY);
testStates("editable_document", 0, EXT_STATE_EDITABLE);
document.designMode = "on";
testStates(document, 0, EXT_STATE_EDITABLE);
testStates("p", 0, EXT_STATE_EDITABLE);
testStates("document", 0, EXT_STATE_EDITABLE);
testStates("editable_document", 0, EXT_STATE_EDITABLE);
document.designMode = "off";
testStates(document, STATE_READONLY);
testStates("document", STATE_READONLY);
testStates("editable_document", 0, EXT_STATE_EDITABLE);
SimpleTest.finish();
// Design mode on/off trigger document accessible subtree recreation.
gQueue = new eventQueue();
gQueue.push(new designModeOn());
gQueue.push(new designModeOff());
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();

Просмотреть файл

@ -14,35 +14,77 @@
src="../common.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript">
function doTest()
function designModeOn()
{
var docAcc = getAccessible(document, [nsIAccessibleDocument]);
if (docAcc) {
testStates(docAcc, STATE_READONLY);
testStates("aria_article", STATE_READONLY);
testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
testStates("article", STATE_READONLY);
testStates("editable_article", 0, EXT_STATE_EDITABLE);
this.eventSeq = [
new invokerChecker(EVENT_REORDER, document)
];
this.invoke = function designModeOn_invoke()
{
document.designMode = "on";
}
testStates(docAcc, 0, EXT_STATE_EDITABLE);
this.finalCheck = function designModeOn_finalCheck()
{
testStates(document, 0, EXT_STATE_EDITABLE);
testStates("aria_article", 0, EXT_STATE_EDITABLE);
testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
testStates("article", 0, EXT_STATE_EDITABLE);
testStates("editable_article", 0, EXT_STATE_EDITABLE);
document.designMode = "off";
}
testStates(docAcc, STATE_READONLY);
this.getID = function designModeOn_getID()
{
return "design mode on";
}
}
function designModeOff()
{
this.eventSeq = [
new invokerChecker(EVENT_REORDER, document)
];
this.invoke = function designModeOn_invoke()
{
document.designMode = "off";
}
this.finalCheck = function designModeOn_finalCheck()
{
testStates(document, STATE_READONLY);
testStates("aria_article", STATE_READONLY);
testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
testStates("article", STATE_READONLY);
testStates("editable_article", 0, EXT_STATE_EDITABLE);
}
SimpleTest.finish();
this.getID = function designModeOn_getID()
{
return "design mode off";
}
}
var gQueue = null;
function doTest()
{
testStates(document, STATE_READONLY);
testStates("aria_article", STATE_READONLY);
testStates("editable_aria_article", 0, EXT_STATE_EDITABLE);
testStates("article", STATE_READONLY);
testStates("editable_article", 0, EXT_STATE_EDITABLE);
// Design mode on/off trigger document accessible subtree recreation.
gQueue = new eventQueue();
gQueue.push(new designModeOn());
gQueue.push(new designModeOff());
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();

Просмотреть файл

@ -5,16 +5,20 @@ 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" />
<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="editabletext.js"></script>
<script type="application/javascript"
src="events.js"></script>
<script type="application/javascript">
var gParagraphAcc;
@ -60,16 +64,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
// et.cutNPasteText(7, 8, 8, "hehelloo");
}
function testDocEditableNFinishTest(aDoc)
{
testEditable(aDoc);
SimpleTest.finish();
}
function doTest()
{
testEditable("input");
// testEditable("div"); XXX: bug 452599
var frame = document.getElementById("frame");
// Design mode on/off trigger document accessible subtree recreation.
var frame = getNode("frame");
waitForEvent(EVENT_REORDER, frame.contentDocument,
testDocEditableNFinishTest, null, frame.contentDocument);
frame.contentDocument.designMode = "on";
testEditable(frame.contentDocument);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();