Bug 1539614 [wpt PR 16077] - HTML: move textarea tests together, a=testonly
[gecko.git] / testing / web-platform / tests / pointerlock / constructor.html
blob8c43cf6dafcf9ac9e9a9203e266472f7eecd47e5
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>Pointer Lock event constructor</title>
6 <script src="/resources/testharness.js"></script>
7 <script src="/resources/testharnessreport.js"></script>
8 <link rel="help" href="http://www.w3.org/TR/pointerlock/#pointerlockchange-and-pointerlockerror-events">
9 <link rel="help" href="http://www.w3.org/TR/dom/#interface-event">
10 </head>
11 <body>
12 <p>Create Pointer Lock events and check each default value.</p>
13 <div id='log'></div>
14 <script>
15 test(function() {
16 var ev = new MouseEvent("pointerlockchange");
17 assert_equals(ev.type, "pointerlockchange");
18 assert_equals(ev.target, null);
19 assert_equals(ev.currentTarget, null);
20 assert_equals(ev.bubbles, false);
21 assert_equals(ev.eventPhase, Event.NONE);
22 assert_equals(ev.cancelable, false);
23 assert_true("preventDefault" in ev);
24 assert_equals(ev.defaultPrevented, false);
25 assert_true(ev.timeStamp > 0);
26 assert_true("initEvent" in ev);
27 assert_true("movementX" in ev, "movementX exists");
28 assert_true("movementY" in ev, "movementY exists");
29 assert_equals(ev.movementX, 0);
30 assert_equals(ev.movementY, 0);
31 }, "Default event values for mouse event interface and its pointer lock extensions.");
32 test(function() {
33 var ev = new MouseEvent("pointerlockerror",
34 { type: "trololol",
35 bubbles: true,
36 cancelable: false,
37 get defaultPrevented() {
38 assert_unreached("Should not look at the defaultPrevented property.");
40 movementX: 10,
41 movementY: 10});
42 assert_equals(ev.type, "pointerlockerror");
43 assert_equals(ev.bubbles, true); // this is synthetic event, so follow the dictionary
44 assert_equals(ev.cancelable, false);
45 assert_equals(ev.defaultPrevented, false);
46 assert_equals(ev.movementX, 10); // this is synthetic event, so follow the dictionary
47 assert_equals(ev.movementY, 10); // this is synthetic event, so follow the dictionary
48 }, "Default event values for pointerlockerror using a dictionary");
49 </script>
51 </body>
53 </html>