File: snap-events-with-pseudo-target.tentative.html

package info (click to toggle)
thunderbird 1%3A144.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,725,312 kB
  • sloc: cpp: 7,869,225; javascript: 5,974,276; ansic: 3,946,747; python: 1,421,062; xml: 654,642; asm: 474,045; java: 183,117; sh: 110,973; makefile: 20,398; perl: 14,362; objc: 13,086; yacc: 4,583; pascal: 3,448; lex: 1,720; ruby: 999; exp: 762; sql: 731; awk: 580; php: 436; lisp: 430; sed: 69; csh: 10
file content (86 lines) | stat: -rw-r--r-- 2,820 bytes parent folder | download | duplicates (15)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title> CSS Scroll Snap 2 Test: Snap Events with pseudo-element targets.</title>
    <link rel="help" href="https://drafts.csswg.org/css-scroll-snap-2/#snap-events">
    <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>
    <script src="/css/css-scroll-snap/snap-events/resources/common.js"></script>
    <script src="/css/css-scroll-snap/snap-events/resources/user-scroll-common.js"></script>
    <script src="/dom/events/scrolling/scroll_support.js"></script>
  </head>
  <body>
    <style>
      .scroller {
        overflow: scroll;
        width: 200px;
        height: 200px;
        border: solid 1px black;
        scroll-snap-type: y mandatory;
        position: absolute;
        resize: both;
      }
      .space {
        height: 300vh;
        width: 300vw;
        position: absolute;
      }
      .scroller::before, .scroller::after {
        scroll-snap-align: start;
        height: 50px;
        width: 50px;
        color: white;
        display: block;
      }
      .scroller::before {
        content: "before";
        background-color: blue;
      }
      .scroller::after {
        content: "after";
        background-color: orange;
        margin-top: 100px;
      }
    </style>
    <div class="scroller" id="scroller">
      <div class="space"></div>
    </div>

    <script>
      const start_pos = {
        x: scroller.clientWidth / 2,
        y: scroller.clientHeight / 2,
      };
      const end_pos = { x: scroller.clientWidth / 2, y: 0 };
      // The top of the ::after pseudo element is the sum of the
      // ::before pseudo-element's height (50) and the ::after
      // pseudo-element's margin-top (100).
      const after_pseudo_element_top = 50 + 100;
      const test_data = {
        scroller: scroller,
        scrolling_function: async () => {
          await snap_event_touch_scroll_helper(start_pos, end_pos);
        },
        expected_snap_targets: { block: scroller, inline: null },
        expected_scroll_offsets: {
          x: 0,
          y: after_pseudo_element_top,
        }
      };

      promise_test(async (t) => {
        await test_scrollsnapchange(t, test_data);
      }, "snapTarget for scrollsnapchange is the owning element when a snap area " +
         "belongs to a pseudo-element");

      promise_test(async (t) => {
        await test_snap_event(t, test_data, "scrollsnapchanging");
      }, "snapTarget for scrollsnapchanging is the owning element when a snap area " +
         "belongs to a pseudo-element");
    </script>
  </body>
</html>