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

Unified Diff: sky/tests/dom/inherit-from-text.sky

Issue 936193005: Make it possible to inherit from any constructable host object (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Remove extra comment Created 5 years, 10 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: sky/tests/dom/inherit-from-text.sky
diff --git a/sky/tests/dom/inherit-from-text.sky b/sky/tests/dom/inherit-from-text.sky
new file mode 100644
index 0000000000000000000000000000000000000000..ffede0634a24a9f74376284ac92d250f2cfc84a8
--- /dev/null
+++ b/sky/tests/dom/inherit-from-text.sky
@@ -0,0 +1,31 @@
+<sky>
+<script>
+import "../resources/third_party/unittest/unittest.dart";
+import "../resources/unit.dart";
+
+import "dart:sky";
+
+class CustomText extends Text {
+ CustomText() : super("awesome");
+
+ bool get isCustom => true;
+}
+
+void main() {
+ initUnit();
+
+ test("should be able to insert in DOM", () {
+ var child = new CustomText();
+ expect(child.isCustom, isTrue);
+ expect(child.parentNode, isNull);
+ expect(child.data, equals("awesome"));
+
+ var parent = document.createElement("div");
+ parent.appendChild(child);
+ expect(child.parentNode, equals(parent));
+ expect(parent.firstChild, equals(child));
+ expect(parent.firstChild.isCustom, isTrue);
+ });
+}
+</script>
+</sky>

Powered by Google App Engine
This is Rietveld 408576698