From dc0521fb435a0b2f03644db84b28622779f96776 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 30 Oct 2014 13:55:59 -0700 Subject: [PATCH] Add support for Element#getAttributes As described in //sky/specs/apis.md R=esprehn@chromium.org Review URL: https://codereview.chromium.org/691893002 --- .../lowlevel/attribute-collection-expected.txt | 13 +++++++------ .../flutter/tests/lowlevel/attribute-collection.sky | 10 ++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/engine/src/flutter/tests/lowlevel/attribute-collection-expected.txt b/engine/src/flutter/tests/lowlevel/attribute-collection-expected.txt index 7ddea59e80..09e1d8f600 100644 --- a/engine/src/flutter/tests/lowlevel/attribute-collection-expected.txt +++ b/engine/src/flutter/tests/lowlevel/attribute-collection-expected.txt @@ -1,9 +1,10 @@ -Running 5 tests +Running 6 tests ok 1 Attribute collection should get by index ok 2 Attribute collection should get by name -ok 3 Attribute collection should set by name -ok 4 Attribute collection should be case sensitive -ok 5 Attribute collection should live update -5 tests -5 pass +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 0 fail diff --git a/engine/src/flutter/tests/lowlevel/attribute-collection.sky b/engine/src/flutter/tests/lowlevel/attribute-collection.sky index c6380e0d59..33817def46 100644 --- a/engine/src/flutter/tests/lowlevel/attribute-collection.sky +++ b/engine/src/flutter/tests/lowlevel/attribute-collection.sky @@ -24,6 +24,16 @@ describe("Attribute collection", function() { 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(); + assert.equal(attrs.length, 2); + assert.equal(attrs[0].name, "attr0"); + assert.equal(attrs[0].value, "value0"); + assert.equal(attrs[1].name, "attr1"); + assert.equal(attrs[1].value, "value1"); + }); it("should set by name", function() { div.setAttribute("attrName", "value0"); div.attributes.attrName.value = "new value";