accessible/tests/mochitest/text/test_gettext.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4   <title>Get text between offsets tests</title>
     5   <link rel="stylesheet" type="text/css"
     6         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     8   <script type="application/javascript"
     9           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    10   <script type="application/javascript"
    11           src="../common.js"></script>
    12   <script type="application/javascript"
    13           src="../text.js"></script>
    15   <script type="application/javascript">
    16     function doTest()
    17     {
    18       //////////////////////////////////////////////////////////////////////////
    19       //
    20       // __h__e__l__l__o__ __m__y__ __f__r__i__e__n__d__
    21       //  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
    23       var IDs = [ "i1", "d1", "e1", "t1" ];
    25       testCharacterCount(IDs, 15);
    27       testText(IDs, 0, 1, "h");
    28       testText(IDs, 1, 3, "el");
    29       testText(IDs, 14, 15, "d");
    30       testText(IDs, 0, 15, "hello my friend");
    31       testText(IDs, 0, -1, "hello my friend");
    33       //////////////////////////////////////////////////////////////////////////
    34       //
    35       // __B__r__a__v__e__ __S__i__r__ __ __R__o__b__i__n__ __ __ __r__a__n
    36       //  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21
    38       IDs = [ "i2", "dpre2", "epre2", "t2" ];
    40       testCharacterCount(IDs, 22);
    42       testText(IDs, 0, 1, "B");
    43       testText(IDs, 5, 6, " ");
    44       testText(IDs, 9, 11, "  ");
    45       testText(IDs, 16, 19, "   ");
    46       testText(IDs, 0, 22, "Brave Sir  Robin   ran");
    47       testText(IDs, 0, -1, "Brave Sir  Robin   ran");
    49       testCharacterCount(["d2", "e2"], 19);
    50       testText(["d2", "e2"], 0, 19, "Brave Sir Robin ran");
    52       //////////////////////////////////////////////////////////////////////////
    53       //
    54       // __o__n__e__w__o__r__d__\n
    55       //  0  1  2  3  4  5  6  7
    56       // __\n
    57       //  8
    58       // __t__w__o__ __w__o__r__d__s__\n
    59       //  9 10 11 12 13 14 15 16 17 18
    61       var IDs = ["d3", "dbr3", "e3", "ebr3", "t3"];
    63       testCharacterCount(IDs, 19);
    65       testText(IDs, 0, 19, "oneword\n\ntwo words\n");
    66       testText(IDs, 0, -1, "oneword\n\ntwo words\n");
    68       SimpleTest.finish();
    69     }
    71     SimpleTest.waitForExplicitFinish();
    72     addA11yLoadEvent(doTest);
    73   </script>
    74 </head>
    75 <body>
    77   <p id="display"></p>
    78   <div id="content" style="display: none"></div>
    79   <pre id="test">
    80   </pre>
    82   <input id="i1" value="hello my friend"/>
    83   <div id="d1">hello my friend</div>
    84   <div id="e1" contenteditable="true">hello my friend</div>
    85   <textarea id="t1">hello my friend</textarea>
    87   <input id="i2" value="Brave Sir  Robin   ran"/>
    88   <pre><div id="dpre2">Brave Sir  Robin   ran</div></pre>
    89   <pre><div id="epre2" contenteditable="true">Brave Sir  Robin   ran</div></pre>
    90   <textarea id="t2" cols="300">Brave Sir  Robin   ran</textarea>
    91   <div id="d2">Brave Sir  Robin   ran</div>
    92   <div id="e2" contenteditable="true">Brave Sir  Robin   ran</div>
    94   <pre>
    95   <div id="d3">oneword
    97 two words
    98 </div>
    99   <div id="dbr3">oneword<br/><br/>two words<br/><br/></div>
   100   <div id="e3" contenteditable="true">oneword
   102 two words
   103 </div>
   104   <div id="ebr3" contenteditable="true">oneword<br/><br/>two words<br/><br/></div>
   105   <textarea id="t3" cols="300">oneword
   107 two words
   108 </textarea>
   109   </pre>
   111 </body>
   112 </html>

mercurial