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

Unified Diff: tests/html/shadow_dom_layout_test.dart

Issue 10690052: added shadow dom layout test (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') | tests/html/shadow_dom_layout_test.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/shadow_dom_layout_test.dart
diff --git a/tests/html/shadow_dom_layout_test.dart b/tests/html/shadow_dom_layout_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..393355e817c5afdc2b523209ff4a404e899863b8
--- /dev/null
+++ b/tests/html/shadow_dom_layout_test.dart
@@ -0,0 +1,35 @@
+// 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('dart:html');
+
+// Test that children of a shadow host get distributed properly to the
+// insertion points of a shadow subtree. Output should be three boxes,
+// ordered blue, red, green down the page.
+main() {
+ var div = new DivElement();
+ document.body.elements.add(div);
+
+ // build some DOM elements
+ var bluebox = _colorBox('blue', 40, 20);
+ bluebox.classes.add('foo');
+ var redbox = _colorBox('red', 30, 30);
+ var greenbox = _colorBox('green', 60, 10);
+
+ // assemble DOM
+ var sr = new ShadowRoot(div);
Siggi Cherem (dart-lang) 2012/06/29 20:20:38 following jacob's comment from the other CL, maybe
samhop 2012/06/29 20:25:12 Done.
+ sr.nodes.add(new Element.html('<content select=".foo"></content>'));
+ sr.nodes.add(redbox);
+ sr.nodes.add(new Element.tag('content'));
+ div.nodes.add(bluebox);
Siggi Cherem (dart-lang) 2012/06/29 20:20:38 maybe add an empty line above this to see the divi
samhop 2012/06/29 20:25:12 Done.
+ div.nodes.add(greenbox);
+}
+
+DivElement _colorBox(String color, int width, int height) {
+ var style = ('background-color:$color; '
+ 'width:${width}px; height:${height}px;');
+ return new Element.html('<div style="$style"></div>');
+}
« no previous file with comments | « tests/html/html.status ('k') | tests/html/shadow_dom_layout_test.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698