From: dhrname Date: Sun, 8 Dec 2013 14:28:28 +0000 (+0900) Subject: setAttributeNodeNSメソッドに関するスペックを追加 X-Git-Tag: v16beta~166 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=21e1b688e564e22a992f82f3c64e6940bd2d44e5;p=sie%2Fsie.git setAttributeNodeNSメソッドに関するスペックを追加 --- diff --git a/tool/Spec/spec/SvgDomSpec.js b/tool/Spec/spec/SvgDomSpec.js index 1dbb92a..4b32b58 100644 --- a/tool/Spec/spec/SvgDomSpec.js +++ b/tool/Spec/spec/SvgDomSpec.js @@ -1952,28 +1952,77 @@ describe("SVG Spec in JavaScript", function() { expect(s.nodeType).toEqual( /*Node.ELEMENT_NODE*/ 1); expect(s.nodeValue).toBeNull(); expect(t.nodeType).toEqual( /*Node.ELEMENT_NODE*/ 1); - expect(t.nodeValue).toBeNull(); + expect(t.nodeValue).toBeNull(); + expect(s.attributes.length).toEqual(0); }); - /*insertBeforeメソッドの境界条件を調べておく (limit value analysis, when it calls a insertBefore method)*/ - it("should be this for the value, when it calls a insertBefore method (limit value analysis)", function() { - }); - /*getElementsByTagNameNSメソッドの同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/ - it("should be this for the value, when it calls a getElementsByTagNameNS method (the valid partion)", function() { - }); - /*getElementsByTagNameNSメソッドの同値分割をして、無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/ - it("should be this for the value, when it calls a getElementsByTagNameNS method (the invalid partion)", function() { + /*setAttributeNodeNSメソッドの境界条件を調べておく (limit value analysis, when it calls a setAttributeNodeNS method)*/ + it("should be this for the value, when it calls a setAttributeNodeNS method (limit value analysis)", function() { + expect(function() { + s.setAttributeNodeNS(); + }).toThrow(); + var attr = s.ownerDocument.createAttributeNS(null, "h"), + sat = s.attributes; + s.setAttributeNodeNS(attr); + expect(sat.length).toEqual(1); + expect(sat.getNamedItemNS(null, "h")).toBe(attr); + /*同じことを繰り返して試行処理*/ + s.setAttributeNodeNS(attr); + expect(sat.length).toEqual(1); + expect(sat.getNamedItemNS(null, "h")).toBe(attr); + attr = s.ownerDocument.createAttributeNS("urn:wo", "h"); + s.setAttributeNodeNS(attr); + expect(sat.length).toEqual(2); + expect(sat.getNamedItemNS("urn:", "h")).toBeNull(); + }); + /*setAttributeNodeNSメソッドの同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/ + it("should be this for the value, when it calls a setAttributeNodeNS method (the valid partion)", function() { + for (var i=0;i<10;++i) { + var attr = s.ownerDocument.createAttributeNS(null, "h"), + sat = s.attributes; + s.setAttributeNodeNS(attr); + } + expect(sat.length).toEqual(1); + expect(sat.getNamedItemNS(null, "h")).toBe(attr); + for (var i=0;i<10;++i) { + attr = s.ownerDocument.createAttributeNS("urn:" +i+ "o", "h"); + s.setAttributeNodeNS(attr); + } + expect(sat.length).toEqual(11); + expect(sat.getNamedItemNS("urn:9o", "h")).toBe(attr); + + attr = s.ownerDocument.createAttributeNS("urn:wo", "0"); + s.setAttributeNodeNS(attr); + expect(sat.getNamedItemNS("urn:wo", "0")).toBe(attr); + }); + /*setAttributeNodeNSメソッドの同値分割をして、無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/ + it("should be this for the value, when it calls a setAttributeNodeNS method (the invalid partion)", function() { + var attr = s.ownerDocument.createAttributeNS(null, "h"), + sat = s.attributes; + s.setAttributeNodeNS(attr); + expect(function() { + /*すでに使われている属性ノードを別の要素に移した場合はエラー*/ + t.setAttrributeNodeNS(attr); + }).toThrow(); + + attr = s.ownerDocument.implementation + .createDocument("http://www.w3.org/svg/2000", "svg") + .createAttributeNS("urn:", "h"); + expect(function() { + /*別の文書ノードに属する属性ノードを設定した場合はエラー*/ + t.setAttrributeNodeNS(attr); + }).toThrow(); }); - /*insertBeforeメソッドの境界条件を調べておく (limit value analysis, when it calls a insertBefore method)*/ - it("should be this for the value, when it calls a insertBefore method (limit value analysis)", function() { + /*hasAttributeNSメソッドの境界条件を調べておく (limit value analysis, when it calls a insertBefore method)*/ + it("should be this for the value, when it calls a hasAttributeNS method (limit value analysis)", function() { }); - /*getElementsByTagNameNSメソッドの同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/ - it("should be this for the value, when it calls a getElementsByTagNameNS method (the valid partion)", function() { + /*hasAttributeNSメソッドの同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/ + it("should be this for the value, when it calls a hasAttributeNS method (the valid partion)", function() { }); - /*getElementsByTagNameNSメソッドの同値分割をして、無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/ - it("should be this for the value, when it calls a getElementsByTagNameNS method (the invalid partion)", function() { + /*hasAttributeNSメソッドの同値分割をして、無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/ + it("should be this for the value, when it calls a hasAttributeNS method (the invalid partion)", function() { }); }); }); \ No newline at end of file