Bug 617273 - make editable text tests async, r=marcoz, fer, a=test
[mozilla-central.git] / accessible / tests / mochitest / editabletext / test_1.html
blobc8fa4af248043d1b783d6ee1a6d3bb8b409330e1
1 <!DOCTYPE html>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=452161
5 -->
6 <head>
7 <title>nsIAccessibleEditableText chrome tests</title>
8 <link rel="stylesheet" type="text/css"
9 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
11 <script type="application/javascript"
12 src="chrome://mochikit/content/MochiKit/packed.js"></script>
13 <script type="application/javascript"
14 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
16 <script type="application/javascript"
17 src="../common.js"></script>
18 <script type="application/javascript"
19 src="../events.js"></script>
20 <script type="application/javascript"
21 src="editabletext.js"></script>
23 <script type="application/javascript">
24 function addTestEditable(aID, aTestRun)
26 var et = new editableTextTest(aID);
28 //////////////////////////////////////////////////////////////////////////
29 // insertText
30 et.insertText("hello", 0, "hello");
31 et.insertText("ma ", 0, "ma hello");
32 et.insertText("ma", 2, "mama hello");
33 et.insertText(" hello", 10, "mama hello hello");
35 // XXX: bug 452584
37 //////////////////////////////////////////////////////////////////////////
38 // setTextContents
39 // et.setTextContents("hello", "hello");
40 // et.setTextContents("olleh", "olleh");
41 // et.setTextContents("", "");
43 //////////////////////////////////////////////////////////////////////////
44 // deleteText
45 // et.deleteText(0, 5, "hello hello");
46 // et.deleteText(5, 6, "hellohello");
47 // et.deleteText(5, 10, "hello");
48 // et.deleteText(0, 5, "");
50 //////////////////////////////////////////////////////////////////////////
51 // copyNPasteText
52 // et.copyNPasteText(0, 0, 0, "");
53 // et.insertText("hello", 0, "hello");
54 // et.copyNPasteText(0, 1, 0, "hhello");
55 // et.copyNPasteText(5, 6, 6, "hhelloo");
56 // et.copyNPasteText(3, 4, 1, "hehelloo");
58 //////////////////////////////////////////////////////////////////////////
59 // // cutNPasteText
60 // et.cutNPasteText(0, 1, 1, "ehhelloo");
61 // et.cutNPasteText(1, 2, 0, "hehelloo");
62 // et.cutNPasteText(7, 8, 8, "hehelloo");
64 aTestRun.add(et);
67 function runTest()
69 var testRun = new editableTextTestRun();
71 addTestEditable("input", testRun);
72 // addTestEditable("div"); XXX: bug 452599
73 addTestEditable(getNode("frame").contentDocument, testRun);
75 testRun.run(); // Will call SimpleTest.finish();
78 function doTest()
80 // Prepare tested elements.
82 // Design mode on/off trigger document accessible subtree recreation.
83 var frame = getNode("frame");
84 waitForEvent(EVENT_REORDER, frame.contentDocument, runTest);
85 frame.contentDocument.designMode = "on";
88 SimpleTest.waitForExplicitFinish();
89 addA11yLoadEvent(doTest);
90 </script>
91 </head>
92 <body>
94 <a target="_blank"
95 title="nsIAccessibleEditableText chrome tests"
96 href="https://bugzilla.mozilla.org/show_bug.cgi?id=452161">Mozilla Bug 452161</a>
97 <p id="display"></p>
98 <div id="content" style="display: none"></div>
99 <pre id="test">
100 </pre>
102 <input id="input"/>
104 <div id="div" contentEditable="true"/>
106 <iframe id="frame"/>
107 </body>
108 </html>