OSDN Git Service

New an offset method
authordhrname <dhrname@users.sourceforge.jp>
Tue, 27 Jan 2015 14:16:04 +0000 (23:16 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Tue, 27 Jan 2015 14:16:04 +0000 (23:16 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 9d9cc2b..60b275b 100644 (file)
@@ -197,7 +197,7 @@ base("$frame").mix ( {
       return this.string.replace(/[\s\n]+/g, "");\r
     },\r
     offset: function() {\r
-      return parseFloat(this.trim().match(/[\+\-]?\d+$/));\r
+      return parseFloat(this.trim().match(/[\+\-]?\d+$/) || 0);\r
     },\r
     event: function() {\r
     }\r
index d2d1850..2801cd7 100644 (file)
@@ -2120,15 +2120,27 @@ describe("SMIL Animation Spec", function() {
       expect(begin.trim()).toBe("");\r
       begin.string = " ";\r
       expect(begin.trim()).toBe("");\r
+      expect(begin.offset()).toEqual(0);\r
+      begin.string = "+20ms";\r
+      expect(begin.offset()).toEqual(20);\r
     } );\r
     /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
     it("should be this for the value (the valid partion)", function() {\r
       begin.string = " hoge ";\r
       expect(begin.trim()).toBe("hoge");\r
+      begin.string = " h o g e ";\r
+      expect(begin.trim()).toBe("hoge");\r
+       begin.string = " h  o  g     e ";\r
+      expect(begin.trim()).toBe("hoge");\r
+      \r
+      expect(begin.offset()).toEqual(0);\r
     } );\r
     /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
     it("should be this for the value (the invalid partion)", function() {\r
-      \r
+      expect( function() {\r
+        delete begin.string;\r
+        expect(begin.trim()).toBe("hoge");\r
+      } ).toThrow();\r
     } );\r
   } );\r
 } )\r