OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script src="../../../resources/js-test.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 OverflowEvent DOM class."); | |
12 | |
13 // No initializer is passed. | |
14 shouldBe("new OverflowEvent('eventType').bubbles", "false"); | |
15 shouldBe("new OverflowEvent('eventType').cancelable", "false"); | |
16 shouldBe("new OverflowEvent('eventType').horizontalOverflow", "false"); | |
17 shouldBe("new OverflowEvent('eventType').verticalOverflow", "false"); | |
18 shouldBe("new OverflowEvent('eventType').orient", "0"); | |
19 | |
20 // bubbles, cancelable, horizontalOverflow, verticalOverflow are passed. | |
21 ["bubbles", "cancelable", "horizontalOverflow", "verticalOverflow"].forEach(func
tion(attr) { | |
22 shouldBe("new OverflowEvent('eventType', { " + attr + ": false })." + attr,
"false"); | |
23 shouldBe("new OverflowEvent('eventType', { " + attr + ": true })." + attr, "
true"); | |
24 }); | |
25 | |
26 // orient is passed. | |
27 // Numbers within the unsigned short range. | |
28 shouldBe("new OverflowEvent('eventType', { orient: 0 }).orient", "0"); | |
29 shouldBe("new OverflowEvent('eventType', { orient: 1 }).orient", "1"); | |
30 shouldBe("new OverflowEvent('eventType', { orient: 65534 }).orient", "65534"); | |
31 shouldBe("new OverflowEvent('eventType', { orient: 65535 }).orient", "65535"); | |
32 | |
33 // Numbers out of the unsigned short range. | |
34 // 2^{53}-1, the largest number that can be exactly represented by double. | |
35 shouldBe("new OverflowEvent('eventType', { orient: 9007199254740991 }).orient",
"65535"); | |
36 // 2^{64}-1 | |
37 shouldBe("new OverflowEvent('eventType', { orient: 18446744073709551615 }).orien
t", "0"); | |
38 shouldBe("new OverflowEvent('eventType', { orient: 12345678901234567890 }).orien
t", "2048"); | |
39 shouldBe("new OverflowEvent('eventType', { orient: -1 }).orient", "65535"); | |
40 shouldBe("new OverflowEvent('eventType', { orient: 123.45 }).orient", "123"); | |
41 shouldBe("new OverflowEvent('eventType', { orient: NaN }).orient", "0"); | |
42 | |
43 // Non-numeric values. | |
44 shouldBe("new OverflowEvent('eventType', { orient: undefined }).orient", "0"); | |
45 shouldBe("new OverflowEvent('eventType', { orient: null }).orient", "0"); | |
46 shouldBe("new OverflowEvent('eventType', { orient: '' }).orient", "0"); | |
47 shouldBe("new OverflowEvent('eventType', { orient: '12345' }).orient", "12345"); | |
48 shouldBe("new OverflowEvent('eventType', { orient: '12345a' }).orient", "0"); | |
49 shouldBe("new OverflowEvent('eventType', { orient: 'abc' }).orient", "0"); | |
50 shouldBe("new OverflowEvent('eventType', { orient: [] }).orient", "0"); | |
51 shouldBe("new OverflowEvent('eventType', { orient: [12345] }).orient", "12345"); | |
52 shouldBe("new OverflowEvent('eventType', { orient: [12345, 67890] }).orient", "0
"); | |
53 shouldBe("new OverflowEvent('eventType', { orient: {} }).orient", "0"); | |
54 shouldBe("new OverflowEvent('eventType', { orient: {foo: 12345} }).orient", "0")
; | |
55 shouldBe("new OverflowEvent('eventType', { orient: {valueOf: function () { retur
n 12345; }} }).orient", "12345"); | |
56 | |
57 // All initializers are passed. | |
58 shouldBe("new OverflowEvent('eventType', { bubbles: true, cancelable: true, hori
zontalOverflow: true, verticalOverflow: true, orient: 12345 }).bubbles", "true")
; | |
59 shouldBe("new OverflowEvent('eventType', { bubbles: true, cancelable: true, hori
zontalOverflow: true, verticalOverflow: true, orient: 12345 }).cancelable", "tru
e"); | |
60 shouldBe("new OverflowEvent('eventType', { bubbles: true, cancelable: true, hori
zontalOverflow: true, verticalOverflow: true, orient: 12345 }).horizontalOverflo
w", "true"); | |
61 shouldBe("new OverflowEvent('eventType', { bubbles: true, cancelable: true, hori
zontalOverflow: true, verticalOverflow: true, orient: 12345 }).verticalOverflow"
, "true"); | |
62 shouldBe("new OverflowEvent('eventType', { bubbles: true, cancelable: true, hori
zontalOverflow: true, verticalOverflow: true, orient: 12345 }).orient", "12345")
; | |
63 </script> | |
64 </body> | |
65 </html> | |
OLD | NEW |