| 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 library ShadowDOMTest; | 5 library ShadowDOMTest; |
| 6 import '../../pkg/unittest/lib/unittest.dart'; | 6 import '../../pkg/unittest/lib/unittest.dart'; |
| 7 import '../../pkg/unittest/lib/html_individual_config.dart'; | 7 import '../../pkg/unittest/lib/html_individual_config.dart'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 | 9 |
| 10 main() { | 10 main() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 var div1, div2, shadowRoot, paragraph1, paragraph2; | 21 var div1, div2, shadowRoot, paragraph1, paragraph2; |
| 22 | 22 |
| 23 init() { | 23 init() { |
| 24 paragraph1 = new ParagraphElement(); | 24 paragraph1 = new ParagraphElement(); |
| 25 paragraph2 = new ParagraphElement(); | 25 paragraph2 = new ParagraphElement(); |
| 26 [paragraph1, paragraph2].forEach((p) { p.classes.add('foo');}); | 26 [paragraph1, paragraph2].forEach((p) { p.classes.add('foo');}); |
| 27 div1 = new DivElement(); | 27 div1 = new DivElement(); |
| 28 div2 = new DivElement(); | 28 div2 = new DivElement(); |
| 29 div1.classes.add('foo'); | 29 div1.classes.add('foo'); |
| 30 shadowRoot = div2.createShadowRoot(); | 30 shadowRoot = div2.createShadowRoot(); |
| 31 shadowRoot.nodes.add(paragraph1); | 31 shadowRoot.append(paragraph1); |
| 32 shadowRoot.nodes.add(new ContentElement()); | 32 shadowRoot.append(new ContentElement()); |
| 33 div2.nodes.add(paragraph2); | 33 div2.append(paragraph2); |
| 34 document.body.nodes.add(div1); | 34 document.body.append(div1); |
| 35 document.body.nodes.add(div2); | 35 document.body.append(div2); |
| 36 } | 36 } |
| 37 | 37 |
| 38 var expectation = ShadowRoot.supported ? returnsNormally : throws; | 38 var expectation = ShadowRoot.supported ? returnsNormally : throws; |
| 39 | 39 |
| 40 test("Shadowed nodes aren't visible to queries from outside ShadowDOM", () { | 40 test("Shadowed nodes aren't visible to queries from outside ShadowDOM", () { |
| 41 expect(() { | 41 expect(() { |
| 42 init(); | 42 init(); |
| 43 | 43 |
| 44 expect(queryAll('.foo'), equals([div1, paragraph2])); | 44 expect(queryAll('.foo'), equals([div1, paragraph2])); |
| 45 }, expectation); | 45 }, expectation); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 61 | 61 |
| 62 test('Querying in shadowed fragment respects the shadow boundary.', () { | 62 test('Querying in shadowed fragment respects the shadow boundary.', () { |
| 63 expect(() { | 63 expect(() { |
| 64 init(); | 64 init(); |
| 65 | 65 |
| 66 expect(shadowRoot.queryAll('.foo'), equals([paragraph1])); | 66 expect(shadowRoot.queryAll('.foo'), equals([paragraph1])); |
| 67 }, expectation); | 67 }, expectation); |
| 68 }); | 68 }); |
| 69 }); | 69 }); |
| 70 } | 70 } |
| OLD | NEW |