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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8ecc58a029cfc39685097ab9b9ccf4005e3978a1 |
| --- /dev/null |
| +++ b/tests/html/shadow_dom_test.dart |
| @@ -0,0 +1,52 @@ |
| +// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +#library('ShadowDOMTest'); |
| +#import('../../lib/unittest/unittest.dart'); |
| +#import('../../lib/unittest/html_config.dart'); |
| +#import('dart:html'); |
| + |
| +main() { |
| + useHtmlConfiguration(); |
| + |
| + group('ShadowDOM tests', () { |
| + |
| + var div1, div2, shadowRoot, paragraph1, paragraph2; |
| + |
| + setUp(() { |
| + paragraph1 = new ParagraphElement(); |
| + paragraph2 = new ParagraphElement(); |
| + [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.
|
| + div1 = new DivElement(); |
| + div2 = new DivElement(); |
| + div1.classes.add('foo'); |
| + shadowRoot = new ShadowRoot(div2); |
| + 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')); |
| + div2.nodes.add(paragraph2); |
| + document.body.nodes.add(div1); |
| + document.body.nodes.add(div2); |
| + }); |
| + |
| + test("Shadowed nodes aren't visible to queries from outside ShadowDOM", () { |
| + expect(queryAll('.foo'), equals([div1, paragraph2])); |
| + }); |
| + |
| + test('Parent node of a shadow root must be null.', () { |
| + expect(shadowRoot.parent, isNull); |
| + }); |
| + |
| + |
| + // TODO(samhop): test that <content> and <content select="foo"> and |
| + // <shadow> |
| + // work properly. This is blocked on having a good way to do browser |
| + // rendering tests. |
| + |
| + test('Querying in shadowed fragment respects the shadow boundary.', () { |
| + expect(shadowRoot.queryAll('.foo'), equals([paragraph1])); |
| + }); |
| + }); |
| +} |