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

Unified Diff: sky/tests/dom/replaceChild.sky

Issue 924203002: Morph the APIs for Node, ParentNode, and Element closer to the specs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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/replaceChild.sky
diff --git a/sky/tests/dom/replaceChild.sky b/sky/tests/dom/replaceChild.sky
index e1ecef42130d5cf7fb783acfaeb8e7e95cd77094..8342eda84da05a9d9c68445a959443478b7c0a51 100644
--- a/sky/tests/dom/replaceChild.sky
+++ b/sky/tests/dom/replaceChild.sky
@@ -12,30 +12,11 @@ void main() {
var childElementCount = DomUtils.childElementCount;
var childNodeCount = DomUtils.childNodeCount;
- test("should throw with invalid arguments", () {
- var parent = document.createElement("div");
- expect(() {
- parent.replaceChild();
- }, throws);
- // expect(() {
- // parent.replaceChild(null, null);
- // }, throws);
- expect(() {
- parent.replaceChild({tagName: "div"});
- }, throws);
- // expect(() {
- // parent.replaceChild(null, document.createElement("div"));
- // }, throws);
- expect(() {
- parent.replaceChild(document.createElement("div"), {tagName: "div"});
- }, throws);
- });
-
test("should replace elements", () {
var parent = document.createElement("div");
var oldChild = parent.appendChild(document.createElement("div"));
var newChild = document.createElement("div");
- parent.replaceChild(newChild, oldChild);
+ oldChild.replaceWith([newChild]);
expect(oldChild.parentNode, isNull);
expect(newChild.parentNode, equals(parent));
});
@@ -44,7 +25,7 @@ void main() {
var parent = document.createElement("div");
var oldChild = parent.appendChild(new Text(" it's a text "));
var newChild = document.createElement("div");
- parent.replaceChild(newChild, oldChild);
+ oldChild.replaceWith([newChild]);
expect(oldChild.parentNode, isNull);
expect(newChild.parentNode, equals(parent));
});
@@ -58,7 +39,7 @@ void main() {
var parent = document.createElement("div");
var oldChild = parent.appendChild(document.createElement("div"));
var lastChild = parent.appendChild(document.createElement("div"));
- parent.replaceChild(fragment, oldChild);
+ oldChild.replaceWith([fragment]);
expect(child1.parentNode, equals(parent));
expect(child2.parentNode, equals(parent));
expect(child3.parentNode, equals(parent));

Powered by Google App Engine
This is Rietveld 408576698