tor-browser

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

snapevent-constructor.html (1445B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <link rel=help href="https://drafts.csswg.org/css-scroll-snap-2/#snapevent-interface">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 </head>
      9 <body>
     10  <script>
     11    test(function() {
     12      assert_throws_js(TypeError, function() {
     13        new SnapEvent();
     14      }, 'First argument (type) is required, so was expecting a TypeError.');
     15    }, 'Missing type argument');
     16 
     17    test(function() {
     18      let event = new SnapEvent("");
     19      assert_true(event instanceof window.SnapEvent);
     20    }, "the event is an instance of SnapEvent");
     21 
     22    test(function() {
     23      let event = new SnapEvent("customsnapevent");
     24      assert_equals(event.type, "customsnapevent",
     25        "event constructor type is honored");
     26      assert_equals(event.snapTargetBlock, null, "null snapTrgetBlock");
     27      assert_equals(event.snapTargetInline, null, "null snapTargetInline");
     28    }, "default init dict");
     29 
     30    test(function() {
     31      const div_element = document.createElement("div");
     32      let event = new SnapEvent("scrollsnapchange", {
     33        snapTargetBlock: document,
     34        snapTargetInline: div_element
     35      });
     36      assert_equals(event.type, "scrollsnapchange");
     37      assert_equals(event.snapTargetBlock, document);
     38      assert_equals(event.snapTargetInline, div_element);
     39    }, "event constructor type is honored");
     40  </script>
     41 </body>
     42 </html>