OSDN Git Service

Modify the init method
authordhrname <dhrname@users.sourceforge.jp>
Thu, 14 May 2015 13:20:27 +0000 (22:20 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Thu, 14 May 2015 13:20:27 +0000 (22:20 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 50d5824..c6edb23 100644 (file)
@@ -692,7 +692,7 @@ base("$calcMode").up("$attribute").mix( {
 \r
   /*引数で指定した要素 ele の属性を解析して、フレームに追加する*/\r
   push: function(/*Element Node*/ ele) {\r
-    if (!ele) {\r
+    if (!ele || !ele.hasAttribute) {\r
       return null;\r
     }\r
     this.element = ele.parentNode || null;\r
@@ -834,7 +834,7 @@ base("$calcMode").up("$attribute").mix( {
 \r
   init: function(ele) {\r
     this.push(ele);\r
-    if (ele) {\r
+    if (ele && ele.getAttributeNS) {\r
       this.to = ele.getAttributeNS(null, "to") || "";\r
       this.attrName = ele.getAttributeNS(null, "attributeName") || "";\r
     }\r
index da09d37..f1f7766 100644 (file)
@@ -3432,6 +3432,7 @@ describe("SMIL Animation Spec", function() {
         s.setAttributeNS(null, "from", "1");\r
         attr.push(s);\r
         expect(timelines.length).toEqual(0);\r
+        expect(attr.push(12)).toBeNull();\r
       } );\r
     } );\r
     describe("A setValues method", function() {\r
@@ -3609,10 +3610,23 @@ describe("SMIL Animation Spec", function() {
         ele.parentNode.setAttributeNS(null, "tt1", "undef");\r
         $set.init(ele);\r
         expect($set.defaultValue).toBe("undef");\r
+\r
+        ele.setAttributeNS(null, "attributeName", "font-size");\r
+        ele.parentNode.style.setProperty("font-size", "12px");\r
+        $set.init(ele);\r
+        expect($set.defaultValue).toBe("12px");\r
       } );\r
       /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
       it("should be this for the value (the invalid partion on a spline mode )", function() {\r
-      } );\r
+        $set.init(null);\r
+        expect($set.to).toBe("");\r
+        expect($set.attrName).toBe("");\r
+        expect($set.defaultValue).toBe("");\r
+\r
+        $set.init(12);\r
+        expect($set.to).toBe("");\r
+        expect($set.attrName).toBe("");\r
+        expect($set.defaultValue).toBe("");      } );\r
     } );\r
   } );\r
 } );\r