mirror of https://github.com/sveltejs/svelte
				
				
				
			fix: improve global transition outro handling (#10474)
	
		
	
				
					
				
			
							parent
							
								
									d41d0c26ad
								
							
						
					
					
						commit
						74742d9233
					
				| @ -0,0 +1,5 @@ | |||||||
|  | --- | ||||||
|  | "svelte": patch | ||||||
|  | --- | ||||||
|  | 
 | ||||||
|  | fix: improve global transition outro handling | ||||||
| @ -0,0 +1,10 @@ | |||||||
|  | <script> | ||||||
|  | 	import { fade } from 'svelte/transition'; | ||||||
|  | 	let show = $state(true); | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <h1>Outside</h1> | ||||||
|  | 
 | ||||||
|  | {#if show} | ||||||
|  | 	<button onclick={()=> show = false} transition:fade|global={{ duration: 100 }}>Hide</button> | ||||||
|  | {/if} | ||||||
| @ -0,0 +1,20 @@ | |||||||
|  | import { test } from '../../test'; | ||||||
|  | import { flushSync } from 'svelte'; | ||||||
|  | 
 | ||||||
|  | export default test({ | ||||||
|  | 	async test({ assert, target, raf }) { | ||||||
|  | 		const btn = target.querySelector('button'); | ||||||
|  | 
 | ||||||
|  | 		raf.tick(0); | ||||||
|  | 
 | ||||||
|  | 		flushSync(() => { | ||||||
|  | 			btn?.click(); | ||||||
|  | 		}); | ||||||
|  | 
 | ||||||
|  | 		assert.htmlEqual(target.innerHTML, `<h1>Outside</h1><button>Hide</button>`); | ||||||
|  | 
 | ||||||
|  | 		raf.tick(100); | ||||||
|  | 
 | ||||||
|  | 		assert.htmlEqual(target.innerHTML, `<h1>Outside</h1>`); | ||||||
|  | 	} | ||||||
|  | }); | ||||||
| @ -0,0 +1,11 @@ | |||||||
|  | <script> | ||||||
|  | 	import Component from "./Component.svelte" | ||||||
|  | 	let shown = $state(false); | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | {#if shown} | ||||||
|  | 	Nothing | ||||||
|  | {:else} | ||||||
|  | 	<svelte:component this={Component} /> | ||||||
|  | {/if} | ||||||
|  | 
 | ||||||
					Loading…
					
					
				
		Reference in new issue