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
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