accessible/tests/mochitest/editabletext/test_1.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE html>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=452161
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>nsIAccessibleEditableText chrome tests</title>
michael@0 8 <link rel="stylesheet" type="text/css"
michael@0 9 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
michael@0 10
michael@0 11 <script type="application/javascript"
michael@0 12 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 13
michael@0 14 <script type="application/javascript"
michael@0 15 src="../common.js"></script>
michael@0 16 <script type="application/javascript"
michael@0 17 src="../events.js"></script>
michael@0 18 <script type="application/javascript"
michael@0 19 src="editabletext.js"></script>
michael@0 20
michael@0 21 <script type="application/javascript">
michael@0 22
michael@0 23 function addTestEditable(aID, aTestRun)
michael@0 24 {
michael@0 25 var et = new editableTextTest(aID);
michael@0 26
michael@0 27 //////////////////////////////////////////////////////////////////////////
michael@0 28 // setTextContents
michael@0 29 et.scheduleTest(et.setTextContents, "hello");
michael@0 30 et.scheduleTest(et.setTextContents, "olleh");
michael@0 31 et.scheduleTest(et.setTextContents, "");
michael@0 32
michael@0 33 //////////////////////////////////////////////////////////////////////////
michael@0 34 // insertText
michael@0 35 et.scheduleTest(et.insertText, "hello", 0, "hello");
michael@0 36 et.scheduleTest(et.insertText, "ma ", 0, "ma hello");
michael@0 37 et.scheduleTest(et.insertText, "ma", 2, "mama hello");
michael@0 38 et.scheduleTest(et.insertText, " hello", 10, "mama hello hello");
michael@0 39
michael@0 40 // XXX: bug 452584
michael@0 41
michael@0 42 //////////////////////////////////////////////////////////////////////////
michael@0 43 // deleteText
michael@0 44 // et.deleteText(0, 5, "hello hello");
michael@0 45 // et.deleteText(5, 6, "hellohello");
michael@0 46 // et.deleteText(5, 10, "hello");
michael@0 47 // et.deleteText(0, 5, "");
michael@0 48
michael@0 49 //////////////////////////////////////////////////////////////////////////
michael@0 50 // copyNPasteText
michael@0 51 // et.copyNPasteText(0, 0, 0, "");
michael@0 52 // et.insertText("hello", 0, "hello");
michael@0 53 // et.copyNPasteText(0, 1, 0, "hhello");
michael@0 54 // et.copyNPasteText(5, 6, 6, "hhelloo");
michael@0 55 // et.copyNPasteText(3, 4, 1, "hehelloo");
michael@0 56
michael@0 57 //////////////////////////////////////////////////////////////////////////
michael@0 58 // // cutNPasteText
michael@0 59 // et.cutNPasteText(0, 1, 1, "ehhelloo");
michael@0 60 // et.cutNPasteText(1, 2, 0, "hehelloo");
michael@0 61 // et.cutNPasteText(7, 8, 8, "hehelloo");
michael@0 62
michael@0 63 aTestRun.add(et);
michael@0 64 }
michael@0 65
michael@0 66 //gA11yEventDumpToConsole = true; // debug stuff
michael@0 67
michael@0 68 function runTest()
michael@0 69 {
michael@0 70 var testRun = new editableTextTestRun();
michael@0 71
michael@0 72 addTestEditable("input", testRun);
michael@0 73 addTestEditable("div", testRun);
michael@0 74 addTestEditable(getNode("frame").contentDocument, testRun, '\n');
michael@0 75
michael@0 76 testRun.run(); // Will call SimpleTest.finish();
michael@0 77 }
michael@0 78
michael@0 79 function doTest()
michael@0 80 {
michael@0 81 // Prepare tested elements.
michael@0 82
michael@0 83 // Design mode on/off triggers an editable state change event on
michael@0 84 // the document accessible.
michael@0 85 var frame = getNode("frame");
michael@0 86 waitForEvent(EVENT_STATE_CHANGE, frame.contentDocument, runTest);
michael@0 87 frame.contentDocument.designMode = "on";
michael@0 88 }
michael@0 89
michael@0 90 SimpleTest.waitForExplicitFinish();
michael@0 91 addA11yLoadEvent(doTest);
michael@0 92 </script>
michael@0 93 </head>
michael@0 94 <body>
michael@0 95
michael@0 96 <a target="_blank"
michael@0 97 title="nsIAccessibleEditableText chrome tests"
michael@0 98 href="https://bugzilla.mozilla.org/show_bug.cgi?id=452161">Mozilla Bug 452161</a>
michael@0 99 <a target="_blank"
michael@0 100 title="Cache rendered text on a11y side"
michael@0 101 href="https://bugzilla.mozilla.org/show_bug.cgi?id=626660">
michael@0 102 Mozilla Bug 626660
michael@0 103 </a>
michael@0 104 <p id="display"></p>
michael@0 105 <div id="content" style="display: none"></div>
michael@0 106 <pre id="test">
michael@0 107 </pre>
michael@0 108
michael@0 109 <input id="input"/>
michael@0 110
michael@0 111 <div id="div" contentEditable="true"></div>
michael@0 112
michael@0 113 <iframe id="frame"/>
michael@0 114 </body>
michael@0 115 </html>

mercurial