mirror of https://github.com/sveltejs/svelte
				
				
				
			fire oncreate handlers for components inside await blocks (#1061)
	
		
	
				
					
				
			
							parent
							
								
									9cfa174703
								
							
						
					
					
						commit
						c1b5bed6d2
					
				| @ -0,0 +1,14 @@ | |||||||
|  | <p>{{value}}</p> | ||||||
|  | <p>{{called}}</p> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | 	export default { | ||||||
|  | 		data() { | ||||||
|  | 			return { called: false }; | ||||||
|  | 		}, | ||||||
|  | 
 | ||||||
|  | 		oncreate() { | ||||||
|  | 			this.set({ called: true }); | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | </script> | ||||||
| @ -0,0 +1,16 @@ | |||||||
|  | const promise = Promise.resolve(42); | ||||||
|  | 
 | ||||||
|  | export default { | ||||||
|  | 	data: { | ||||||
|  | 		promise | ||||||
|  | 	}, | ||||||
|  | 
 | ||||||
|  | 	test(assert, component, target) { | ||||||
|  | 		return promise.then(() => { | ||||||
|  | 			assert.htmlEqual(target.innerHTML, ` | ||||||
|  | 				<p>42</p> | ||||||
|  | 				<p>true</p> | ||||||
|  | 			`);
 | ||||||
|  | 		}); | ||||||
|  | 	} | ||||||
|  | }; | ||||||
| @ -0,0 +1,13 @@ | |||||||
|  | {{#await promise then value}} | ||||||
|  | 	<Foo :value /> | ||||||
|  | {{/await}} | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | 	import Foo from './Foo.html'; | ||||||
|  | 
 | ||||||
|  | 	export default { | ||||||
|  | 		components: { | ||||||
|  | 			Foo | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | </script> | ||||||
					Loading…
					
					
				
		Reference in new issue