tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_shadowdom_ime.html (1603B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1553852
      5 -->
      6 <head>
      7  <title>Test for Bug 1429982</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <script src="/tests/SimpleTest/EventUtils.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11 </head>
     12 <body>
     13 <a target="_blank"
     14  href="https://bugzilla.mozilla.org/show_bug.cgi?id=1553852">Mozilla Bug 1553852</a>
     15 <p id="display"></p>
     16 <div id="content">
     17  <div id="host"></div>
     18 </div>
     19 <pre id="test">
     20 <script class="testbody" type="text/javascript">
     21 
     22 /** Test for Bug 1553852 */
     23 SimpleTest.waitForExplicitFinish()
     24 SimpleTest.waitForFocus(function() {
     25  let div = document.createElement('div');
     26  div.setAttribute('contenteditable', 'true');
     27 
     28  let shadow = document.getElementById('host').attachShadow({mode: 'open'});
     29  shadow.appendChild(div);
     30  div.focus();
     31 
     32  let testString = '\uD842\uDFB7\u91CE\u5BB6';
     33  synthesizeCompositionChange(
     34    { "composition":
     35      { "string": testString,
     36        "clauses":
     37        [
     38          { "length": testString.length, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
     39        ],
     40      },
     41      "caret": { "start": testString.length, "length": 0 },
     42    });
     43  is(div.innerText, testString,
     44     "The value of contenteditable div should be " + testString +
     45     " during composition");
     46 
     47  synthesizeComposition({ type: "compositioncommitasis" });
     48    is(div.innerText, testString,
     49       "The value of contenteditable div should be " + testString +
     50       " after compositionend");
     51 
     52  SimpleTest.finish();
     53 });
     54 
     55 </script>
     56 </pre>
     57 </body>
     58 </html>