diff --git a/engine/src/flutter/tests/dom/document-child-mutations.sky b/engine/src/flutter/tests/dom/document-child-mutations.sky index 7aecd2b9a2..1ffe1eff5c 100644 --- a/engine/src/flutter/tests/dom/document-child-mutations.sky +++ b/engine/src/flutter/tests/dom/document-child-mutations.sky @@ -22,7 +22,7 @@ void main() { var oldChild = doc.appendChild(doc.createElement("div")); expect(childElementCount(doc), equals(1)); var newChild = doc.createElement("div"); - doc.replaceChild(newChild, oldChild); + oldChild.replaceWith([newChild]); expect(childElementCount(doc), equals(1)); expect(newChild.parentNode, equals(doc)); expect(oldChild.parentNode, isNull); @@ -33,7 +33,7 @@ void main() { expect(childElementCount(doc), equals(0)); expect(childNodeCount(doc), equals(1)); var newChild = doc.createElement("div"); - doc.replaceChild(newChild, oldChild); + oldChild.replaceWith([newChild]); expect(childElementCount(doc), equals(1)); expect(childNodeCount(doc), equals(1)); expect(newChild.parentNode, equals(doc)); @@ -44,7 +44,7 @@ void main() { var oldChild = doc.appendChild(doc.createElement("div")); expect(childElementCount(doc), equals(1)); var newChild = new Text(" text "); - doc.replaceChild(newChild, oldChild); + oldChild.replaceWith([newChild]); expect(childElementCount(doc), equals(0)); expect(childNodeCount(doc), equals(1)); expect(newChild.parentNode, equals(doc)); @@ -68,7 +68,7 @@ void main() { fragment.appendChild(new Text(" text ")); var newChild = fragment.appendChild(doc.createElement("div")); fragment.appendChild(new Text(" ")); - doc.replaceChild(fragment, oldChild); + oldChild.replaceWith([fragment]); expect(childElementCount(doc), equals(1)); expect(childNodeCount(doc), equals(3)); expect(newChild.parentNode, equals(doc)); diff --git a/engine/src/flutter/tests/dom/ownerScope.sky b/engine/src/flutter/tests/dom/ownerScope.sky index d579379000..fb163b55aa 100644 --- a/engine/src/flutter/tests/dom/ownerScope.sky +++ b/engine/src/flutter/tests/dom/ownerScope.sky @@ -11,14 +11,13 @@ void main() { test("should return null for elements not a child of a scope", () { var doc = new Document(); var element = doc.createElement("div"); - expect(element.ownerScope, isNull); + expect(element.owner, isNull); }); test("should return the document for elements in the document scope", () { var doc = new Document(); var element = doc.createElement("div"); doc.appendChild(element); - expect(element.ownerScope, equals(element.ownerDocument)); - expect(element.ownerScope, equals(doc)); + expect(element.owner, equals(doc)); }); test("should return the shadow root for elements in the shadow root scope", () { var doc = new Document(); @@ -26,26 +25,26 @@ void main() { var child = doc.createElement("div"); var shadowRoot = host.ensureShadowRoot(); shadowRoot.appendChild(child); - expect(child.ownerScope, equals(shadowRoot)); + expect(child.owner, equals(shadowRoot)); }); test("should return self for a shadow root or document", () { var doc = new Document(); var host = doc.createElement("div"); doc.appendChild(host); var shadowRoot = host.ensureShadowRoot(); - expect(shadowRoot.ownerScope, equals(shadowRoot)); - expect(doc.ownerScope, equals(doc)); + expect(shadowRoot.owner, equals(shadowRoot)); + expect(doc.owner, equals(doc)); }); test("should dynamically update", () { var doc = new Document(); var host = doc.createElement("div"); var child = doc.createElement("div"); var shadowRoot = host.ensureShadowRoot(); - expect(child.ownerScope, isNull); + expect(child.owner, isNull); shadowRoot.appendChild(child); - expect(child.ownerScope, equals(shadowRoot)); + expect(child.owner, equals(shadowRoot)); child.remove(); - expect(child.ownerScope, isNull); + expect(child.owner, isNull); }); } diff --git a/engine/src/flutter/tests/dom/replaceChild-expected.txt b/engine/src/flutter/tests/dom/replaceChild-expected.txt index 41f5ebc94c..21a0cce431 100644 --- a/engine/src/flutter/tests/dom/replaceChild-expected.txt +++ b/engine/src/flutter/tests/dom/replaceChild-expected.txt @@ -1,9 +1,8 @@ CONSOLE: unittest-suite-wait-for-done -CONSOLE: PASS: should throw with invalid arguments CONSOLE: PASS: should replace elements CONSOLE: PASS: should replace text CONSOLE: PASS: should replace children with a fragment CONSOLE: -CONSOLE: All 4 tests passed. +CONSOLE: All 3 tests passed. CONSOLE: unittest-suite-success DONE diff --git a/engine/src/flutter/tests/dom/replaceChild.sky b/engine/src/flutter/tests/dom/replaceChild.sky index e1ecef4213..8342eda84d 100644 --- a/engine/src/flutter/tests/dom/replaceChild.sky +++ b/engine/src/flutter/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)); diff --git a/engine/src/flutter/tests/editing/delete_block_contents.sky b/engine/src/flutter/tests/editing/delete_block_contents.sky index 8552e9d1e6..d7c041a68d 100644 --- a/engine/src/flutter/tests/editing/delete_block_contents.sky +++ b/engine/src/flutter/tests/editing/delete_block_contents.sky @@ -20,9 +20,7 @@ void main() { d.appendChild(new Text('bbb')); var newHeight = elem.offsetHeight; - while (elem.firstChild != null) { - elem.removeChild(elem.firstChild); - } + elem.removeChildren(); new Timer(Duration.ZERO, expectAsync(() { expect(elem.offsetHeight, equals(originalHeight)); diff --git a/engine/src/flutter/tests/lowlevel/bug-438036.sky b/engine/src/flutter/tests/lowlevel/bug-438036.sky index 35f7815ea8..d18c7dd0d5 100644 --- a/engine/src/flutter/tests/lowlevel/bug-438036.sky +++ b/engine/src/flutter/tests/lowlevel/bug-438036.sky @@ -26,7 +26,7 @@ void main() { test("should grow height to 200px", () { var target = document.querySelectorAll('div').item(1); - target.id = 'high'; + target.setAttribute("id", "high"); expect(window.getComputedStyle(target).getPropertyValue("height"), equals("200px")); }); diff --git a/engine/src/flutter/tests/lowlevel/query-selector.sky b/engine/src/flutter/tests/lowlevel/query-selector.sky index 64cf473d03..502a798fc5 100644 --- a/engine/src/flutter/tests/lowlevel/query-selector.sky +++ b/engine/src/flutter/tests/lowlevel/query-selector.sky @@ -36,13 +36,13 @@ main() { test("should find elements by id", () { expect(query("#id5"), isNotNull); - expect(query("#id5").id, equals("id5")); + expect(query("#id5").getAttribute("id"), equals("id5")); expect(query("#id5").classList.toString(), equals("class5")); // FIXME(sky): Do we still want to allow multiple id stuff like this? expect(queryAll("#id5").length, equals(2)); expect(queryAll("#id5").item(0), equals(query("#id5"))); expect(queryAll("#id5").item(1), isNot(equals(query("#id5")))); - expect(queryAll("#id5").item(1).id, equals("id5")); + expect(queryAll("#id5").item(1).getAttribute("id"), equals("id5")); }); test("should find elements by tag name", () { @@ -55,7 +55,7 @@ main() { test("should find an element by compound selector", () { expect(query("tag-name-6.class6#id6"), isNotNull); - expect(query("tag-name-6.class6#id6").id, equals("id6")); + expect(query("tag-name-6.class6#id6").getAttribute("id"), equals("id6")); expect(query("tag-name-6.class6#id6").classList.toString(), equals("class6")); expect(query("tag-name-6.class6#id6").tagName, equals("tag-name-6")); }); @@ -63,21 +63,21 @@ main() { test("should find all elements by compound selector", () { expect(queryAll("tag-name-3.class7"), isNotNull); expect(queryAll("tag-name-3.class7").length, equals(3)); - expect(queryAll("tag-name-3.class7").item(0).id, equals("tag1")); - expect(queryAll("tag-name-3.class7").item(1).id, equals("tag2")); + expect(queryAll("tag-name-3.class7").item(0).getAttribute("id"), equals("tag1")); + expect(queryAll("tag-name-3.class7").item(1).getAttribute("id"), equals("tag2")); }); test("should find all elements by attribute presence selector", () { expect(queryAll("[testAttr]"), isNotNull); expect(queryAll("[testAttr]").length, equals(2)); - expect(queryAll("[testAttr]").item(0).id, equals("id5")); - expect(queryAll("[testAttr]").item(1).id, equals("id6")); + expect(queryAll("[testAttr]").item(0).getAttribute("id"), equals("id5")); + expect(queryAll("[testAttr]").item(1).getAttribute("id"), equals("id6")); }); test("should find all elements by attribute value selector", () { expect(queryAll("[testAttr='the value']"), isNotNull); expect(queryAll("[testAttr='the value']").length, equals(1)); - expect(queryAll("[testAttr='the value']").item(0).id, equals("id6")); + expect(queryAll("[testAttr='the value']").item(0).getAttribute("id"), equals("id6")); }); } diff --git a/engine/src/flutter/tests/lowlevel/style-basic-expected.txt b/engine/src/flutter/tests/lowlevel/style-basic-expected.txt index ad806cfe0c..6f86aef35e 100644 --- a/engine/src/flutter/tests/lowlevel/style-basic-expected.txt +++ b/engine/src/flutter/tests/lowlevel/style-basic-expected.txt @@ -1,6 +1,6 @@ PASS:
order was 1 -PASS:
order was 2 -PASS: order was 3 -PASS:
order was 4 +PASS:
order was 2 +PASS: order was 3 +PASS:
order was 4 PASS:
order was 5 PASS: order was 6 diff --git a/engine/src/flutter/tests/lowlevel/style-basic.sky b/engine/src/flutter/tests/lowlevel/style-basic.sky index 154dcc8d4d..fdf6b93168 100644 --- a/engine/src/flutter/tests/lowlevel/style-basic.sky +++ b/engine/src/flutter/tests/lowlevel/style-basic.sky @@ -26,7 +26,7 @@ var tests = document.getElementById("tests"); var log = document.getElementById("log"); var i = 1; - for (var element = tests.firstElementChild; element != null; element = element.nextElementSibling) { + for (Element element = tests.firstElementChild; element != null; element = element.nextElementSibling) { var order = int.parse(window.getComputedStyle(element).getPropertyValue("order")); var div = document.createElement("div"); var text = (order == i) ? "PASS" : "FAIL"; @@ -34,7 +34,7 @@ + element.tagName + " class=" + element.classList.toString() - + " id=" + element.id + + " id=" + element.getAttribute("id").toString() + "> order was " + order.toString(); if (order != i)