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

Side by Side Diff: test/codegen/lib/html/input_element_test.dart

Issue 1930043002: Add all dart:html tests from the sdk to test/codegen. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: ptal Created 4 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
OLDNEW
(Empty)
1 library input_element_test;
2 import 'package:unittest/unittest.dart';
3 import 'package:unittest/html_individual_config.dart';
4 import 'dart:html';
5
6 void check(InputElement element, String type, [bool supported = true]) {
7 expect(element is InputElement, true);
8 if (supported) {
9 expect(element.type, type);
10 } else {
11 expect(element.type, 'text');
12 }
13 }
14
15 main() {
16 useHtmlIndividualConfiguration();
17
18 group('supported_search', () {
19 test('supported', () {
20 expect(SearchInputElement.supported, true);
21 });
22 });
23
24 group('supported_url', () {
25 test('supported', () {
26 expect(UrlInputElement.supported, true);
27 });
28 });
29
30 group('supported_tel', () {
31 test('supported', () {
32 expect(TelephoneInputElement.supported, true);
33 });
34 });
35
36 group('supported_email', () {
37 test('supported', () {
38 expect(EmailInputElement.supported, true);
39 });
40 });
41
42 group('supported_date', () {
43 test('supported', () {
44 expect(DateInputElement.supported, true);
45 });
46 });
47
48 group('supported_month', () {
49 test('supported', () {
50 expect(MonthInputElement.supported, true);
51 });
52 });
53
54 group('supported_week', () {
55 test('supported', () {
56 expect(WeekInputElement.supported, true);
57 });
58 });
59
60 group('supported_time', () {
61 test('supported', () {
62 expect(TimeInputElement.supported, true);
63 });
64 });
65
66 group('supported_datetime-local', () {
67 test('supported', () {
68 expect(LocalDateTimeInputElement.supported, true);
69 });
70 });
71
72 group('supported_number', () {
73 test('supported', () {
74 expect(NumberInputElement.supported, true);
75 });
76 });
77
78 group('supported_range', () {
79 test('supported', () {
80 expect(RangeInputElement.supported, true);
81 });
82 });
83
84 group('constructors', () {
85 test('hidden', () {
86 check(new HiddenInputElement(), 'hidden');
87 });
88
89 test('search', () {
90 check(new SearchInputElement(), 'search', SearchInputElement.supported);
91 });
92
93 test('text', () {
94 check(new TextInputElement(), 'text');
95 });
96
97 test('url', () {
98 check(new UrlInputElement(), 'url', UrlInputElement.supported);
99 });
100
101 test('telephone', () {
102 check(new TelephoneInputElement(), 'tel',
103 TelephoneInputElement.supported);
104 });
105
106 test('email', () {
107 check(new EmailInputElement(), 'email', EmailInputElement.supported);
108 });
109
110 test('password', () {
111 check(new PasswordInputElement(), 'password');
112 });
113
114 test('date', () {
115 check(new DateInputElement(), 'date', DateInputElement.supported);
116 });
117
118 test('month', () {
119 check(new MonthInputElement(), 'month', MonthInputElement.supported);
120 });
121
122 test('week', () {
123 check(new WeekInputElement(), 'week', WeekInputElement.supported);
124 });
125
126 test('time', () {
127 check(new TimeInputElement(), 'time', TimeInputElement.supported);
128 if (TimeInputElement.supported) {
129 var element = new TimeInputElement();
130 var now = new DateTime.now();
131 element.valueAsDate = now;
132 expect(element.valueAsDate is DateTime, isTrue);
133
134 // Bug 8813, setting it is just going to the epoch.
135 //expect(element.valueAsDate, now);
136 }
137 });
138
139 test('datetime-local', () {
140 check(new LocalDateTimeInputElement(), 'datetime-local',
141 LocalDateTimeInputElement.supported);
142 });
143
144 test('number', () {
145 check(new NumberInputElement(), 'number', NumberInputElement.supported);
146 });
147
148 test('range', () {
149 check(new RangeInputElement(), 'range', RangeInputElement.supported);
150 });
151
152 test('checkbox', () {
153 check(new CheckboxInputElement(), 'checkbox');
154 });
155
156 test('radio', () {
157 check(new RadioButtonInputElement(), 'radio');
158 });
159
160 test('file', () {
161 check(new FileUploadInputElement(), 'file');
162 });
163
164 test('submit', () {
165 check(new SubmitButtonInputElement(), 'submit');
166 });
167
168 test('image', () {
169 check(new ImageButtonInputElement(), 'image');
170 });
171
172 test('reset', () {
173 check(new ResetButtonInputElement(), 'reset');
174 });
175
176 test('button', () {
177 check(new ButtonInputElement(), 'button');
178 });
179 });
180
181 group('attributes', () {
182 test('valueSetNull', () {
183 final e = new TextInputElement();
184 e.value = null;
185 expect(e.value, '');
186 });
187 test('valueSetNullProxy', () {
188 final e = new TextInputElement();
189 e.value = _undefined;
190 expect(e.value, '');
191 });
192 });
193 }
194
195 var _undefined = (() => new List(5)[0])();
OLDNEW
« no previous file with comments | « test/codegen/lib/html/indexeddb_5_test.dart ('k') | test/codegen/lib/html/instance_of_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698