mirror of https://github.com/sveltejs/svelte
				
				
				
			
							parent
							
								
									5be480d7ac
								
							
						
					
					
						commit
						ed9df1fff3
					
				@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					<script>
 | 
				
			||||||
 | 
						export let x = 'no';
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<p>Bar: {x}</p>
 | 
				
			||||||
@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					<script>
 | 
				
			||||||
 | 
						export let x = 'yes';
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<p>Foo: {x}</p>
 | 
				
			||||||
@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					export default {
 | 
				
			||||||
 | 
						html: `
 | 
				
			||||||
 | 
							<p>Foo: yes</p>
 | 
				
			||||||
 | 
							<p>x in parent: yes</p>
 | 
				
			||||||
 | 
						`,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						async test({ assert, component, target, window }) {
 | 
				
			||||||
 | 
							component.a = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							assert.htmlEqual(target.innerHTML, `
 | 
				
			||||||
 | 
								<p>Bar: yes</p>
 | 
				
			||||||
 | 
								<p>x in parent: yes</p>
 | 
				
			||||||
 | 
							`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							component.a = true;
 | 
				
			||||||
 | 
							assert.equal(component.x, 'yes');
 | 
				
			||||||
 | 
							component.x = undefined;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							assert.htmlEqual(target.innerHTML, `
 | 
				
			||||||
 | 
								<p>Foo: undefined</p>
 | 
				
			||||||
 | 
								<p>x in parent: undefined</p>
 | 
				
			||||||
 | 
							`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							component.a = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							assert.htmlEqual(target.innerHTML, `
 | 
				
			||||||
 | 
								<p>Bar: no</p>
 | 
				
			||||||
 | 
								<p>x in parent: no</p>
 | 
				
			||||||
 | 
							`);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					<script>
 | 
				
			||||||
 | 
						import Foo from './Foo.html';
 | 
				
			||||||
 | 
						import Bar from './Bar.html';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						export let a = true;
 | 
				
			||||||
 | 
						export let x;
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{#if a}
 | 
				
			||||||
 | 
						<Foo bind:x/>
 | 
				
			||||||
 | 
					{:else}
 | 
				
			||||||
 | 
						<Bar bind:x/>
 | 
				
			||||||
 | 
					{/if}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<p>x in parent: {x}</p>
 | 
				
			||||||
@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					<script>
 | 
				
			||||||
 | 
						export let x = 'no';
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<p>Bar: {x}</p>
 | 
				
			||||||
@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					<script>
 | 
				
			||||||
 | 
						export let x = 'yes';
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<p>Foo: {x}</p>
 | 
				
			||||||
@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					export default {
 | 
				
			||||||
 | 
						html: `
 | 
				
			||||||
 | 
							<p>Foo: yes</p>
 | 
				
			||||||
 | 
							<p>x in parent: yes</p>
 | 
				
			||||||
 | 
						`,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						async test({ assert, component, target, window }) {
 | 
				
			||||||
 | 
							component.a = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							assert.htmlEqual(target.innerHTML, `
 | 
				
			||||||
 | 
								<p>Bar: yes</p>
 | 
				
			||||||
 | 
								<p>x in parent: yes</p>
 | 
				
			||||||
 | 
							`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							component.a = true;
 | 
				
			||||||
 | 
							assert.equal(component.x, 'yes');
 | 
				
			||||||
 | 
							component.x = undefined;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							assert.htmlEqual(target.innerHTML, `
 | 
				
			||||||
 | 
								<p>Foo: undefined</p>
 | 
				
			||||||
 | 
								<p>x in parent: undefined</p>
 | 
				
			||||||
 | 
							`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							component.a = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							assert.htmlEqual(target.innerHTML, `
 | 
				
			||||||
 | 
								<p>Bar: no</p>
 | 
				
			||||||
 | 
								<p>x in parent: no</p>
 | 
				
			||||||
 | 
							`);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					<script>
 | 
				
			||||||
 | 
						import Foo from './Foo.html';
 | 
				
			||||||
 | 
						import Bar from './Bar.html';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						export let a = true;
 | 
				
			||||||
 | 
						export let x;
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<svelte:component this="{a ? Foo : Bar}" bind:x/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<p>x in parent: {x}</p>
 | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue