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

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 | « no previous file | no next file » | 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..56c0a5876915df96387920ec16ff57630a7bc533
--- /dev/null
+++ b/tests/html/shadow_dom_test.dart
@@ -0,0 +1,63 @@
+#library('ShadowDOMTest');
Siggi Cherem (dart-lang) 2012/06/25 22:16:00 + copyright notice at the top
samhop 2012/06/26 00:19:15 Done.
+#import('../../lib/unittest/unittest.dart');
+#import('../../lib/unittest/html_config.dart');
+#import('dart:html');
+
+main() {
+ useHtmlConfiguration();
+
+ test('Should be able to make a new ShadowRoot.',
+ () {
Siggi Cherem (dart-lang) 2012/06/25 22:16:00 style nit: move the '() {' to the previous line. T
samhop 2012/06/26 00:19:15 Done.
+ var div1 = new DivElement();
+ var sr = new ShadowRoot(div1);
+ document.body.nodes.add(div1);
+ expect(sr, isNotNull);
Jacob 2012/06/25 21:53:11 why would this be null?
samhop 2012/06/26 00:19:15 At one point I thought that was the failure behavi
+ });
+
+ group('ShadowDOM tests', () {
+
+ var div1, div2, sr;
+
+ setUp(() {
+ div1 = new DivElement();
+ div2 = new DivElement();
+ div1.classes.add('foo');
+ sr = new ShadowRoot(div2);
+ sr.nodes.add(new Element.html('<p class="foo"></p>'));
Jacob 2012/06/25 21:53:11 be consistent about creating elements using Elemen
samhop 2012/06/26 00:19:15 Done.
+ sr.nodes.add(new Element.tag('content'));
+ div2.nodes.add(new Element.html('<p class="foo"></p>'));
+ document.body.nodes.add(div1);
+ document.body.nodes.add(div2);
+ });
+
+ test('''
+ nodes in a shadow DOM subtree are not accessible using selectors from
Jacob 2012/06/25 21:53:11 use a shorter test case name.
samhop 2012/06/26 00:19:15 Done.
+ outside that shadow DOM subtree
+ ''',
+ () {
+ expect(queryAll('.foo').length, 2);
Siggi Cherem (dart-lang) 2012/06/25 22:16:00 it might be good to validate which elements are th
samhop 2012/06/26 00:19:15 Done.
+ });
+
+ test('Parent node of a shadow root must be null.',
+ () {
Siggi Cherem (dart-lang) 2012/06/25 22:16:00 nit: join with prev line
samhop 2012/06/26 00:19:15 Done.
+ sr = new ShadowRoot(div2);
+ expect(sr, isNotNull);
Jacob 2012/06/25 21:53:11 how is this testing that the parent node of a shad
samhop 2012/06/26 00:19:15 How embarrassing :p. Fixed. On 2012/06/25 21:53:1
+ });
+
+
+ // 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 on a selector from within a shadowed fragment does not return
+ elements outside the shadowed fragment (lower boundary is
+ encapsulated) and shadowed nodes are accessible by querying from
+ within the shadowed fragment.
Siggi Cherem (dart-lang) 2012/06/25 22:16:00 same comment from jacob here. Ideally a 1-line. If
samhop 2012/06/26 00:19:15 Done.
+ ''',
+ () {
+ expect(sr.queryAll('.foo').length, 1);
Siggi Cherem (dart-lang) 2012/06/25 22:16:00 similarly to the other test: it would be good to c
samhop 2012/06/26 00:19:15 Done.
+ });
+ });
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698