Change fast/e* files to use pre and post js files in LayoutTests/resources.
[WebKit-https.git] / LayoutTests / fast / events / constructors / device-proximity-event-constructor.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10
11 description("This tests the constructor for the DeviceProximityEvent DOM class.");
12
13 // No initializer is passed.
14 shouldBe("new DeviceProximityEvent('eventType').bubbles", "true");
15 shouldBe("new DeviceProximityEvent('eventType').cancelable", "false");
16 shouldBe("new DeviceProximityEvent('eventType').value", "Infinity");
17 shouldBe("new DeviceProximityEvent('eventType').min", "-Infinity");
18 shouldBe("new DeviceProximityEvent('eventType').max", "Infinity");
19
20 // bubbles is passed.
21 shouldBe("new DeviceProximityEvent('eventType', { bubbles: false }).bubbles", "false");
22 shouldBe("new DeviceProximityEvent('eventType', { bubbles: true }).bubbles", "true");
23
24 // cancelable is passed.
25 shouldBe("new DeviceProximityEvent('eventType', { cancelable: false }).cancelable", "false");
26 shouldBe("new DeviceProximityEvent('eventType', { cancelable: true }).cancelable", "true");
27
28 // value is passed.
29 // Numbers within the double range.
30 shouldBe("new DeviceProximityEvent('eventType', { value: 0 }).value", "0");
31 shouldBe("new DeviceProximityEvent('eventType', { value: 1 }).value", "1");
32 shouldBe("new DeviceProximityEvent('eventType', { value: 1.79769313486231570E+308 }).value", "1.79769313486231570E+308");
33 shouldBe("new DeviceProximityEvent('eventType', { value: -1.79769313486231570E+308 }).value", "-1.79769313486231570E+308");
34
35 // Numbers out of the double range.
36 shouldBe("new DeviceProximityEvent('eventType', { value: 1.8E+308 }).value", "Infinity");
37 shouldBe("new DeviceProximityEvent('eventType', { value: -1.8E+308 }).value", "-Infinity");
38 shouldBe("new DeviceProximityEvent('eventType', { value: 123.45 }).value", "123.45");
39 shouldBe("new DeviceProximityEvent('eventType', { value: NaN }).value", "NaN");
40
41 // Non-numeric values.
42 shouldBe("new DeviceProximityEvent('eventType', { value: undefined }).value", "NaN");
43 shouldBe("new DeviceProximityEvent('eventType', { value: null }).value", "0");
44 shouldBe("new DeviceProximityEvent('eventType', { value: '' }).value", "0");
45 shouldBe("new DeviceProximityEvent('eventType', { value: '12345' }).value", "12345");
46 shouldBe("new DeviceProximityEvent('eventType', { value: '12345a' }).value", "NaN");
47 shouldBe("new DeviceProximityEvent('eventType', { value: 'abc' }).value", "NaN");
48 shouldBe("new DeviceProximityEvent('eventType', { value: [] }).value", "0");
49 shouldBe("new DeviceProximityEvent('eventType', { value: [12345] }).value", "12345");
50 shouldBe("new DeviceProximityEvent('eventType', { value: [12345, 67890] }).value", "NaN");
51 shouldBe("new DeviceProximityEvent('eventType', { value: {} }).value", "NaN");
52 shouldBe("new DeviceProximityEvent('eventType', { value: {moemoe: 12345} }).value", "NaN");
53 shouldBe("new DeviceProximityEvent('eventType', { value: {valueOf: function () { return 12345; }} }).value", "12345");
54
55 // min is passed.
56 // Numbers within the double range.
57 shouldBe("new DeviceProximityEvent('eventType', { min: 0 }).min", "0");
58 shouldBe("new DeviceProximityEvent('eventType', { min: 1 }).min", "1");
59 shouldBe("new DeviceProximityEvent('eventType', { min: 1.79769313486231570E+308 }).min", "1.79769313486231570E+308");
60 shouldBe("new DeviceProximityEvent('eventType', { min: -1.79769313486231570E+308 }).min", "-1.79769313486231570E+308");
61
62 // Numbers out of the double range.
63 shouldBe("new DeviceProximityEvent('eventType', { min: 1.8E+308 }).min", "Infinity");
64 shouldBe("new DeviceProximityEvent('eventType', { min: -1.8E+308 }).min", "-Infinity");
65 shouldBe("new DeviceProximityEvent('eventType', { min: 123.45 }).min", "123.45");
66 shouldBe("new DeviceProximityEvent('eventType', { min: NaN }).min", "NaN");
67
68 // Non-numeric mins.
69 shouldBe("new DeviceProximityEvent('eventType', { min: undefined }).min", "NaN");
70 shouldBe("new DeviceProximityEvent('eventType', { min: null }).min", "0");
71 shouldBe("new DeviceProximityEvent('eventType', { min: '' }).min", "0");
72 shouldBe("new DeviceProximityEvent('eventType', { min: '12345' }).min", "12345");
73 shouldBe("new DeviceProximityEvent('eventType', { min: '12345a' }).min", "NaN");
74 shouldBe("new DeviceProximityEvent('eventType', { min: 'abc' }).min", "NaN");
75 shouldBe("new DeviceProximityEvent('eventType', { min: [] }).min", "0");
76 shouldBe("new DeviceProximityEvent('eventType', { min: [12345] }).min", "12345");
77 shouldBe("new DeviceProximityEvent('eventType', { min: [12345, 67890] }).min", "NaN");
78 shouldBe("new DeviceProximityEvent('eventType', { min: {} }).min", "NaN");
79 shouldBe("new DeviceProximityEvent('eventType', { min: {moemoe: 12345} }).min", "NaN");
80 shouldBe("new DeviceProximityEvent('eventType', { min: {valueOf: function () { return 12345; }} }).min", "12345");
81
82 // max is passed.
83 // Numbers within the double range.
84 shouldBe("new DeviceProximityEvent('eventType', { max: 0 }).max", "0");
85 shouldBe("new DeviceProximityEvent('eventType', { max: 1 }).max", "1");
86 shouldBe("new DeviceProximityEvent('eventType', { max: 1.79769313486231570E+308 }).max", "1.79769313486231570E+308");
87 shouldBe("new DeviceProximityEvent('eventType', { max: -1.79769313486231570E+308 }).max", "-1.79769313486231570E+308");
88
89 // Numbers out of the double range.
90 shouldBe("new DeviceProximityEvent('eventType', { max: 1.8E+308 }).max", "Infinity");
91 shouldBe("new DeviceProximityEvent('eventType', { max: -1.8E+308 }).max", "-Infinity");
92 shouldBe("new DeviceProximityEvent('eventType', { max: 123.45 }).max", "123.45");
93 shouldBe("new DeviceProximityEvent('eventType', { max: NaN }).max", "NaN");
94
95 // Non-numeric maxs.
96 shouldBe("new DeviceProximityEvent('eventType', { max: undefined }).max", "NaN");
97 shouldBe("new DeviceProximityEvent('eventType', { max: null }).max", "0");
98 shouldBe("new DeviceProximityEvent('eventType', { max: '' }).max", "0");
99 shouldBe("new DeviceProximityEvent('eventType', { max: '12345' }).max", "12345");
100 shouldBe("new DeviceProximityEvent('eventType', { max: '12345a' }).max", "NaN");
101 shouldBe("new DeviceProximityEvent('eventType', { max: 'abc' }).max", "NaN");
102 shouldBe("new DeviceProximityEvent('eventType', { max: [] }).max", "0");
103 shouldBe("new DeviceProximityEvent('eventType', { max: [12345] }).max", "12345");
104 shouldBe("new DeviceProximityEvent('eventType', { max: [12345, 67890] }).max", "NaN");
105 shouldBe("new DeviceProximityEvent('eventType', { max: {} }).max", "NaN");
106 shouldBe("new DeviceProximityEvent('eventType', { max: {moemoe: 12345} }).max", "NaN");
107 shouldBe("new DeviceProximityEvent('eventType', { max: {valueOf: function () { return 12345; }} }).max", "12345");
108
109 // All initializers are passed.
110 shouldBe("new DeviceProximityEvent('eventType', { bubbles: true, cancelable: true, value: 1000, min: 0, max: 10000 }).bubbles", "true");
111 shouldBe("new DeviceProximityEvent('eventType', { bubbles: true, cancelable: true, value: 1000, min: 0, max: 10000 }).cancelable", "true");
112 shouldBe("new DeviceProximityEvent('eventType', { bubbles: true, cancelable: true, value: 1000, min: 0, max: 10000 }).value", "1000");
113 shouldBe("new DeviceProximityEvent('eventType', { bubbles: true, cancelable: true, value: 1000, min: 0, max: 10000 }).min", "0");
114 shouldBe("new DeviceProximityEvent('eventType', { bubbles: true, cancelable: true, value: 1000, min: 0, max: 10000 }).max", "10000");
115 </script>
116 <script src="../../../resources/js-test-post.js"></script>
117 </body>
118 </html>