mirror of https://github.com/sveltejs/svelte
				
				
				
			inject lets for reactive declarations where necessary - fixes #2059
	
		
	
				
					
				
			
							parent
							
								
									3a03485d0d
								
							
						
					
					
						commit
						539fbbd8ef
					
				| @ -0,0 +1,14 @@ | ||||
| export default { | ||||
| 	html: ` | ||||
| 		<p>1 + 2 = 3</p> | ||||
| 		<p>3 * 3 = 9</p> | ||||
| 	`,
 | ||||
| 
 | ||||
| 	test({ assert, component, target }) { | ||||
| 		component.a = 3; | ||||
| 		assert.htmlEqual(target.innerHTML, ` | ||||
| 			<p>3 + 2 = 5</p> | ||||
| 			<p>5 * 5 = 25</p> | ||||
| 		`);
 | ||||
| 	} | ||||
| }; | ||||
| @ -0,0 +1,10 @@ | ||||
| <script> | ||||
| 	export let a = 1; | ||||
| 	export let b = 2; | ||||
| 
 | ||||
| 	$: c = a + b; | ||||
| 	$: cSquared = c * c; | ||||
| </script> | ||||
| 
 | ||||
| <p>{a} + {b} = {c}</p> | ||||
| <p>{c} * {c} = {cSquared}</p> | ||||
| @ -0,0 +1,26 @@ | ||||
| export default { | ||||
| 	test(assert, stats) { | ||||
| 		assert.deepEqual(stats.vars, [ | ||||
| 			{ | ||||
| 				name: 'a', | ||||
| 				injected: false, | ||||
| 				export_name: null, | ||||
| 				module: false, | ||||
| 				mutated: false, | ||||
| 				reassigned: false, | ||||
| 				referenced: true, | ||||
| 				writable: true | ||||
| 			}, | ||||
| 			{ | ||||
| 				name: 'b', | ||||
| 				injected: true, | ||||
| 				export_name: null, | ||||
| 				module: false, | ||||
| 				mutated: false, | ||||
| 				reassigned: true, | ||||
| 				referenced: true, | ||||
| 				writable: true | ||||
| 			} | ||||
| 		]); | ||||
| 	}, | ||||
| }; | ||||
| @ -0,0 +1,6 @@ | ||||
| <script> | ||||
| 	let a = 1; | ||||
| 	$: b = a + 1; | ||||
| </script> | ||||
| 
 | ||||
| <p>{a} + 1 = {b}</p> | ||||
					Loading…
					
					
				
		Reference in new issue