OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 | 8 |
9 description("This tests the constructor for the MouseEvent DOM class."); | 9 description("This tests the constructor for the MouseEvent DOM class."); |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 shouldBe("new MouseEvent('eventType', { " + attr + ": {valueOf: function () { return 12345; }} })." + attr, "12345"); | 96 shouldBe("new MouseEvent('eventType', { " + attr + ": {valueOf: function () { return 12345; }} })." + attr, "12345"); |
97 }); | 97 }); |
98 | 98 |
99 // ctrlKey, altKey, shiftKey and metaKey are passed. | 99 // ctrlKey, altKey, shiftKey and metaKey are passed. |
100 ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) { | 100 ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) { |
101 shouldBe("new MouseEvent('eventType', { " + attr + ": false })." + attr, "fa lse"); | 101 shouldBe("new MouseEvent('eventType', { " + attr + ": false })." + attr, "fa lse"); |
102 shouldBe("new MouseEvent('eventType', { " + attr + ": true })." + attr, "tru e"); | 102 shouldBe("new MouseEvent('eventType', { " + attr + ": true })." + attr, "tru e"); |
103 }); | 103 }); |
104 | 104 |
105 // button is passed. | 105 // button is passed. |
106 // Numbers within the unsigned short range. | 106 // Numbers within the short range. |
107 shouldBe("new MouseEvent('eventType', { button: 0 }).button", "0"); | 107 shouldBe("new MouseEvent('eventType', { button: 0 }).button", "0"); |
108 shouldBe("new MouseEvent('eventType', { button: 1 }).button", "1"); | 108 shouldBe("new MouseEvent('eventType', { button: 1 }).button", "1"); |
109 shouldBe("new MouseEvent('eventType', { button: 65534 }).button", "65534"); | |
philipj_slow
2015/06/10 08:46:25
Why not keep this test to show the new behavior? I
ramya.v
2015/06/10 09:21:28
Done.
| |
110 | 109 |
111 // Numbers that are equal to ((unsigned short)-1) should be treated as 0. | 110 // Numbers that are equal to -1 should be treated as 0. |
philipj_slow
2015/06/10 08:46:25
Can you also test -2, to show that it's just -1 an
ramya.v
2015/06/10 09:21:28
Done.
| |
112 shouldBe("new MouseEvent('eventType', { button: 65535 }).button", "0"); | 111 shouldBe("new MouseEvent('eventType', { button: 65535 }).button", "0"); |
113 shouldBe("new MouseEvent('eventType', { button: 9007199254740991 }).button", "0" ); | 112 shouldBe("new MouseEvent('eventType', { button: 9007199254740991 }).button", "0" ); |
114 shouldBe("new MouseEvent('eventType', { button: -1 }).button", "0"); | 113 shouldBe("new MouseEvent('eventType', { button: -1 }).button", "0"); |
115 | 114 |
116 // Numbers out of the unsigned short range. | 115 // Numbers out of the short range. |
117 // 2^{64}-1 | 116 // 2^{64}-1 |
118 shouldBe("new MouseEvent('eventType', { button: 18446744073709551615 }).button", "0"); | 117 shouldBe("new MouseEvent('eventType', { button: 18446744073709551615 }).button", "0"); |
119 shouldBe("new MouseEvent('eventType', { button: 12345678901234567890 }).button", "2048"); | 118 shouldBe("new MouseEvent('eventType', { button: 12345678901234567890 }).button", "2048"); |
120 shouldBe("new MouseEvent('eventType', { button: 123.45 }).button", "123"); | 119 shouldBe("new MouseEvent('eventType', { button: 123.45 }).button", "123"); |
121 shouldBe("new MouseEvent('eventType', { button: NaN }).button", "0"); | 120 shouldBe("new MouseEvent('eventType', { button: NaN }).button", "0"); |
122 | 121 |
123 // Non-numeric values. | 122 // Non-numeric values. |
124 shouldBe("new MouseEvent('eventType', { button: undefined }).button", "0"); | 123 shouldBe("new MouseEvent('eventType', { button: undefined }).button", "0"); |
125 shouldBe("new MouseEvent('eventType', { button: null }).button", "0"); | 124 shouldBe("new MouseEvent('eventType', { button: null }).button", "0"); |
126 shouldBe("new MouseEvent('eventType', { button: '' }).button", "0"); | 125 shouldBe("new MouseEvent('eventType', { button: '' }).button", "0"); |
127 shouldBe("new MouseEvent('eventType', { button: '12345' }).button", "12345"); | 126 shouldBe("new MouseEvent('eventType', { button: '12345' }).button", "12345"); |
128 shouldBe("new MouseEvent('eventType', { button: '12345a' }).button", "0"); | 127 shouldBe("new MouseEvent('eventType', { button: '12345a' }).button", "0"); |
129 shouldBe("new MouseEvent('eventType', { button: 'abc' }).button", "0"); | 128 shouldBe("new MouseEvent('eventType', { button: 'abc' }).button", "0"); |
130 shouldBe("new MouseEvent('eventType', { button: [] }).button", "0"); | 129 shouldBe("new MouseEvent('eventType', { button: [] }).button", "0"); |
131 shouldBe("new MouseEvent('eventType', { button: [12345] }).button", "12345"); | 130 shouldBe("new MouseEvent('eventType', { button: [12345] }).button", "12345"); |
132 shouldBe("new MouseEvent('eventType', { button: [12345, 67890] }).button", "0"); | 131 shouldBe("new MouseEvent('eventType', { button: [12345, 67890] }).button", "0"); |
133 shouldBe("new MouseEvent('eventType', { button: {} }).button", "0"); | 132 shouldBe("new MouseEvent('eventType', { button: {} }).button", "0"); |
134 shouldBe("new MouseEvent('eventType', { button: {moemoe: 12345} }).button", "0") ; | 133 shouldBe("new MouseEvent('eventType', { button: {moemoe: 12345} }).button", "0") ; |
135 shouldBe("new MouseEvent('eventType', { button: {valueOf: function () { return 1 2345; }} }).button", "12345"); | 134 shouldBe("new MouseEvent('eventType', { button: {valueOf: function () { return 1 2345; }} }).button", "12345"); |
136 | 135 |
137 // buttons is passed. | 136 // buttons is passed. |
138 // Numbers within the unsigned short range. | 137 // Numbers within the short range. |
139 shouldBe("new MouseEvent('eventType', { buttons: 0 }).buttons", "0"); | 138 shouldBe("new MouseEvent('eventType', { buttons: 0 }).buttons", "0"); |
140 shouldBe("new MouseEvent('eventType', { buttons: 1 }).buttons", "1"); | 139 shouldBe("new MouseEvent('eventType', { buttons: 1 }).buttons", "1"); |
141 shouldBe("new MouseEvent('eventType', { buttons: 65534 }).buttons", "65534"); | 140 shouldBe("new MouseEvent('eventType', { buttons: 65534 }).buttons", "65534"); |
142 | 141 |
143 // Numbers out of the unsigned short range. | 142 // Numbers out of the short range. |
144 // 2^{64}-1 | 143 // 2^{64}-1 |
145 shouldBe("new MouseEvent('eventType', { buttons: 65535 }).buttons", "65535"); | 144 shouldBe("new MouseEvent('eventType', { buttons: 65535 }).buttons", "65535"); |
146 shouldBe("new MouseEvent('eventType', { buttons: 9007199254740991 }).buttons", " 65535"); | 145 shouldBe("new MouseEvent('eventType', { buttons: 9007199254740991 }).buttons", " 65535"); |
147 shouldBe("new MouseEvent('eventType', { buttons: -1 }).buttons", "65535"); | 146 shouldBe("new MouseEvent('eventType', { buttons: -1 }).buttons", "65535"); |
148 shouldBe("new MouseEvent('eventType', { buttons: 18446744073709551615 }).buttons ", "0"); | 147 shouldBe("new MouseEvent('eventType', { buttons: 18446744073709551615 }).buttons ", "0"); |
149 shouldBe("new MouseEvent('eventType', { buttons: 12345678901234567890 }).buttons ", "2048"); | 148 shouldBe("new MouseEvent('eventType', { buttons: 12345678901234567890 }).buttons ", "2048"); |
150 shouldBe("new MouseEvent('eventType', { buttons: 123.45 }).buttons", "123"); | 149 shouldBe("new MouseEvent('eventType', { buttons: 123.45 }).buttons", "123"); |
151 shouldBe("new MouseEvent('eventType', { buttons: NaN }).buttons", "0"); | 150 shouldBe("new MouseEvent('eventType', { buttons: NaN }).buttons", "0"); |
152 | 151 |
153 // Non-numeric values. | 152 // Non-numeric values. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).clientY", "555"); | 198 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).clientY", "555"); |
200 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).ctrlKey", "true"); | 199 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).ctrlKey", "true"); |
201 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).shiftKey", "true"); | 200 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).shiftKey", "true"); |
202 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).altKey", "true"); | 201 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).altKey", "true"); |
203 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).metaKey", "true"); | 202 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).metaKey", "true"); |
204 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).button", "666"); | 203 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).button", "666"); |
205 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).relatedTarget", "testDiv"); | 204 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).relatedTarget", "testDiv"); |
206 </script> | 205 </script> |
207 </body> | 206 </body> |
208 </html> | 207 </html> |
OLD | NEW |