Skip to content

Commit

Permalink
fix: lint & add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tvytlx committed Dec 27, 2021
1 parent d202e0d commit 57392c1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Tween.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class Tween<T extends UnknownProps> {
endValues = endValues.map(this._handleRelativeValue.bind(this, startValue as number))

// Create a local copy of the Array with the start value at the front
if(_valuesStart[property] === undefined) {
if (_valuesStart[property] === undefined) {
_valuesEnd[property] = [startValue].concat(endValues)
}
}
Expand Down
14 changes: 14 additions & 0 deletions src/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2146,6 +2146,20 @@ export const tests = {
test.done()
},

"Test TWEEN.to(ends) shouldn't grow endless on ends value's"(test: Test): void {
const target = {y: 0}
const ends = {y: [100, 200]}
const tween = new TWEEN.Tween(target).to(ends, 1000)

tween.stop().start(0)
tween.stop().start(0)

TWEEN.update(250)
test.equal(target.y, 50)

test.done()
},

'Test TWEEN.Tween.update() with no arguments'(test: Test): void {
const clock = FakeTimers.install()
const targetNow = {x: 0.0}
Expand Down

0 comments on commit 57392c1

Please sign in to comment.