summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/DeviceLight/create-event.html
blob: c8f934f3396a9d274130253a4779870d7c51e179 (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
<!DOCTYPE html>
<html>
<body>
<script src="../../../resources/js-test.js"></script>
<script>
description("Tests that document.createEvent() works with DeviceLightEvent.");

var event = document.createEvent('DeviceLightEvent');
var newEvent = new DeviceLightEvent("devicelight", {
    bubbles: true, cancelable: false,
    value: 10
});

var defaultEvent = new DeviceLightEvent("devicelight");

shouldBeTrue("typeof event == 'object'");
shouldBe("event.__proto__", "DeviceLightEvent.prototype");

shouldBeTrue("event instanceof window.DeviceLightEvent");
shouldBeTrue("'type' in event");
shouldBeTrue("'bubbles' in event");
shouldBeTrue("'cancelable' in event");
shouldBeTrue("'value' in event");

shouldBeTrue("typeof newEvent.type == 'string'");
shouldBeEqualToString("newEvent.type", "devicelight");
shouldBeTrue("typeof newEvent.bubbles == 'boolean'");
shouldBeTrue("newEvent.bubbles");
shouldBeTrue("typeof newEvent.cancelable == 'boolean'");
shouldBeFalse("newEvent.cancelable")
shouldBeTrue("typeof newEvent.value == 'number'");
shouldBeEqualToNumber('newEvent.value', 10);

// FIXME: Consider making bubbles property configurable.
shouldBeTrue("defaultEvent.bubbles");
shouldBeFalse("defaultEvent.cancelable");
</script>
</body>
</html>