Skip to content

Commit

Permalink
add missing motion tests (#10355)
Browse files Browse the repository at this point in the history
* add missing motion tests

* fix

---------

Co-authored-by: Rich Harris <[email protected]>
  • Loading branch information
Rich-Harris and Rich-Harris authored Jan 31, 2024
1 parent ccc7266 commit a53b443
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/svelte/tests/motion/test.ts
Original file line number Diff line number Diff line change
@@ -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);
});
});
});
1 change: 1 addition & 0 deletions packages/svelte/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"svelte/compiler": ["./src/compiler/public.d.ts"],
"svelte/internal": ["./src/internal/index.js"],
"svelte/legacy": ["./src/legacy/legacy-client.js"],
"svelte/motion": ["./src/motion/public.d.ts"],
"svelte/server": ["./src/server/index.js"],
"svelte/store": ["./src/store/public.d.ts"],
"#compiler": ["./src/compiler/types/index.d.ts"]
Expand Down

0 comments on commit a53b443

Please sign in to comment.