Skip to content

Commit a53b443

Browse files
authored
add missing motion tests (#10355)
* add missing motion tests * fix --------- Co-authored-by: Rich Harris <[email protected]>
1 parent ccc7266 commit a53b443

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

packages/svelte/tests/motion/test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { describe, it, assert } from 'vitest';
2+
import { get } from 'svelte/store';
3+
import { spring, tweened } from 'svelte/motion';
4+
5+
describe('motion', () => {
6+
describe('spring', () => {
7+
it('handles initially undefined values', () => {
8+
const size = spring();
9+
10+
size.set(100);
11+
assert.equal(get(size), 100);
12+
});
13+
});
14+
15+
describe('tweened', () => {
16+
it('handles initially undefined values', () => {
17+
const size = tweened();
18+
19+
size.set(100);
20+
assert.equal(get(size), 100);
21+
});
22+
23+
it('sets immediately when duration is 0', () => {
24+
const size = tweened(0);
25+
26+
size.set(100, { duration: 0 });
27+
assert.equal(get(size), 100);
28+
});
29+
});
30+
});

packages/svelte/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"svelte/compiler": ["./src/compiler/public.d.ts"],
2222
"svelte/internal": ["./src/internal/index.js"],
2323
"svelte/legacy": ["./src/legacy/legacy-client.js"],
24+
"svelte/motion": ["./src/motion/public.d.ts"],
2425
"svelte/server": ["./src/server/index.js"],
2526
"svelte/store": ["./src/store/public.d.ts"],
2627
"#compiler": ["./src/compiler/types/index.d.ts"]

0 commit comments

Comments
 (0)