Skip to content

Commit 76ab868

Browse files
committed
add loop toJson
1 parent ba013b9 commit 76ab868

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

__TESTS__/unit/toJson/effect.toJson.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,15 @@ describe('Effect toJson()', () => {
148148
}
149149
]);
150150
});
151+
152+
it('effect.loop', () => {
153+
const transformation = new Transformation()
154+
.addAction(Effect.loop().additionalIterations(5));
155+
expect(transformation.toJson()).toStrictEqual( [
156+
{
157+
actionType: 'loop',
158+
iterations: 5,
159+
}
160+
]);
161+
});
151162
});

src/actions/effect/leveled/Loop.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import {LeveledEffectAction} from "../EffectActions/LeveledEffectAction.js";
88
*/
99
class LoopEffectAction extends LeveledEffectAction {
1010
additionalIterations(value: number | string): this {
11-
return this.setLevel(value);
11+
this._actionModel.iterations = value;
12+
const qualifierEffect = this.createEffectQualifier(this.effectType, value);
13+
this.addQualifier(qualifierEffect);
14+
return this;
1215
}
1316
}
1417

0 commit comments

Comments
 (0)