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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library QueryTest; 5 library QueryTest;
6
6 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
7 import 'package:unittest/html_config.dart'; 8 import 'package:unittest/html_config.dart';
8 import 'dart:html'; 9 import 'dart:html';
9 10
10 main() { 11 main() {
11 useHtmlConfiguration(); 12 useHtmlConfiguration();
12 13
13 final div = new DivElement(); 14 final div = new DivElement();
14 final canvas = new CanvasElement(width: 200, height: 200); 15 final canvas = new CanvasElement(width: 200, height: 200);
15 canvas.id = 'testcanvas'; 16 canvas.id = 'testcanvas';
16 final element = 17 final element = new Element.html("<div><br/><img/><input/><img/></div>");
17 new Element.html("<div><br/><img/><input/><img/></div>"); 18 document.body.nodes.addAll([div, canvas, element]);
18 document.body.nodes.addAll([div, canvas, element]); 19
19
20 var isCanvasElement = 20 var isCanvasElement =
21 predicate((x) => x is CanvasElement, 'is a CanvasElement'); 21 predicate((x) => x is CanvasElement, 'is a CanvasElement');
22 var isImageElement = 22 var isImageElement =
23 predicate((x) => x is ImageElement, 'is an ImageElement'); 23 predicate((x) => x is ImageElement, 'is an ImageElement');
24 24
25 test('query', () { 25 test('query', () {
26 Element e = query('#testcanvas'); 26 Element e = query('#testcanvas');
27 expect(e, isNotNull); 27 expect(e, isNotNull);
28 expect(e.id, 'testcanvas'); 28 expect(e.id, 'testcanvas');
29 expect(e, isCanvasElement); 29 expect(e, isCanvasElement);
30 expect(e, canvas); 30 expect(e, canvas);
31 }); 31 });
32 32
33 test('query (None)', () { 33 test('query (None)', () {
34 Element e = query('#nothere'); 34 Element e = query('#nothere');
35 expect(e, isNull); 35 expect(e, isNull);
36 }); 36 });
37 37
38 test('queryAll (One)', () { 38 test('queryAll (One)', () {
39 List l = queryAll('canvas'); 39 List l = queryAll('canvas');
40 expect(l.length, 1); 40 expect(l.length, 1);
41 expect(l[0], canvas); 41 expect(l[0], canvas);
42 }); 42 });
43
44 43
45 test('queryAll (Multiple)', () { 44 test('queryAll (Multiple)', () {
46 List l = queryAll('img'); 45 List l = queryAll('img');
47 expect(l.length, 2); 46 expect(l.length, 2);
48 expect(l[0], isImageElement); 47 expect(l[0], isImageElement);
49 expect(l[1], isImageElement); 48 expect(l[1], isImageElement);
50 expect(l[0], isNot(equals(l[1]))); 49 expect(l[0], isNot(equals(l[1])));
51 }); 50 });
52 51
53 test('queryAll (None)', () { 52 test('queryAll (None)', () {
54 List l = queryAll('video'); 53 List l = queryAll('video');
55 expect(l.isEmpty, isTrue); 54 expect(l.isEmpty, isTrue);
56 }); 55 });
57 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698