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

Unified Diff: sky/tests/dom/document-child-mutations.sky

Issue 1212163009: Port remaining Sky tests to the new world (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: add Created 5 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
Index: sky/tests/dom/document-child-mutations.sky
diff --git a/sky/tests/dom/document-child-mutations.sky b/sky/tests/dom/document-child-mutations.sky
deleted file mode 100644
index 1ffe1eff5c93626c9a44f5b9e82433adb6717c5f..0000000000000000000000000000000000000000
--- a/sky/tests/dom/document-child-mutations.sky
+++ /dev/null
@@ -1,108 +0,0 @@
-<sky>
-<import src="../resources/dom-utils.sky" as="DomUtils" />
-<script>
-import "../resources/third_party/unittest/unittest.dart";
-import "../resources/unit.dart";
-
-import "dart:sky";
-
-void main() {
- initUnit();
-
- var doc;
-
- var childElementCount = DomUtils.childElementCount;
- var childNodeCount = DomUtils.childNodeCount;
-
- setUp(() {
- doc = new Document();
- });
-
- test("should allow replacing the document element", () {
- var oldChild = doc.appendChild(doc.createElement("div"));
- expect(childElementCount(doc), equals(1));
- var newChild = doc.createElement("div");
- oldChild.replaceWith([newChild]);
- expect(childElementCount(doc), equals(1));
- expect(newChild.parentNode, equals(doc));
- expect(oldChild.parentNode, isNull);
- });
-
- test("should allow replacing a text child with an element", () {
- var oldChild = doc.appendChild(new Text("text here"));
- expect(childElementCount(doc), equals(0));
- expect(childNodeCount(doc), equals(1));
- var newChild = doc.createElement("div");
- oldChild.replaceWith([newChild]);
- expect(childElementCount(doc), equals(1));
- expect(childNodeCount(doc), equals(1));
- expect(newChild.parentNode, equals(doc));
- expect(oldChild.parentNode, isNull);
- });
-
- test("should allow replacing the document element with text", () {
- var oldChild = doc.appendChild(doc.createElement("div"));
- expect(childElementCount(doc), equals(1));
- var newChild = new Text(" text ");
- oldChild.replaceWith([newChild]);
- expect(childElementCount(doc), equals(0));
- expect(childNodeCount(doc), equals(1));
- expect(newChild.parentNode, equals(doc));
- expect(oldChild.parentNode, isNull);
- });
-
- test("should allow inserting text with a fragment", () {
- var fragment = doc.createDocumentFragment();
- fragment.appendChild(new Text(" text "));
- fragment.appendChild(new Text(" text "));
- expect(childNodeCount(doc), equals(0));
- doc.appendChild(fragment);
- expect(childElementCount(doc), equals(0));
- expect(childNodeCount(doc), equals(2));
- });
-
- test("should allow replacing the document element with a fragment", () {
- var oldChild = doc.appendChild(doc.createElement("div"));
- expect(childElementCount(doc), equals(1));
- var fragment = doc.createDocumentFragment();
- fragment.appendChild(new Text(" text "));
- var newChild = fragment.appendChild(doc.createElement("div"));
- fragment.appendChild(new Text(" "));
- oldChild.replaceWith([fragment]);
- expect(childElementCount(doc), equals(1));
- expect(childNodeCount(doc), equals(3));
- expect(newChild.parentNode, equals(doc));
- expect(oldChild.parentNode, isNull);
- });
-
- test("should throw when inserting multiple elements", () {
- doc.appendChild(doc.createElement("div"));
- var oldChild = doc.appendChild(new Text(" text "));
- expect(childElementCount(doc), equals(1));
- var newChild = doc.createElement("div");
- // expect(() {
- // doc.replaceChild(newChild, 0);
- // }, throws);
- // expect(() {
- // doc.insertBefore(newChild, oldChild);
- // }, throws);
- });
-
- test("should throw when inserting multiple elements with a fragment", () {
- var oldChild = doc.appendChild(doc.createElement("div"));
- expect(childElementCount(doc), equals(1));
- var fragment = doc.createDocumentFragment();
- fragment.appendChild(new Text(" text "));
- fragment.appendChild(doc.createElement("div"));
- fragment.appendChild(doc.createElement("div"));
- fragment.appendChild(new Text(" "));
- // expect(() {
- // doc.replaceChild(fragment, 0);
- // }, throws);
- // expect(() {
- // doc.insertBefore(fragment, oldChild);
- // }, throws);
- });
-}
-</script>
-</sky>
« no previous file with comments | « sky/tests/dom/attribute_collection-expected.txt ('k') | sky/tests/dom/document-child-mutations-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698