OSDN Git Service

Add a method-chain to the object
authordhrname <dhrname@users.sourceforge.jp>
Tue, 4 Oct 2016 14:06:01 +0000 (23:06 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Tue, 4 Oct 2016 14:06:01 +0000 (23:06 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index f154db0..18fbb6d 100644 (file)
@@ -139,7 +139,7 @@ base("$frame").mix ( {
     updateState: function( /*number*/ f) {\r
       if (f === void 0) {\r
         /*引数fが指定されないときには状態を更新しない*/\r
-        return this.state;\r
+        return this;\r
       }\r
       var state = this.state,\r
           wait = this.WAITING,\r
@@ -175,19 +175,24 @@ base("$frame").mix ( {
         }\r
         list = list.next;\r
       }\r
-      if ( (startTime >= this.begin) && isWait ) {\r
-        return (this.state = begin);\r
+      if ( isWait && (startTime >= this.begin) ) {\r
+        this.state = begin;\r
       } else if (isWait) {\r
-        return state;\r
+        return this;\r
       } else if (state === begin) {\r
-        return (this.state = play);\r
+        this.state = play;\r
       } else if (state === play) {\r
-        return (endTime >= this.begin) ? (this.state = end) : play;\r
+        if (endTime >= this.begin) {\r
+          this.state = end;\r
+        } else {\r
+          return this;\r
+        }\r
       } else if (state === end) {\r
-        return (this.state = post);\r
+        this.state = post;\r
       } else {\r
-        return (this.state = begin);\r
+        this.state = begin;\r
       }\r
+      return this;\r
     }\r
   } );\r
   \r
index 553093f..2e0fd42 100644 (file)
@@ -177,23 +177,23 @@ describe("SMIL Animation Spec", function() {
             });\r
       \r
       expect(typeof frame.updateState).toBe("function");\r
-      expect(frame.updateState(0)).toBe(frame.BEGINNING);\r
+      expect(frame.updateState(0).state).toBe(frame.BEGINNING);\r
       expect(frame.state).toBe(frame.BEGINNING);\r
-      expect(frame.updateState(0)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
-      expect(frame.updateState(0)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
-      expect(frame.updateState(0)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
-      expect(frame.updateState(0)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
       \r
-      expect(frame.updateState(0)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
       frame.state = 100;\r
-      expect(frame.updateState(0)).toBe(frame.BEGINNING);\r
+      expect(frame.updateState(0).state).toBe(frame.BEGINNING);\r
       expect(frame.state).toBe(frame.BEGINNING);\r
-      expect(frame.updateState()).toBe(frame.BEGINNING);\r
+      expect(frame.updateState().state).toBe(frame.BEGINNING);\r
       expect(frame.state).toBe(frame.BEGINNING);\r
       \r
       expect(frame.beginList).toEqual({\r
@@ -208,15 +208,15 @@ describe("SMIL Animation Spec", function() {
     } );\r
     /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
     it("should be this for the value (the valid partion)", function() {\r
-      expect(frame.updateState(0)).toBe(frame.BEGINNING);\r
+      expect(frame.updateState(0).state).toBe(frame.BEGINNING);\r
       expect(frame.state).toBe(frame.BEGINNING);\r
-      expect(frame.updateState(1)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(1).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
-      expect(frame.updateState(2)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(2).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
-      expect(frame.updateState(3)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(3).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
-      expect(frame.updateState(4)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(4).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
       \r
       function appendBegin(num) {\r
@@ -228,23 +228,23 @@ describe("SMIL Animation Spec", function() {
         };\r
       };\r
       appendBegin(0);\r
-      expect(frame.updateState(0)).toBe(frame.BEGINNING);\r
+      expect(frame.updateState(0).state).toBe(frame.BEGINNING);\r
       expect(frame.state).toBe(frame.BEGINNING);\r
-      expect(frame.updateState(0)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
-      expect(frame.updateState(0)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
       \r
       appendBegin(1);\r
-      expect(frame.updateState(0)).toBe(frame.WAITING);\r
+      expect(frame.updateState(0).state).toBe(frame.WAITING);\r
       expect(frame.state).toBe(frame.WAITING);\r
-      expect(frame.updateState(0)).toBe(frame.WAITING);\r
+      expect(frame.updateState(0).state).toBe(frame.WAITING);\r
       expect(frame.state).toBe(frame.WAITING);\r
-      expect(frame.updateState(1)).toBe(frame.BEGINNING);\r
+      expect(frame.updateState(1).state).toBe(frame.BEGINNING);\r
       expect(frame.state).toBe(frame.BEGINNING);\r
-      expect(frame.updateState(1)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(1).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
-      expect(frame.updateState(1)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(1).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
       \r
       function appendEnd(num) {\r
@@ -255,13 +255,13 @@ describe("SMIL Animation Spec", function() {
         };\r
       };\r
       appendEnd(3);\r
-      expect(frame.updateState(1)).toBe(frame.BEGINNING);\r
+      expect(frame.updateState(1).state).toBe(frame.BEGINNING);\r
       expect(frame.state).toBe(frame.BEGINNING);\r
-      expect(frame.updateState(2)).toBe(frame.PLAYING);\r
+      expect(frame.updateState(2).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
-      expect(frame.updateState(3)).toBe(frame.ENDING);\r
+      expect(frame.updateState(3).state).toBe(frame.ENDING);\r
       expect(frame.state).toBe(frame.ENDING);\r
-      expect(frame.updateState(4)).toBe(frame.POSTWAITING);\r
+      expect(frame.updateState(4).state).toBe(frame.POSTWAITING);\r
       expect(frame.state).toBe(frame.POSTWAITING);\r
     } );\r
   } );\r