From 1eb435091190802fec017e49a6e471a0723016cf Mon Sep 17 00:00:00 2001 From: Elliott Sprehn Date: Tue, 18 Nov 2014 16:49:48 -0800 Subject: [PATCH] Clean up child checks in ContainerNode. We can simplify the checks given that there's fewer node types now. This does make the error messages from Range a little worse, but it's weird that Range is doing its own error checking anyway. I also took this as an opportunity to add a bunch of DOM tests. R=ojan@chromium.org Review URL: https://codereview.chromium.org/732203004 --- .../tests/dom/appendChild-expected.txt | 9 ++ engine/src/flutter/tests/dom/appendChild.sky | 76 +++++++++++++ .../dom/document-child-mutations-expected.txt | 11 ++ .../tests/dom/document-child-mutations.sky | 103 ++++++++++++++++++ .../tests/dom/replaceChild-expected.txt | 10 ++ engine/src/flutter/tests/dom/replaceChild.sky | 90 +++++++++++++++ 6 files changed, 299 insertions(+) create mode 100644 engine/src/flutter/tests/dom/appendChild-expected.txt create mode 100644 engine/src/flutter/tests/dom/appendChild.sky create mode 100644 engine/src/flutter/tests/dom/document-child-mutations-expected.txt create mode 100644 engine/src/flutter/tests/dom/document-child-mutations.sky create mode 100644 engine/src/flutter/tests/dom/replaceChild-expected.txt create mode 100644 engine/src/flutter/tests/dom/replaceChild.sky diff --git a/engine/src/flutter/tests/dom/appendChild-expected.txt b/engine/src/flutter/tests/dom/appendChild-expected.txt new file mode 100644 index 0000000000..e70eefec53 --- /dev/null +++ b/engine/src/flutter/tests/dom/appendChild-expected.txt @@ -0,0 +1,9 @@ +Running 5 tests +ok 1 appendChild should throw with invalid arguments +ok 2 appendChild should insert children +ok 3 appendChild should insert children with a fragment +ok 4 appendChild should throw when inserting a tree scope +ok 5 appendChild should throw when appending to a text +5 tests +5 pass +0 fail diff --git a/engine/src/flutter/tests/dom/appendChild.sky b/engine/src/flutter/tests/dom/appendChild.sky new file mode 100644 index 0000000000..60da8036d7 --- /dev/null +++ b/engine/src/flutter/tests/dom/appendChild.sky @@ -0,0 +1,76 @@ + + + + + + \ No newline at end of file diff --git a/engine/src/flutter/tests/dom/document-child-mutations-expected.txt b/engine/src/flutter/tests/dom/document-child-mutations-expected.txt new file mode 100644 index 0000000000..7fba1ce850 --- /dev/null +++ b/engine/src/flutter/tests/dom/document-child-mutations-expected.txt @@ -0,0 +1,11 @@ +Running 7 tests +ok 1 Document should allow replacing the document element +ok 2 Document should allow replacing a text child with an element +ok 3 Document should allow replacing the document element with text +ok 4 Document should allow inserting text with a fragment +ok 5 Document should allow replacing the document element with a fragment +ok 6 Document should throw when inserting multiple elements +ok 7 Document should throw when inserting multiple elements with a fragment +7 tests +7 pass +0 fail diff --git a/engine/src/flutter/tests/dom/document-child-mutations.sky b/engine/src/flutter/tests/dom/document-child-mutations.sky new file mode 100644 index 0000000000..99e0e44098 --- /dev/null +++ b/engine/src/flutter/tests/dom/document-child-mutations.sky @@ -0,0 +1,103 @@ + + + + + + \ No newline at end of file diff --git a/engine/src/flutter/tests/dom/replaceChild-expected.txt b/engine/src/flutter/tests/dom/replaceChild-expected.txt new file mode 100644 index 0000000000..fa957b5857 --- /dev/null +++ b/engine/src/flutter/tests/dom/replaceChild-expected.txt @@ -0,0 +1,10 @@ +Running 6 tests +ok 1 replaceChild should throw with invalid arguments +ok 2 replaceChild should replace elements +ok 3 replaceChild should replace text +ok 4 replaceChild should replace children with a fragment +ok 5 replaceChild should throw when inserting a tree scope +ok 6 replaceChild should throw when appending to a text +6 tests +6 pass +0 fail diff --git a/engine/src/flutter/tests/dom/replaceChild.sky b/engine/src/flutter/tests/dom/replaceChild.sky new file mode 100644 index 0000000000..17cc7ad7bb --- /dev/null +++ b/engine/src/flutter/tests/dom/replaceChild.sky @@ -0,0 +1,90 @@ + + + + + + \ No newline at end of file