| Index: sky/tests/lowlevel/attribute-collection.sky
|
| diff --git a/sky/tests/lowlevel/attribute-collection.sky b/sky/tests/lowlevel/attribute-collection.sky
|
| index 33817def468511ba56d1c8a6b9bba474010bf15f..f8c6f9e3ce9f8cb55abf0dcb47637bef71793521 100644
|
| --- a/sky/tests/lowlevel/attribute-collection.sky
|
| +++ b/sky/tests/lowlevel/attribute-collection.sky
|
| @@ -11,22 +11,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();
|
| assert.equal(attrs.length, 2);
|
| assert.equal(attrs[0].name, "attr0");
|
| @@ -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");
|
| });
|
| });
|
| </script>
|
|
|