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

Unified Diff: tests/html/shadow_dom_test.dart

Issue 11748003: Fixing up WebComponents types & tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 12 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
Index: tests/html/shadow_dom_test.dart
diff --git a/tests/html/shadow_dom_test.dart b/tests/html/shadow_dom_test.dart
index 42c25516f3a8ef2d3d7043b9ad0a626278db6e67..12963eca3b0df385744df2cc8a5f0cdecb8d614c 100644
--- a/tests/html/shadow_dom_test.dart
+++ b/tests/html/shadow_dom_test.dart
@@ -10,33 +10,47 @@ import 'dart:html';
main() {
useHtmlConfiguration();
+ group('supported', () {
+ test('supported', () {
+ expect(ShadowRoot.supported, true);
+ });
+ });
+
group('ShadowDOM tests', () {
var div1, div2, shadowRoot, paragraph1, paragraph2;
- setUp(() {
+ init() {
paragraph1 = new ParagraphElement();
paragraph2 = new ParagraphElement();
[paragraph1, paragraph2].forEach((p) { p.classes.add('foo');});
div1 = new DivElement();
div2 = new DivElement();
div1.classes.add('foo');
- shadowRoot = div2.webkitCreateShadowRoot();
+ shadowRoot = div2.createShadowRoot();
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'));
+ shadowRoot.nodes.add(new ContentElement());
div2.nodes.add(paragraph2);
document.body.nodes.add(div1);
document.body.nodes.add(div2);
- });
+ }
+
+ var expectation = ShadowRoot.supported ? returnsNormally : throws;
test("Shadowed nodes aren't visible to queries from outside ShadowDOM", () {
- expect(queryAll('.foo'), equals([div1, paragraph2]));
+ expect(() {
+ init();
+
Emily Fortuna 2013/01/02 18:54:04 probably don't need the extra newlines here
+ expect(queryAll('.foo'), equals([div1, paragraph2]));
+ }, expectation);
});
test('Parent node of a shadow root must be null.', () {
- expect(shadowRoot.parent, isNull);
+ expect(() {
+ init();
+
+ expect(shadowRoot.parent, isNull);
+ }, expectation);
});
@@ -46,7 +60,11 @@ main() {
// rendering tests.
test('Querying in shadowed fragment respects the shadow boundary.', () {
- expect(shadowRoot.queryAll('.foo'), equals([paragraph1]));
+ expect(() {
+ init();
+
+ expect(shadowRoot.queryAll('.foo'), equals([paragraph1]));
+ }, expectation);
});
});
}

Powered by Google App Engine
This is Rietveld 408576698