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

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

Issue 11931009: Adding support for the MouseWheel event in Streams. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding more dynamic checking for which init function to use. Created 7 years, 11 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
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 library wheel_event_test;
Siggi Cherem (dart-lang) 2013/01/16 18:52:00 + copyright header
2 import '../../pkg/unittest/lib/unittest.dart';
3 import '../../pkg/unittest/lib/html_config.dart';
4 import 'dart:html';
5
6
7 main() {
8
9 useHtmlConfiguration();
10
11 var userAgent = window.navigator.userAgent;
12
13 // Lame platform-dependent check to validate that our assumptions about
14 // which event is being used is correct.
15 var wheelEvent = 'wheel';
16 if (userAgent.contains("Opera", 0)) {
17 wheelEvent = 'mousewheel';
18 } else if (userAgent.contains("MSIE", 0)) {
19 wheelEvent = 'mousewheel';
20 } else if (userAgent.contains('Firefox')) {
21 // FF appears to have recently added support for wheel.
22 if (userAgent.contains('Firefox/17')) {
23 wheelEvent = 'DOMMouseScroll';
24 } else {
25 wheelEvent = 'wheel';
26 }
27 } else if (userAgent.contains('WebKit', 0)) {
28 wheelEvent = 'mousewheel';
29 }
30
31 test('wheelEvent', () {
32 var element = new DivElement();
33 element.on.mouseWheel.add(expectAsync1((e) {
34 expect(e.screenX, 100);
35 expect(e.deltaX, 0);
36 expect(e.deltaY, 240);
37 }));
38 var event = new WheelEvent(wheelEvent,
39 window,
40 0,
41 240,
42 0,
43 100,
44 200,
45 10,
46 20,
47 0);
48 element.$dom_dispatchEvent(event);
49 });
50
51 test('wheelEvent Stream', () {
52 var element = new DivElement();
53 element.onMouseWheel.listen(expectAsync1((e) {
54 expect(e.screenX, 100);
55 expect(e.deltaX, 0);
56 expect(e.deltaY, 240);
57 }));
58 var event = new WheelEvent(wheelEvent,
59 window,
60 0,
61 240,
62 0,
63 100,
64 200,
65 10,
66 20,
67 0);
68 element.$dom_dispatchEvent(event);
69 });
70 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698