summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-ui/user-select-001.html
blob: 35febc38bb0bebd0d1ada8c63a6ff4e27a8727f3 (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
40
41
42
<!DOCTYPE html>
<html>
  <meta charset="utf-8">
  <title>CSS Basic User Interface Test: Block children of a inline parent with "user-select:text" should be selectable even with a user-select: none ancestor</title>
  <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
  <link rel="author" title="Mozilla" href="https://www.mozilla.org/">
  <link rel="help" href="https://drafts.csswg.org/css-ui/#propdef-user-select">
  <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1743074">

  <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>

  <style>
  :root {
    user-select: none;
  }
  </style>

  <span style="user-select: text">
    <div>Let's select this <b id="target">word</b></div>
  </span>

  <script>
  promise_test(async function() {
    let target = document.getElementById("target");
    let actions = new test_driver.Actions();

    // Simulate a double click to select a word.
    await actions.pointerMove(5, 5, {origin: target})
                 .pointerDown()
                 .pointerUp()
                 .pointerDown()
                 .pointerUp()
                 .send();
    assert_equals(window.getSelection().toString(), "word",
                  "The text 'word' should be selectable.")
  }, "Select the text 'word'");
  </script>
</html>