Chromium Code Reviews| Index: tests/html/shadow_dom_test.dart |
| diff --git a/tests/html/shadow_dom_test.dart b/tests/html/shadow_dom_test.dart |
| index 42c25516f3a8ef2d3d7043b9ad0a626278db6e67..12963eca3b0df385744df2cc8a5f0cdecb8d614c 100644 |
| --- a/tests/html/shadow_dom_test.dart |
| +++ b/tests/html/shadow_dom_test.dart |
| @@ -10,33 +10,47 @@ import 'dart:html'; |
| main() { |
| useHtmlConfiguration(); |
| + group('supported', () { |
| + test('supported', () { |
| + expect(ShadowRoot.supported, true); |
| + }); |
| + }); |
| + |
| group('ShadowDOM tests', () { |
| var div1, div2, shadowRoot, paragraph1, paragraph2; |
| - setUp(() { |
| + init() { |
| paragraph1 = new ParagraphElement(); |
| paragraph2 = new ParagraphElement(); |
| [paragraph1, paragraph2].forEach((p) { p.classes.add('foo');}); |
| div1 = new DivElement(); |
| div2 = new DivElement(); |
| div1.classes.add('foo'); |
| - shadowRoot = div2.webkitCreateShadowRoot(); |
| + shadowRoot = div2.createShadowRoot(); |
| shadowRoot.nodes.add(paragraph1); |
| - // No constructor for ContentElement exists yet. |
| - // See http://code.google.com/p/dart/issues/detail?id=3870. |
| - shadowRoot.nodes.add(new Element.tag('content')); |
| + shadowRoot.nodes.add(new ContentElement()); |
| div2.nodes.add(paragraph2); |
| document.body.nodes.add(div1); |
| document.body.nodes.add(div2); |
| - }); |
| + } |
| + |
| + var expectation = ShadowRoot.supported ? returnsNormally : throws; |
| test("Shadowed nodes aren't visible to queries from outside ShadowDOM", () { |
| - expect(queryAll('.foo'), equals([div1, paragraph2])); |
| + expect(() { |
| + init(); |
| + |
|
Emily Fortuna
2013/01/02 18:54:04
probably don't need the extra newlines here
|
| + expect(queryAll('.foo'), equals([div1, paragraph2])); |
| + }, expectation); |
| }); |
| test('Parent node of a shadow root must be null.', () { |
| - expect(shadowRoot.parent, isNull); |
| + expect(() { |
| + init(); |
| + |
| + expect(shadowRoot.parent, isNull); |
| + }, expectation); |
| }); |
| @@ -46,7 +60,11 @@ main() { |
| // rendering tests. |
| test('Querying in shadowed fragment respects the shadow boundary.', () { |
| - expect(shadowRoot.queryAll('.foo'), equals([paragraph1])); |
| + expect(() { |
| + init(); |
| + |
| + expect(shadowRoot.queryAll('.foo'), equals([paragraph1])); |
| + }, expectation); |
| }); |
| }); |
| } |