OLD | NEW |
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 // Put universally passing event constructors in this file. | 5 // Put universally passing event constructors in this file. |
6 // Move constructors that fail on some configuration to their own | 6 // Move constructors that fail on some configuration to their own |
7 // element_constructor_foo_test.dart file. | 7 // element_constructor_foo_test.dart file. |
8 | 8 |
9 #library('ElementConstructorTest'); | 9 #library('ElementConstructorTest'); |
10 #import('../../pkg/unittest/unittest.dart'); | 10 #import('../../pkg/unittest/unittest.dart'); |
11 #import('../../pkg/unittest/html_config.dart'); | 11 #import('../../pkg/unittest/html_config.dart'); |
12 #import('dart:html'); | 12 #import('dart:html'); |
13 | 13 |
14 main() { | 14 main() { |
15 useHtmlConfiguration(); | 15 useHtmlConfiguration(); |
16 | 16 |
17 test('anchor1', () { | 17 test('anchor1', () { |
18 var e = new AnchorElement(); | 18 var e = new AnchorElement(); |
19 Expect.isTrue(e is AnchorElement); | 19 Expect.isTrue(e is AnchorElement); |
20 }); | 20 }); |
21 | 21 |
22 test('anchor2', () { | 22 test('anchor2', () { |
23 // OPTIONALS var e = new AnchorElement(href: '#blah'); | 23 var e = new AnchorElement(href: '#blah'); |
24 var e = new AnchorElement('#blah'); | |
25 Expect.isTrue(e is AnchorElement); | 24 Expect.isTrue(e is AnchorElement); |
26 Expect.isTrue(e.href.endsWith('#blah')); | 25 Expect.isTrue(e.href.endsWith('#blah')); |
27 }); | 26 }); |
28 | 27 |
29 test('area', () { | 28 test('area', () { |
30 var e = new AreaElement(); | 29 var e = new AreaElement(); |
31 Expect.isTrue(e is AreaElement); | 30 Expect.isTrue(e is AreaElement); |
32 }); | 31 }); |
33 | 32 |
34 // AudioElement tested in audioelement_test.dart | 33 // AudioElement tested in audioelement_test.dart |
35 | 34 |
36 test('div', () { | 35 test('div', () { |
37 var e = new DivElement(); | 36 var e = new DivElement(); |
38 Expect.isTrue(e is DivElement); | 37 Expect.isTrue(e is DivElement); |
39 }); | 38 }); |
40 | 39 |
41 test('canvas1', () { | 40 test('canvas1', () { |
42 var e = new CanvasElement(); | 41 var e = new CanvasElement(); |
43 Expect.isTrue(e is CanvasElement); | 42 Expect.isTrue(e is CanvasElement); |
44 }); | 43 }); |
45 | 44 |
46 test('canvas2', () { | 45 test('canvas2', () { |
47 // OPTIONALS var e = new CanvasElement(height: 100, width: 200); | 46 var e = new CanvasElement(height: 100, width: 200); |
48 var e = new CanvasElement(200, 100); | |
49 Expect.isTrue(e is CanvasElement); | 47 Expect.isTrue(e is CanvasElement); |
50 Expect.equals(200, e.width); | 48 Expect.equals(200, e.width); |
51 Expect.equals(100, e.height); | 49 Expect.equals(100, e.height); |
52 }); | 50 }); |
53 | 51 |
54 test('p', () { | 52 test('p', () { |
55 var e = new ParagraphElement(); | 53 var e = new ParagraphElement(); |
56 Expect.isTrue(e is ParagraphElement); | 54 Expect.isTrue(e is ParagraphElement); |
57 }); | 55 }); |
58 | 56 |
59 test('span', () { | 57 test('span', () { |
60 var e = new SpanElement(); | 58 var e = new SpanElement(); |
61 Expect.isTrue(e is SpanElement); | 59 Expect.isTrue(e is SpanElement); |
62 }); | 60 }); |
63 | 61 |
64 test('select', () { | 62 test('select', () { |
65 var e = new SelectElement(); | 63 var e = new SelectElement(); |
66 Expect.isTrue(e is SelectElement); | 64 Expect.isTrue(e is SelectElement); |
67 }); | 65 }); |
68 } | 66 } |
OLD | NEW |