Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: tests/html/shadow_dom_test.dart

Issue 10661039: added preliminary ShadowDOM tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/html.status ('k') | tools/testing/run_selenium.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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]));
+ });
+ });
+}
« no previous file with comments | « tests/html/html.status ('k') | tools/testing/run_selenium.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698