diff --git a/engine/src/flutter/tests/lowlevel/attribute-collection-expected.txt b/engine/src/flutter/tests/lowlevel/attribute-collection-expected.txt index 09e1d8f600e..58bdb96b0c8 100644 --- a/engine/src/flutter/tests/lowlevel/attribute-collection-expected.txt +++ b/engine/src/flutter/tests/lowlevel/attribute-collection-expected.txt @@ -1,10 +1,8 @@ -Running 6 tests +Running 4 tests ok 1 Attribute collection should get by index -ok 2 Attribute collection should get by name -ok 3 Attribute collection should get all at once -ok 4 Attribute collection should set by name -ok 5 Attribute collection should be case sensitive -ok 6 Attribute collection should live update -6 tests -6 pass +ok 2 Attribute collection should set by name +ok 3 Attribute collection should be case sensitive +ok 4 Attribute collection should not live update +4 tests +4 pass 0 fail diff --git a/engine/src/flutter/tests/lowlevel/attribute-collection.sky b/engine/src/flutter/tests/lowlevel/attribute-collection.sky index 33817def468..f8c6f9e3ce9 100644 --- a/engine/src/flutter/tests/lowlevel/attribute-collection.sky +++ b/engine/src/flutter/tests/lowlevel/attribute-collection.sky @@ -9,22 +9,6 @@ describe("Attribute collection", function() { }); it("should get by index", function() { - div.setAttribute("attr0", "value0"); - div.setAttribute("attr1", "value1"); - assert.equal(div.attributes.length, 2); - assert.equal(div.attributes[0].name, "attr0"); - assert.equal(div.attributes[0].value, "value0"); - assert.equal(div.attributes[1].name, "attr1"); - assert.equal(div.attributes[1].value, "value1"); - }); - it("should get by name", function() { - div.setAttribute("attr0", "value0"); - div.setAttribute("attr1", "value1"); - assert.equal(div.attributes.length, 2); - assert.equal(div.attributes.attr0.value, "value0"); - assert.equal(div.attributes.attr1.value, "value1"); - }); - it("should get all at once", function() { div.setAttribute("attr0", "value0"); div.setAttribute("attr1", "value1"); var attrs = div.getAttributes(); @@ -36,30 +20,42 @@ describe("Attribute collection", function() { }); it("should set by name", function() { div.setAttribute("attrName", "value0"); - div.attributes.attrName.value = "new value"; + assert.equal(div.getAttribute("attrName"), "value0"); + assert.equal(div.getAttributes()[0].name, "attrName"); + assert.equal(div.getAttributes()[0].value, "value0"); + div.setAttribute("attrName", "new value"); assert.equal(div.getAttribute("attrName"), "new value"); - assert.equal(div.attributes.attrName.value, "new value"); + assert.equal(div.getAttributes()[0].name, "attrName"); + assert.equal(div.getAttributes()[0].value, "new value"); }); it("should be case sensitive", function() { div.setAttribute("attrName", "value0"); - assert.isUndefined(div.attributes.attrname); - assert.ok(div.attributes.attrName); - assert.equal(div.attributes.attrName.value, "value0"); + assert.isNull(div.getAttribute("attrname")); + assert.equal(div.getAttribute("attrName"), "value0"); }); - it("should live update", function() { - div.setAttribute("attr0", ""); - div.setAttribute("attr1", ""); - div.setAttribute("attr2", ""); - assert.equal(div.attributes.length, 3); + it("should not live update", function() { + div.setAttribute("attr0", "0"); + div.setAttribute("attr1", "1"); + div.setAttribute("attr2", "2"); + var oldAttributes = div.getAttributes(); + assert.equal(oldAttributes.length, 3); div.removeAttribute("attr1"); - assert.equal(div.attributes.length, 2); - assert.equal(div.attributes[0].name, "attr0"); - assert.equal(div.attributes[1].name, "attr2"); - div.setAttribute("attr3", ""); + assert.equal(oldAttributes.length, 3); + div.setAttribute("attr0", "value0"); div.setAttribute("attr2", "value2"); - assert.equal(div.attributes.length, 3); - assert.equal(div.attributes[2].name, "attr3"); - assert.equal(div.attributes.attr2.value, "value2"); + var newAttributes = div.getAttributes(); + assert.equal(newAttributes.length, 2); + assert.equal(newAttributes[0].name, "attr0"); + assert.equal(newAttributes[0].value, "value0"); + assert.equal(newAttributes[1].name, "attr2"); + assert.equal(newAttributes[1].value, "value2"); + assert.notEqual(newAttributes, oldAttributes); + assert.equal(oldAttributes[0].name, "attr0"); + assert.equal(oldAttributes[0].value, "0"); + assert.equal(oldAttributes[1].name, "attr1"); + assert.equal(oldAttributes[1].value, "1"); + assert.equal(oldAttributes[2].name, "attr2"); + assert.equal(oldAttributes[2].value, "2"); }); }); diff --git a/engine/src/flutter/tests/mutation-observer/observe-attributes-expected.txt b/engine/src/flutter/tests/mutation-observer/observe-attributes-expected.txt index 1afd06f8e32..e66a35924f3 100644 --- a/engine/src/flutter/tests/mutation-observer/observe-attributes-expected.txt +++ b/engine/src/flutter/tests/mutation-observer/observe-attributes-expected.txt @@ -1,4 +1,4 @@ -Running 15 tests +Running 14 tests ok 1 MutationObserver.observe on attributes should handle basic aspects of attribute observation ok 2 MutationObserver.observe on attributes should not notify of attribute changes without asking ok 3 MutationObserver.observe on attributes re-observing the same node with the same observer has the effect of resetting the options @@ -13,7 +13,6 @@ ok 11 MutationObserver.observe on attributes should respect different attributeF ok 12 MutationObserver.observe on attributes should create records for the style property ok 13 MutationObserver.observe on attributes should have oldValue for style property mutations ok 14 MutationObserver.observe on attributes should not create records for noop style property mutation -ok 15 MutationObserver.observe on attributes should create records when mutating through the attribute collection -15 tests -15 pass +14 tests +14 pass 0 fail diff --git a/engine/src/flutter/tests/mutation-observer/observe-attributes.sky b/engine/src/flutter/tests/mutation-observer/observe-attributes.sky index e85651110e0..9710bf0e513 100644 --- a/engine/src/flutter/tests/mutation-observer/observe-attributes.sky +++ b/engine/src/flutter/tests/mutation-observer/observe-attributes.sky @@ -563,38 +563,6 @@ describe('MutationObserver.observe on attributes', function() { start(); }); - - it('should create records when mutating through the attribute collection', function(done) { - var observer; - var mutations; - var div; - - function start() { - observer = new MutationObserver(function(records) { - mutations = records; - }); - - div = document.createElement('div'); - div.setAttribute('data-test', 'foo'); - observer.observe(div, { attributes: true, attributeOldValue: true }); - div.attributes['data-test'].value = 'bar'; - - setTimeout(finish, 0); - } - - function finish() { - assert.equal(mutations.length, 1); - assert.equal(mutations[0].target, div); - assert.equal(mutations[0].type, "attributes"); - assert.equal(mutations[0].attributeName, "data-test"); - assert.equal(mutations[0].oldValue, "foo"); - - observer.disconnect(); - done(); - } - - start(); - }); });