| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library EventTest; | 5 library EventTest; |
| 6 import '../../pkg/unittest/lib/unittest.dart'; | 6 import '../../pkg/unittest/lib/unittest.dart'; |
| 7 import '../../pkg/unittest/lib/html_config.dart'; | 7 import '../../pkg/unittest/lib/html_config.dart'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 | 9 |
| 10 // TODO(nweiz): Make this private to testEvents when Frog supports closures with | 10 // TODO(nweiz): Make this private to testEvents when Frog supports closures with |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 }); | 108 }); |
| 109 | 109 |
| 110 eventTest('MouseEvent', | 110 eventTest('MouseEvent', |
| 111 // canBubble and cancelable are currently required to avoid dartc | 111 // canBubble and cancelable are currently required to avoid dartc |
| 112 // complaining about the types of the named arguments. | 112 // complaining about the types of the named arguments. |
| 113 () => new MouseEvent('foo', window, 1, 2, 3, 4, 5, 6, canBubble: true, | 113 () => new MouseEvent('foo', window, 1, 2, 3, 4, 5, 6, canBubble: true, |
| 114 cancelable: true, ctrlKey: true, altKey: true, shiftKey: true, | 114 cancelable: true, ctrlKey: true, altKey: true, shiftKey: true, |
| 115 metaKey: true, relatedTarget: new Element.tag('div')), | 115 metaKey: true, relatedTarget: new Element.tag('div')), |
| 116 (ev) { | 116 (ev) { |
| 117 expect(ev.detail, 1); | 117 expect(ev.detail, 1); |
| 118 expect(ev.screenX, 2); | 118 expect(ev.screen.x, 2); |
| 119 expect(ev.screenYi, 3); | 119 expect(ev.screen.y, 3); |
| 120 expect(ev.clientX, 4); | 120 expect(ev.client.x, 4); |
| 121 expect(ev.clientY, 5); | 121 expect(ev.client.y, 5); |
| 122 expect(ev.offsetX, 4); // Same as clientX. | 122 expect(ev.offset.x, 4); // Same as clientX. |
| 123 expect(ev.offsetY, 5); // Same as clientY. | 123 expect(ev.offset.y, 5); // Same as clientY. |
| 124 expect(ev.button, 6); | 124 expect(ev.button, 6); |
| 125 expect(ev.ctrlKey, isTrue); | 125 expect(ev.ctrlKey, isTrue); |
| 126 expect(ev.altKey, isTrue); | 126 expect(ev.altKey, isTrue); |
| 127 expect(ev.shiftKey, isTrue); | 127 expect(ev.shiftKey, isTrue); |
| 128 expect(ev.metaKey, isTrue); | 128 expect(ev.metaKey, isTrue); |
| 129 expect(ev.relatedTarget.tagName, 'DIV'); | 129 expect(ev.relatedTarget.tagName, 'DIV'); |
| 130 }); | 130 }); |
| 131 | 131 |
| 132 eventTest('MutationEvent', | 132 eventTest('MutationEvent', |
| 133 () => new MutationEvent('foo', new Element.tag('div'), 'red', 'blue', | 133 () => new MutationEvent('foo', new Element.tag('div'), 'red', 'blue', |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 expect(12, ev.detail, 12); | 205 expect(12, ev.detail, 12); |
| 206 }); | 206 }); |
| 207 | 207 |
| 208 eventTest('WheelEvent', | 208 eventTest('WheelEvent', |
| 209 () => new WheelEvent(1, 2, window, 3, 4, 5, 6, ctrlKey: true, | 209 () => new WheelEvent(1, 2, window, 3, 4, 5, 6, ctrlKey: true, |
| 210 altKey: true, shiftKey: true, metaKey: true), | 210 altKey: true, shiftKey: true, metaKey: true), |
| 211 (ev) { | 211 (ev) { |
| 212 // wheelDelta* properties are multiplied by 120 for some reason | 212 // wheelDelta* properties are multiplied by 120 for some reason |
| 213 expect(ev.wheelDeltaX, 120); | 213 expect(ev.wheelDeltaX, 120); |
| 214 expect(ev.wheelDeltaY, 240); | 214 expect(ev.wheelDeltaY, 240); |
| 215 expect(ev.screenX, 3); | 215 expect(ev.screen.x, 3); |
| 216 expect(ev.screenY, 4); | 216 expect(ev.screen.y, 4); |
| 217 expect(ev.clientX, 5); | 217 expect(ev.client.x, 5); |
| 218 expect(ev.clientY, 6); | 218 expect(ev.client.y, 6); |
| 219 expect(ev.ctrlKey, isTrue); | 219 expect(ev.ctrlKey, isTrue); |
| 220 expect(ev.altKey, isTrue); | 220 expect(ev.altKey, isTrue); |
| 221 expect(ev.shiftKey, isTrue); | 221 expect(ev.shiftKey, isTrue); |
| 222 expect(ev.metaKey, isTrue); | 222 expect(ev.metaKey, isTrue); |
| 223 }, type: 'mousewheel'); | 223 }, type: 'mousewheel'); |
| 224 | 224 |
| 225 // HttpRequestProgressEvent has no properties to itself, so just test that | 225 // HttpRequestProgressEvent has no properties to itself, so just test that |
| 226 // it doesn't error out on creation and can be dispatched. | 226 // it doesn't error out on creation and can be dispatched. |
| 227 // Issue 1005. | 227 // Issue 1005. |
| 228 // eventTest('HttpRequestProgressEvent', | 228 // eventTest('HttpRequestProgressEvent', |
| 229 // () => new HttpRequestProgressEvent('foo', 5), | 229 // () => new HttpRequestProgressEvent('foo', 5), |
| 230 // (ev) {}); | 230 // (ev) {}); |
| 231 } | 231 } |
| OLD | NEW |