OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 element_types_constructors2_test; | 5 library element_types_constructors2_test; |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'package:unittest/html_individual_config.dart'; | 8 import 'package:unittest/html_individual_config.dart'; |
9 import 'dart:html'; | 9 import 'dart:html'; |
10 | 10 |
11 main() { | 11 main() { |
12 useHtmlIndividualConfiguration(); | 12 useHtmlIndividualConfiguration(); |
13 | 13 |
14 check(String name, bool fn(), [bool supported = true]) { | 14 check(String name, bool fn(), [bool supported = true]) { |
15 test(name, () { | 15 test(name, () { |
16 var expectation = supported ? returnsNormally : throws; | 16 var expectation = supported ? returnsNormally : throws; |
17 expect(() { | 17 expect(() { |
18 expect(fn(), isTrue); | 18 expect(fn(), isTrue); |
19 }, expectation); | 19 }, expectation); |
20 }); | 20 }); |
21 } | 21 } |
22 | 22 |
23 check('fieldset', () => new FieldSetElement() is FieldSetElement); | 23 group('constructors', () { |
24 check('form', () => new FormElement() is FormElement); | 24 check('fieldset', () => new FieldSetElement() is FieldSetElement); |
25 check('head', () => new HeadElement() is HeadElement); | 25 check('form', () => new FormElement() is FormElement); |
26 check('hr', () => new HRElement() is HRElement); | 26 check('head', () => new HeadElement() is HeadElement); |
27 check('html', () => new HtmlHtmlElement() is HtmlHtmlElement); | 27 check('hr', () => new HRElement() is HRElement); |
28 check('h1', () => new HeadingElement.h1() is HeadingElement); | 28 check('html', () => new HtmlHtmlElement() is HtmlHtmlElement); |
29 check('h2', () => new HeadingElement.h2() is HeadingElement); | 29 check('h1', () => new HeadingElement.h1() is HeadingElement); |
30 check('h3', () => new HeadingElement.h3() is HeadingElement); | 30 check('h2', () => new HeadingElement.h2() is HeadingElement); |
31 check('h4', () => new HeadingElement.h4() is HeadingElement); | 31 check('h3', () => new HeadingElement.h3() is HeadingElement); |
32 check('h5', () => new HeadingElement.h5() is HeadingElement); | 32 check('h4', () => new HeadingElement.h4() is HeadingElement); |
33 check('h6', () => new HeadingElement.h6() is HeadingElement); | 33 check('h5', () => new HeadingElement.h5() is HeadingElement); |
34 check('iframe', () => new IFrameElement() is IFrameElement); | 34 check('h6', () => new HeadingElement.h6() is HeadingElement); |
35 check('img', () => new ImageElement() is ImageElement); | 35 check('iframe', () => new IFrameElement() is IFrameElement); |
36 check('input', () => new InputElement() is InputElement); | 36 check('img', () => new ImageElement() is ImageElement); |
37 check('keygen', | 37 check('input', () => new InputElement() is InputElement); |
38 () => new KeygenElement() is KeygenElement, KeygenElement.supported); | 38 check('keygen', |
| 39 () => new KeygenElement() is KeygenElement, KeygenElement.supported); |
| 40 }); |
39 } | 41 } |
OLD | NEW |