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

Side by Side Diff: test/codegen/lib/html/form_data_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
« no previous file with comments | « test/codegen/lib/html/fontface_test.dart ('k') | test/codegen/lib/html/form_element_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) 2012, 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 FormDataTest;
6
7 import 'package:unittest/unittest.dart';
8 import 'package:unittest/html_individual_config.dart';
9 import 'dart:html';
10
11 void main() {
12 // TODO(efortuna): This is a bad test. Revisit when we have tests that can run
13 // both a server and fire up a browser.
14 useHtmlIndividualConfiguration();
15
16 group('supported', () {
17 test('supported', () {
18 expect(FormData.supported, isTrue);
19 });
20 });
21
22 group('functional', () {
23 test('unsupported throws', () {
24 var expectation = FormData.supported ? returnsNormally : throws;
25 expect(() {
26 new FormData();
27 }, expectation);
28 });
29
30 var isFormData = predicate((x) => x is FormData, 'is a FormData');
31
32 if (FormData.supported) {
33 test('constructorTest1', () {
34 var form = new FormData();
35 expect(form, isNotNull);
36 expect(form, isFormData);
37 });
38
39 test('constructorTest2', () {
40 var form = new FormData(new FormElement());
41 expect(form, isNotNull);
42 expect(form, isFormData);
43 });
44
45 test('appendTest', () {
46 var form = new FormData();
47 form.append('test', '1');
48 form.append('username', 'Elmo');
49 form.append('address', '1 Sesame Street');
50 form.append('password', '123456');
51 expect(form, isNotNull);
52 });
53
54 test('appendBlob', () {
55 var form = new FormData();
56 var blob = new Blob(
57 ['Indescribable... Indestructible! Nothing can stop it!'],
58 'text/plain');
59 form.appendBlob('theBlob', blob, 'theBlob.txt');
60 });
61
62 test('send', () {
63 var form = new FormData();
64 var blobString =
65 'Indescribable... Indestructible! Nothing can stop it!';
66 var blob = new Blob(
67 [blobString],
68 'text/plain');
69 form.appendBlob('theBlob', blob, 'theBlob.txt');
70
71 var xhr = new HttpRequest();
72 xhr.open('POST',
73 '${window.location.protocol}//${window.location.host}/echo');
74
75 xhr.onLoad.listen(expectAsync((e) {
76 expect(xhr.responseText, contains(blobString));
77 }));
78 xhr.onError.listen((e) {
79 fail('$e');
80 });
81 xhr.send(form);
82 });
83 }
84 });
85 }
OLDNEW
« no previous file with comments | « test/codegen/lib/html/fontface_test.dart ('k') | test/codegen/lib/html/form_element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698