mirror of https://github.com/sveltejs/svelte
				
				
				
			allow transition functions to return a function (#1431)
	
		
	
				
					
				
			
							parent
							
								
									b5931b95d4
								
							
						
					
					
						commit
						4c62d22b9c
					
				| @ -0,0 +1,15 @@ | |||||||
|  | export default { | ||||||
|  | 	skipIntroByDefault: true, | ||||||
|  | 
 | ||||||
|  | 	test(assert, component, target, window, raf) { | ||||||
|  | 		component.set({ visible: true }); | ||||||
|  | 
 | ||||||
|  | 		return Promise.resolve().then(() => { | ||||||
|  | 			const div = target.querySelector('div'); | ||||||
|  | 			assert.equal(div.foo, 0); | ||||||
|  | 
 | ||||||
|  | 			raf.tick(50); | ||||||
|  | 			assert.equal(div.foo, 0.5); | ||||||
|  | 		}); | ||||||
|  | 	}, | ||||||
|  | }; | ||||||
| @ -0,0 +1,20 @@ | |||||||
|  | {#if visible} | ||||||
|  | 	<div transition:foo></div> | ||||||
|  | {/if} | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | 	export default { | ||||||
|  | 		transitions: { | ||||||
|  | 			foo(node, params) { | ||||||
|  | 				return () => { | ||||||
|  | 					return { | ||||||
|  | 						duration: 100, | ||||||
|  | 						tick: t => { | ||||||
|  | 							node.foo = t; | ||||||
|  | 						} | ||||||
|  | 					}; | ||||||
|  | 				}; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | </script> | ||||||
					Loading…
					
					
				
		Reference in new issue