tor-browser

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

create-event.https.html (1538B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script>
      5 'use strict';
      6 
      7 test(test => {
      8  const event = document.createEvent('DeviceMotionEvent');
      9  const newEvent = new CustomEvent("devicemotion", {
     10      bubbles: false, cancelable: false,
     11      acceleration: {x:1.5,y:2.5,z:3.5},
     12      accelerationIncludingGravity: {x:4.5,y:5.5,z:6.5},
     13      rotationRate: {alpha:7.5,beta:8.5,gamma:9.5},
     14      interval: 0.5
     15  });
     16 
     17  assert_equals(typeof event, 'object');
     18  assert_equals(Object.getPrototypeOf(event), DeviceMotionEvent.prototype);
     19 
     20  assert_true('type' in event);
     21  assert_true('bubbles' in event);
     22  assert_true('cancelable' in event);
     23  assert_true('acceleration' in event);
     24  assert_true('accelerationIncludingGravity' in event);
     25  assert_true('rotationRate' in event);
     26  assert_true('interval' in event);
     27 
     28  assert_equals(typeof newEvent.type, 'string');
     29  assert_equals(newEvent.type, "devicemotion");
     30  assert_equals(typeof newEvent.bubbles, 'boolean');
     31  assert_false(event.bubbles);
     32  assert_false(newEvent.bubbles);
     33  assert_equals(typeof newEvent.cancelable, 'boolean');
     34  assert_false(event.cancelable);
     35  assert_false(newEvent.cancelable);
     36  assert_equals(typeof event.acceleration, 'object');
     37  assert_equals(typeof event.accelerationIncludingGravity, 'object');
     38  assert_equals(typeof event.rotationRate, 'object');
     39  assert_equals(typeof event.interval, 'number');
     40 }, 'Tests that document.createEvent() works with DeviceMotionEvent.');
     41 </script>