summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/selection/drag-disabled-textarea-shadow-dom.html
blob: 9270cfc5c6beaf428970ae5dec20bbc8e5ddb0c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<meta charset="utf-8">
<!-- Conceptually this is just a crashtest, but we need testharness.js so that testdriver works as expected, see https://github.com/web-platform-tests/wpt/issues/31739 -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<link rel=help href="https://bugzilla.mozilla.org/show_bug.cgi?id=1739079">
<span id="outer"></span>
<script>
  const t = async_test("Shouldn't crash when dragging disabled textarea in shadow dom");
  const outer = document.getElementById("outer");
  outer.attachShadow({ mode: "open" }).innerHTML = `
    <span id="inner" style="pointer-events: none">
      <textarea disabled></textarea>
    </span>
  `;
  const inner = outer.shadowRoot.getElementById("inner");
  inner.attachShadow({ mode: "open" }).innerHTML = `
    <div style="display: flex">
      <slot></slot>
    </div>
  `;
  const textarea = outer.shadowRoot.querySelector("textarea");
  window.addEventListener("load", t.step_func(function() {
    const rect = textarea.getBoundingClientRect();
    new test_driver.Actions()
        .pointerMove(rect.left + 5, rect.top + 5)
        .pointerDown()
        .pointerMove(rect.left, + 50, rect.top + 50)
        .pointerMove(0, 0)
        .pointerUp()
        .send()
        .then(t.step_func_done(function() {
          assert_true(true, "Didn't crash nor hang");
        }));
  }));
</script>