| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library ElementWebKitTest; | |
| 6 import '../../pkg/unittest/lib/unittest.dart'; | |
| 7 import '../../pkg/unittest/lib/html_config.dart'; | |
| 8 import 'dart:html'; | |
| 9 | |
| 10 | |
| 11 // NOTE: | |
| 12 // These should ALL be webkit-specific items | |
| 13 // Ideally all of these should be functional on all browsers and moved into | |
| 14 // element_test.dart. | |
| 15 | |
| 16 void testEventHelper(EventListenerList listenerList, type, | |
| 17 [Function registerOnEventListener = null]) { | |
| 18 bool firedWhenAddedToListenerList = false; | |
| 19 bool firedOnEvent = false; | |
| 20 listenerList.add((e) { | |
| 21 firedWhenAddedToListenerList = true; | |
| 22 }); | |
| 23 if (registerOnEventListener != null) { | |
| 24 registerOnEventListener((e) { | |
| 25 firedOnEvent = true; | |
| 26 }); | |
| 27 } | |
| 28 | |
| 29 final event = new Event(type); | |
| 30 listenerList.dispatch(event); | |
| 31 | |
| 32 expect(firedWhenAddedToListenerList, isTrue); | |
| 33 if (registerOnEventListener != null) { | |
| 34 expect(firedOnEvent, isTrue); | |
| 35 } | |
| 36 } | |
| 37 | |
| 38 main() { | |
| 39 useHtmlConfiguration(); | |
| 40 | |
| 41 | |
| 42 group('events', () { | |
| 43 final element = new Element.tag('div'); | |
| 44 final on = element.on; | |
| 45 testEventHelper(on.transitionEnd, 'webkitTransitionEnd'); | |
| 46 testEventHelper(on.fullscreenChange, 'webkitfullscreenchange', | |
| 47 (listener) => Testing.addEventListener(element, | |
| 48 'webkitfullscreenchange', listener, true)); | |
| 49 }); | |
| 50 } | |
| 51 | |
| 52 | |
| 53 | |
| OLD | NEW |