| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 tests.html.events_test; | 5 library tests.html.events_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 import 'package:unittest/html_config.dart'; | 10 import 'package:unittest/html_config.dart'; |
| 11 | 11 |
| 12 main() { | 12 main() { |
| 13 useHtmlConfiguration(); | 13 useHtmlConfiguration(); |
| 14 | 14 |
| 15 test('TimeStamp', () { | 15 test('TimeStamp', () { |
| 16 Event event = new Event('test'); | 16 Event event = new Event('test'); |
| 17 | 17 |
| 18 int timeStamp = event.timeStamp; | 18 num timeStamp = event.timeStamp; |
| 19 expect(timeStamp, greaterThan(0)); | 19 expect(timeStamp, greaterThan(0)); |
| 20 }); | 20 }); |
| 21 | 21 |
| 22 test('Event canBubble and cancelable', () { | 22 test('Event canBubble and cancelable', () { |
| 23 // Try every combination of canBubble and cancelable | 23 // Try every combination of canBubble and cancelable |
| 24 for (var i = 0; i < 4; i++) { | 24 for (var i = 0; i < 4; i++) { |
| 25 var bubble = (i & 1) != 0; | 25 var bubble = (i & 1) != 0; |
| 26 var cancel = (i & 2) != 0; | 26 var cancel = (i & 2) != 0; |
| 27 var e = new Event('input', canBubble: bubble, cancelable: cancel); | 27 var e = new Event('input', canBubble: bubble, cancelable: cancel); |
| 28 expect(e.bubbles, bubble, reason: 'canBubble was set to $bubble'); | 28 expect(e.bubbles, bubble, reason: 'canBubble was set to $bubble'); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 expect(Zone.current, equals(zone)); | 110 expect(Zone.current, equals(zone)); |
| 111 sub.cancel(); | 111 sub.cancel(); |
| 112 })); | 112 })); |
| 113 } | 113 } |
| 114 | 114 |
| 115 sub = element.on['test'].listen(expectAsync(handler)); | 115 sub = element.on['test'].listen(expectAsync(handler)); |
| 116 })); | 116 })); |
| 117 element.dispatchEvent(new Event('test')); | 117 element.dispatchEvent(new Event('test')); |
| 118 }); | 118 }); |
| 119 } | 119 } |
| OLD | NEW |