File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 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+ } ) ;
Original file line number Diff line number Diff line change 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" ]
You can’t perform that action at this time.
0 commit comments