mirror of https://github.com/sveltejs/svelte
add missing motion tests (#10355)
* add missing motion tests * fix --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/10356/head
parent
ccc7266fd9
commit
a53b44338e
@ -0,0 +1,30 @@
|
||||
import { describe, it, assert } from 'vitest';
|
||||
import { get } from 'svelte/store';
|
||||
import { spring, tweened } from 'svelte/motion';
|
||||
|
||||
describe('motion', () => {
|
||||
describe('spring', () => {
|
||||
it('handles initially undefined values', () => {
|
||||
const size = spring();
|
||||
|
||||
size.set(100);
|
||||
assert.equal(get(size), 100);
|
||||
});
|
||||
});
|
||||
|
||||
describe('tweened', () => {
|
||||
it('handles initially undefined values', () => {
|
||||
const size = tweened();
|
||||
|
||||
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…
Reference in new issue