Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: tests/html/wheelevent_test.dart

Issue 12040059: Converting tests over to using event streams. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 wheel_event_test; 5 library wheel_event_test;
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 10
(...skipping 12 matching lines...) Expand all
23 wheelEvent = 'mousewheel'; 23 wheelEvent = 'mousewheel';
24 } else if (userAgent.contains('Firefox')) { 24 } else if (userAgent.contains('Firefox')) {
25 // FF appears to have recently added support for wheel. 25 // FF appears to have recently added support for wheel.
26 wheelEvent = 'wheel'; 26 wheelEvent = 'wheel';
27 } else if (userAgent.contains('WebKit', 0)) { 27 } else if (userAgent.contains('WebKit', 0)) {
28 wheelEvent = 'mousewheel'; 28 wheelEvent = 'mousewheel';
29 } 29 }
30 30
31 test('wheelEvent', () { 31 test('wheelEvent', () {
32 var element = new DivElement(); 32 var element = new DivElement();
33 element.on.mouseWheel.add(expectAsync1((e) { 33 element.onMouseWheel.listen(expectAsync1((e) {
34 expect(e.screenX, 100); 34 expect(e.screenX, 100);
35 expect(e.deltaX, 0); 35 expect(e.deltaX, 0);
36 expect(e.deltaY, 240); 36 expect(e.deltaY, 240);
37 })); 37 }));
38 var event = new WheelEvent(wheelEvent, 38 var event = new WheelEvent(wheelEvent,
39 deltaX: 0, 39 deltaX: 0,
40 deltaY: 240, 40 deltaY: 240,
41 screenX: 100); 41 screenX: 100);
42 element.dispatchEvent(event); 42 element.dispatchEvent(event);
43 }); 43 });
44 44
45 test('wheelEvent Stream', () { 45 test('wheelEvent Stream', () {
46 var element = new DivElement(); 46 var element = new DivElement();
47 element.onMouseWheel.listen(expectAsync1((e) { 47 element.onMouseWheel.listen(expectAsync1((e) {
48 expect(e.screenX, 100); 48 expect(e.screenX, 100);
49 expect(e.deltaX, 0); 49 expect(e.deltaX, 0);
50 expect(e.deltaY, 240); 50 expect(e.deltaY, 240);
51 })); 51 }));
52 var event = new WheelEvent(wheelEvent, 52 var event = new WheelEvent(wheelEvent,
53 deltaX: 0, 53 deltaX: 0,
54 deltaY: 240, 54 deltaY: 240,
55 screenX: 100); 55 screenX: 100);
56 element.dispatchEvent(event); 56 element.dispatchEvent(event);
57 }); 57 });
58 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698