From bcef5aab4c17b0bcb03b6298ecb547e87be59feb Mon Sep 17 00:00:00 2001 From: dhrname Date: Sun, 25 Jan 2015 23:25:37 +0900 Subject: [PATCH] Modify the Spec about base.js --- org/w3c/dom/smil.js | 16 +++++++++++++--- tool/Spec/spec/BaseJSSpec.js | 10 +++++----- tool/Spec/spec/SvgDomSpec.js | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index 7bdef68..6212299 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -188,10 +188,20 @@ base("$frame").mix ( { } } } ).mix( function($frame) { - /*$beginオブジェクト + /*$begin オブジェクト * 開始のタイミングを計算する*/ - $frame.up("$begin").mix( - ); + $frame.up("$begin").mix( { + /*開始時刻やタイミングが書かれた文字列*/ + string: "", + trim: function() { + return ( this.string = this.string.replace(/\s\n/g, "") ); + }, + offset: function() { + return parseFloat(this.trim().match(/[\+\-]?\d+$/)); + }, + event: function() { + } + } ); } ); /*$presentvalue オブジェクト * 呈示値 (presentation value)の計算をする。値そのものを返すためのオブジェクト*/ diff --git a/tool/Spec/spec/BaseJSSpec.js b/tool/Spec/spec/BaseJSSpec.js index 0684fdc..2ad9b5a 100644 --- a/tool/Spec/spec/BaseJSSpec.js +++ b/tool/Spec/spec/BaseJSSpec.js @@ -349,8 +349,8 @@ describe("base.js", function() { base("$fp").$1.mix( function(_) { expect(_.a).toEqual(0); expect(_.b).toEqual(1); - expect(_.c).toBeTrue(); - expect(_.d).toBeFalse(); + expect(_.c).toBeTruthy(); + expect(_.d).toBeFalsy(); expect(typeof _.e).toBe("object"); expect(typeof _.f).toBe("function"); expect(_.g.length).toEqual(0); @@ -435,8 +435,8 @@ describe("base.js", function() { base("$bfp").$1.mix( function(_) { expect(_.a).toEqual(0); expect(_.b).toEqual(1); - expect(_.c).toBeTrue(); - expect(_.d).toBeFalse(); + expect(_.c).toBeTruthy(); + expect(_.d).toBeFalsy(); expect(typeof _.e).toBe("object"); expect(_.f).toBeUndefined(); expect(_.g.length).toEqual(0); @@ -507,7 +507,7 @@ describe("base.js", function() { return this.lazy.a; } } ); - expect(base("$bfp").$s.call())toBe(base("$cfp")); + expect(base("$bfp").$s.call()).toBe(base("$cfp")); }); /*無効同値を調べる*/ diff --git a/tool/Spec/spec/SvgDomSpec.js b/tool/Spec/spec/SvgDomSpec.js index 1f17659..2777445 100644 --- a/tool/Spec/spec/SvgDomSpec.js +++ b/tool/Spec/spec/SvgDomSpec.js @@ -2113,4 +2113,22 @@ describe("SMIL Animation Spec", function() { }); } ); + describe("$begin object", function() { + var begin = base("$frame").$begin; + /*境界条件を調べておく (limit value analysis)*/ + it("should be this for the value (limit value analysis)", function() { + expect(begin.trim()).toBe(""); + begin.string = " "; + expect(begin.trim()).toBe(""); + } ); + /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/ + it("should be this for the value (the valid partion)", function() { + begin.string = " hoge "; + expect(begin.trim()).toBe("w"); + } ); + /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/ + it("should be this for the value (the invalid partion)", function() { + + } ); + } ); } ) -- 2.11.0