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

Side by Side Diff: tests/dom/events_test.dart

Issue 10178014: Copy lib/dom tests that use dart:html to lib/html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 8 years, 7 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 | « tests/dom/domparser_test.dart ('k') | tests/dom/exceptions_test.dart » ('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('EventsTest');
2 #import('../../lib/unittest/unittest.dart');
3 #import('../../lib/unittest/html_config.dart');
4 #import('dart:html');
5
6 main() {
7 useHtmlConfiguration();
8 test('TimeStamp', () {
9 Event event = new Event('test');
10
11 int timeStamp = event.timeStamp;
12 Expect.isTrue(timeStamp > 0);
13 });
14 // The next test is not asynchronous because [on['test'].dispatch(event)] fire s the event
15 // and event listener synchronously.
16 test('EventTarget', () {
17 Element element = new Element.tag('test');
18 element.id = 'eventtarget';
19 window.document.body.nodes.add(element);
20
21 int invocationCounter = 0;
22 void handler(Event e) {
23 Expect.equals('test', e.type);
24 Element target = e.target;
25 Expect.identical(element, target);
26 invocationCounter++;
27 }
28
29 Event event = new Event('test');
30
31 invocationCounter = 0;
32 element.on['test'].dispatch(event);
33 Expect.equals(0, invocationCounter);
34
35 element.on['test'].add(handler, false);
36 invocationCounter = 0;
37 element.on['test'].dispatch(event);
38 Expect.equals(1, invocationCounter);
39
40 element.on['test'].remove(handler, false);
41 invocationCounter = 0;
42 element.on['test'].dispatch(event);
43 Expect.equals(0, invocationCounter);
44
45 element.on['test'].add(handler, false);
46 invocationCounter = 0;
47 element.on['test'].dispatch(event);
48 Expect.equals(1, invocationCounter);
49
50 element.on['test'].add(handler, false);
51 invocationCounter = 0;
52 element.on['test'].dispatch(event);
53 Expect.equals(1, invocationCounter);
54 });
55 test('InitMouseEvent', () {
56 DivElement div = new Element.tag('div');
57 MouseEvent event = document.$dom_createEvent('MouseEvent');
58 event.$dom_initMouseEvent('zebra', true, true, window, 0, 1, 2, 3, 4, false, false, false, false, 0, div);
59 });
60 }
OLDNEW
« no previous file with comments | « tests/dom/domparser_test.dart ('k') | tests/dom/exceptions_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698