From 02ace60def8ad38314e2b39f6490ad618bf65faf Mon Sep 17 00:00:00 2001 From: dhrname Date: Wed, 18 Feb 2015 22:14:37 +0900 Subject: [PATCH] Add thd Spec for a listener method --- org/w3c/dom/smil.js | 9 +++++++++ tool/Spec/spec/SvgDomSpec.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index 8a6c5b8..fb81d57 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -414,6 +414,15 @@ base("$frame").mix ( { this.begin : "indefinite"; } + } ).mix( { + /*イベントリスナー用の関数*/ + listener: function(evt) { + var offset = this.begin; + if (offset > 0) { + } else { + this.removeLine(this.$begin); + } + } } ); } ); /*$presentvalue オブジェクト diff --git a/tool/Spec/spec/SvgDomSpec.js b/tool/Spec/spec/SvgDomSpec.js index e9f706c..1a6c79d 100644 --- a/tool/Spec/spec/SvgDomSpec.js +++ b/tool/Spec/spec/SvgDomSpec.js @@ -2489,6 +2489,50 @@ describe("SMIL Animation Spec", function() { end.string = null; expect(end.up().call()).toBeNull(); } ); + + describe("A listener method in $end object", function() { + var obj, + begin = base("$frame").$begin; + beforeEach( function() { + end.string = ""; + /*配列は初期化しておく*/ + end.timelines.length = 0; + obj = end.up(); + obj.$begin = begin.up(); + obj.$activate = begin.$activate.up(); + obj.addLine(obj.$begin); + } ); + /*境界条件を調べておく (limit value analysis)*/ + it("should be this for the value (limit value analysis)", function() { + expect(obj.timelines[0]).toBe(obj.$begin); + expect(obj.timelines[0]).not.toBe(obj); + obj.listener(); + expect(obj.timelines[0]).not.toBe(obj.$begin); + + obj.addLine(obj.$begin); + obj.listener({ + timeStamp: 12 + } ); + expect(obj.timelines[0]).not.toBe(obj.$begin); + + obj.addLine(obj.$begin); + obj.mix( { + string: "event+100ms" + } ).parse(); + obj.listener({ + timeStamp: 12 + } ); + expect(obj.timelines[0]).toBe(obj.$begin); + } ); + /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/ + it("should be this for the value (the valid partion)", function() { + } ); + /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/ + it("should be this for the value (the invalid partion)", function() { + obj.listener({}); + expect(obj.timelines[0]).not.toBe(obj.$begin); + } ); + } ) } ); describe("A $activate object", function() { var act = base("$frame").$begin.$activate; -- 2.11.0