Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 #library('ShadowDOMTest'); | |
| 6 #import('../../lib/unittest/unittest.dart'); | |
| 7 #import('../../lib/unittest/html_config.dart'); | |
| 8 #import('dart:html'); | |
| 9 | |
| 10 main() { | |
| 11 useHtmlConfiguration(); | |
| 12 | |
| 13 group('ShadowDOM tests', () { | |
| 14 | |
| 15 var div1, div2, shadowRoot, paragraph1, paragraph2; | |
| 16 | |
| 17 setUp(() { | |
| 18 paragraph1 = new ParagraphElement(); | |
| 19 paragraph2 = new ParagraphElement(); | |
| 20 [paragraph1, paragraph2].forEach( (p) { p.classes.add('foo');}); | |
|
Siggi Cherem (dart-lang)
2012/06/26 23:10:49
remove space between ( (
samhop
2012/06/26 23:16:30
Done.
| |
| 21 div1 = new DivElement(); | |
| 22 div2 = new DivElement(); | |
| 23 div1.classes.add('foo'); | |
| 24 shadowRoot = new ShadowRoot(div2); | |
| 25 shadowRoot.nodes.add(paragraph1); | |
| 26 // No constructor for ContentElement exists yet. | |
| 27 // See http://code.google.com/p/dart/issues/detail?id=3870. | |
| 28 shadowRoot.nodes.add(new Element.tag('content')); | |
| 29 div2.nodes.add(paragraph2); | |
| 30 document.body.nodes.add(div1); | |
| 31 document.body.nodes.add(div2); | |
| 32 }); | |
| 33 | |
| 34 test("Shadowed nodes aren't visible to queries from outside ShadowDOM", () { | |
| 35 expect(queryAll('.foo'), equals([div1, paragraph2])); | |
| 36 }); | |
| 37 | |
| 38 test('Parent node of a shadow root must be null.', () { | |
| 39 expect(shadowRoot.parent, isNull); | |
| 40 }); | |
| 41 | |
| 42 | |
| 43 // TODO(samhop): test that <content> and <content select="foo"> and | |
| 44 // <shadow> | |
| 45 // work properly. This is blocked on having a good way to do browser | |
| 46 // rendering tests. | |
| 47 | |
| 48 test('Querying in shadowed fragment respects the shadow boundary.', () { | |
| 49 expect(shadowRoot.queryAll('.foo'), equals([paragraph1])); | |
| 50 }); | |
| 51 }); | |
| 52 } | |
| OLD | NEW |