make setting tweened with duration=0 instantly update (#4766)

pull/4772/head
Pat Cavit 5 years ago committed by GitHub
parent f111cf6881
commit a08a94ac33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -93,6 +93,11 @@ export function tweened<T>(value?: T, defaults: Options<T> = {}): Tweened<T> {
interpolate = get_interpolator
} = assign(assign({}, defaults), opts);
if (duration === 0) {
store.set(target_value);
return Promise.resolve();
}
const start = now() + delay;
let fn;

@ -19,5 +19,12 @@ describe('motion', () => {
size.set(100);
assert.equal(get(size), 100);
});
it('sets immediately when duration is 0', () => {
const size = tweened(0);
size.set(100, { duration : 0 });
assert.equal(get(size), 100);
});
});
});

Loading…
Cancel
Save