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 var isAnchorElement = new isInstanceOf<AnchorElement>('AnchorElement'); |
| 18 var isAreaElement = new isInstanceOf<AreaElement>('AreaElement'); |
| 19 var isDivElement = new isInstanceOf<DivElement>('DivElement'); |
| 20 var isCanvasElement = new isInstanceOf<CanvasElement>('CanvasElement'); |
| 21 var isParagraphElement = |
| 22 new isInstanceOf<ParagraphElement>('ParagraphElement'); |
| 23 var isSpanElement = new isInstanceOf<SpanElement>('SpanElement'); |
| 24 var isSelectElement = new isInstanceOf<SelectElement>('SelectElement'); |
| 25 |
17 test('anchor1', () { | 26 test('anchor1', () { |
18 var e = new AnchorElement(); | 27 var e = new AnchorElement(); |
19 Expect.isTrue(e is AnchorElement); | 28 expect(e, isAnchorElement); |
20 }); | 29 }); |
21 | 30 |
22 test('anchor2', () { | 31 test('anchor2', () { |
23 var e = new AnchorElement(href: '#blah'); | 32 var e = new AnchorElement(href: '#blah'); |
24 Expect.isTrue(e is AnchorElement); | 33 expect(e, isAnchorElement); |
25 Expect.isTrue(e.href.endsWith('#blah')); | 34 expect(e.href, endsWith('#blah')); |
26 }); | 35 }); |
27 | 36 |
28 test('area', () { | 37 test('area', () { |
29 var e = new AreaElement(); | 38 var e = new AreaElement(); |
30 Expect.isTrue(e is AreaElement); | 39 expect(e, isAreaElement); |
31 }); | 40 }); |
32 | 41 |
33 // AudioElement tested in audioelement_test.dart | 42 // AudioElement tested in audioelement_test.dart |
34 | 43 |
35 test('div', () { | 44 test('div', () { |
36 var e = new DivElement(); | 45 var e = new DivElement(); |
37 Expect.isTrue(e is DivElement); | 46 expect(e, isDivElement); |
38 }); | 47 }); |
39 | 48 |
40 test('canvas1', () { | 49 test('canvas1', () { |
41 var e = new CanvasElement(); | 50 var e = new CanvasElement(); |
42 Expect.isTrue(e is CanvasElement); | 51 expect(e, isCanvasElement); |
43 }); | 52 }); |
44 | 53 |
45 test('canvas2', () { | 54 test('canvas2', () { |
46 var e = new CanvasElement(height: 100, width: 200); | 55 var e = new CanvasElement(height: 100, width: 200); |
47 Expect.isTrue(e is CanvasElement); | 56 expect(e, isCanvasElement); |
48 Expect.equals(200, e.width); | 57 expect(e.width, 200); |
49 Expect.equals(100, e.height); | 58 expect(e.height, 100); |
50 }); | 59 }); |
51 | 60 |
52 test('p', () { | 61 test('p', () { |
53 var e = new ParagraphElement(); | 62 var e = new ParagraphElement(); |
54 Expect.isTrue(e is ParagraphElement); | 63 expect(e, isParagraphElement); |
55 }); | 64 }); |
56 | 65 |
57 test('span', () { | 66 test('span', () { |
58 var e = new SpanElement(); | 67 var e = new SpanElement(); |
59 Expect.isTrue(e is SpanElement); | 68 expect(e, isSpanElement); |
60 }); | 69 }); |
61 | 70 |
62 test('select', () { | 71 test('select', () { |
63 var e = new SelectElement(); | 72 var e = new SelectElement(); |
64 Expect.isTrue(e is SelectElement); | 73 expect(e, isSelectElement); |
65 }); | 74 }); |
66 } | 75 } |
OLD | NEW |