| 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/unittest.dart'); | 6 #import('../../pkg/unittest/unittest.dart'); |
| 7 #import('../../pkg/unittest/html_config.dart'); | 7 #import('../../pkg/unittest/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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.equals(1, ev.detail); | 117 Expect.equals(1, ev.detail); |
| 118 Expect.equals(2, ev.screenX); | 118 Expect.equals(2, ev.screenX); |
| 119 Expect.equals(3, ev.screenY); | 119 Expect.equals(3, ev.screenY); |
| 120 Expect.equals(4, ev.clientX); | 120 Expect.equals(4, ev.clientX); |
| 121 Expect.equals(5, ev.clientY); | 121 Expect.equals(5, ev.clientY); |
| 122 Expect.equals(4, ev.offsetX); // Same as clientX. |
| 123 Expect.equals(5, ev.offsetY); // Same as clientY. |
| 122 Expect.equals(6, ev.button); | 124 Expect.equals(6, ev.button); |
| 123 Expect.isTrue(ev.ctrlKey); | 125 Expect.isTrue(ev.ctrlKey); |
| 124 Expect.isTrue(ev.altKey); | 126 Expect.isTrue(ev.altKey); |
| 125 Expect.isTrue(ev.shiftKey); | 127 Expect.isTrue(ev.shiftKey); |
| 126 Expect.isTrue(ev.metaKey); | 128 Expect.isTrue(ev.metaKey); |
| 127 Expect.equals('DIV', ev.relatedTarget.tagName); | 129 Expect.equals('DIV', ev.relatedTarget.tagName); |
| 128 }); | 130 }); |
| 129 | 131 |
| 130 eventTest('MutationEvent', | 132 eventTest('MutationEvent', |
| 131 () => new MutationEvent('foo', new Element.tag('div'), 'red', 'blue', | 133 () => new MutationEvent('foo', new Element.tag('div'), 'red', 'blue', |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 Expect.isTrue(ev.metaKey); | 216 Expect.isTrue(ev.metaKey); |
| 215 }, type: 'mousewheel'); | 217 }, type: 'mousewheel'); |
| 216 | 218 |
| 217 // HttpRequestProgressEvent has no properties to itself, so just test that | 219 // HttpRequestProgressEvent has no properties to itself, so just test that |
| 218 // it doesn't error out on creation and can be dispatched. | 220 // it doesn't error out on creation and can be dispatched. |
| 219 // Issue 1005. | 221 // Issue 1005. |
| 220 // eventTest('HttpRequestProgressEvent', | 222 // eventTest('HttpRequestProgressEvent', |
| 221 // () => new HttpRequestProgressEvent('foo', 5), | 223 // () => new HttpRequestProgressEvent('foo', 5), |
| 222 // (ev) {}); | 224 // (ev) {}); |
| 223 } | 225 } |
| OLD | NEW |