tor-browser

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

test_copypaste_flat_tree.html (2442B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 This test is copied from test_copypaste.html, and the main purpose of it is
      5 to test copy pasting works when the selected contents have slotted nodes involved.
      6 -->
      7 <head>
      8  <title>Test for copy/paste</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <script src="/tests/SimpleTest/EventUtils.js"></script>
     11  <script type="text/javascript" src="copypaste_flat_tree.js"></script>
     12  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     13 </head>
     14 <body>
     15 <p id="display"></p>
     16 <div id="content" style="display: none">
     17 </div>
     18 <pre id="test">
     19 <script class="testbody" type="text/javascript">
     20 
     21 SimpleTest.waitForExplicitFinish();
     22 
     23 SimpleTest.registerCleanupFunction(function() {
     24  // SpecialPowers would reset the pref after the
     25  // test is done, and this might to lead some
     26  // inconsistent behaviours if we keep the selection
     27  // there.
     28  window.getSelection().removeAllRanges();
     29 });
     30 
     31 addLoadEvent(() => {
     32  add_task(async function test_copyhtml() {
     33    await SpecialPowers.pushPrefEnv({
     34      set: [["dom.shadowdom.selection_across_boundary.enabled", true]],
     35    });
     36    await testCopyPasteShadowDOM();
     37  });
     38 });
     39 
     40 </script>
     41 </pre>
     42 <div>
     43  <textarea id="input" cols="40" rows="10"></textarea>
     44 
     45  <!--test 1 - 3-->
     46  <span id="start1">Start</span>
     47  <div id="host1">
     48    <template shadowrootmode="open">
     49      <slot></slot>
     50      <span id="inner1">Inner</span>
     51    </template>
     52    <span id="end1">End</span>
     53  </div>
     54 
     55  <!--test 4 - 7 -->
     56  <span id="start2">Start</span>
     57  <div id="host2">
     58    <template shadowrootmode="open">
     59      <slot name="slot1"></slot>
     60      <span id="inner2">Inner</span>
     61      <slot name="slot2"></slot>
     62    </template>
     63    <span id="host2_slot1" slot="slot1">Slotted1</span>
     64    <span id="host2_slot2" slot="slot1">Slotted2</span>
     65 
     66    <span slot="slot2">Slotted3</span>
     67    <span id="host2_slot4" slot="slot2">Slotted4</span>
     68  </div>
     69 
     70  <!-- test 8 -->
     71  <div id="host3">
     72    <template shadowrootmode="open">
     73      <slot name="slot1"></slot>
     74      <slot name="slot2"></slot>
     75      <span id="inner2">Inner</span>
     76      <slot name="slot3"></slot>
     77      <slot name="slot4"></slot>
     78    </template>
     79    <span id="host3_slot2" slot="slot2">Slotted2</span>
     80    <span id="host3_slot1" slot="slot1">Slotted1</span>
     81 
     82    <span id="host3_slot4" slot="slot4">Slotted4</span>
     83    <span id="host3_slot3" slot="slot3">Slotted3</span>
     84  </div>
     85 </div>
     86 </body>
     87 </html>