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

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

Issue 2022263002: Make Dom events run through zone tasks. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Mark as experimental Created 4 years, 5 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
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/event_zone_task_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 // Copyright (c) 2016, 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 EventTaskZoneTest;
6
7 import 'package:unittest/unittest.dart';
8 import 'package:unittest/html_config.dart';
9 import 'dart:async';
10 import 'dart:html';
11
12 // Tests event-subscription specifications.
13
14 main() {
15 useHtmlConfiguration();
16
17 var defaultTarget = new Element.div();
18 var defaultOnData = (x) => null;
19
20 EventSubscriptionSpecification createSpec({useCapture, isOneShot}) {
21 return new EventSubscriptionSpecification(
22 name: "name",
23 target: defaultTarget,
24 useCapture: useCapture,
25 isOneShot: isOneShot,
26 onData: defaultOnData,
27 eventType: "eventType");
28 }
29
30 for (var useCapture in [true, false]) {
31 for (var isOneShot in [true, false]) {
32 var spec = createSpec(useCapture: useCapture, isOneShot: isOneShot);
33
34 test(
35 "EventSubscriptionSpecification - constructor "
36 "useCapture: $useCapture isOneShot: $isOneShot", () {
37 var replaced = spec.replace(eventType: 'replace-eventType');
38 expect(replaced.name, "name");
39 expect(replaced.target, defaultTarget);
40 expect(replaced.useCapture, useCapture);
41 expect(replaced.isOneShot, isOneShot);
42 expect(replaced.onData, equals(defaultOnData));
43 expect(replaced.eventType, "replace-eventType");
44 });
45
46 test(
47 "replace name "
48 "useCapture: $useCapture isOneShot: $isOneShot", () {
49 var replaced = spec.replace(name: 'replace-name');
50 expect(replaced.name, "replace-name");
51 expect(replaced.target, defaultTarget);
52 expect(replaced.useCapture, useCapture);
53 expect(replaced.isOneShot, isOneShot);
54 expect(replaced.onData, equals(defaultOnData));
55 expect(replaced.eventType, "eventType");
56 });
57
58 test(
59 "replace target "
60 "useCapture: $useCapture isOneShot: $isOneShot", () {
61 var replacementTarget = new Element.a();
62 var replaced = spec.replace(target: replacementTarget);
63 expect(replaced.name, "name");
64 expect(replaced.target, replacementTarget);
65 expect(replaced.useCapture, useCapture);
66 expect(replaced.isOneShot, isOneShot);
67 expect(replaced.onData, equals(defaultOnData));
68 expect(replaced.eventType, "eventType");
69 });
70
71 test(
72 "replace useCapture "
73 "useCapture: $useCapture isOneShot: $isOneShot", () {
74 var replaced = spec.replace(useCapture: !useCapture);
75 expect(replaced.name, "name");
76 expect(replaced.target, defaultTarget);
77 expect(replaced.useCapture, !useCapture);
78 expect(replaced.isOneShot, isOneShot);
79 expect(replaced.onData, equals(defaultOnData));
80 expect(replaced.eventType, "eventType");
81 });
82
83 test(
84 "replace isOneShot "
85 "useCapture: $useCapture isOneShot: $isOneShot", () {
86 var replaced = spec.replace(isOneShot: !isOneShot);
87 expect(replaced.name, "name");
88 expect(replaced.target, defaultTarget);
89 expect(replaced.useCapture, useCapture);
90 expect(replaced.isOneShot, !isOneShot);
91 expect(replaced.onData, equals(defaultOnData));
92 expect(replaced.eventType, "eventType");
93 });
94
95 test(
96 "replace onData "
97 "useCapture: $useCapture isOneShot: $isOneShot", () {
98 var replacementOnData = (x) {};
99 var replaced = spec.replace(onData: replacementOnData);
100 expect(replaced.name, "name");
101 expect(replaced.target, defaultTarget);
102 expect(replaced.useCapture, useCapture);
103 expect(replaced.isOneShot, isOneShot);
104 expect(replaced.onData, equals(replacementOnData));
105 expect(replaced.eventType, "eventType");
106 });
107
108 test(
109 "replace eventType "
110 "useCapture: $useCapture isOneShot: $isOneShot", () {
111 var replaced = spec.replace(eventType: 'replace-eventType');
112 expect(replaced.name, "name");
113 expect(replaced.target, defaultTarget);
114 expect(replaced.useCapture, useCapture);
115 expect(replaced.isOneShot, isOneShot);
116 expect(replaced.onData, equals(defaultOnData));
117 expect(replaced.eventType, "replace-eventType");
118 });
119 }
120 }
121 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/event_zone_task_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698