Fix binding to values in a component when it uses `$$props` (#2725)

pull/3086/head
Bryan Terce 5 years ago committed by Conduitry
parent 01676aac46
commit 60914b86fd

@ -80,7 +80,7 @@ export default function dom(
${$$props} => {
${uses_props && component.invalidate('$$props', `$$props = @assign(@assign({}, $$props), $$new_props)`)}
${writable_props.map(prop =>
`if ('${prop.export_name}' in $$props) ${component.invalidate(prop.name, `${prop.name} = $$props.${prop.export_name}`)};`
`if ('${prop.export_name}' in ${$$props}) ${component.invalidate(prop.name, `${prop.name} = ${$$props}.${prop.export_name}`)};`
)}
${component.slots.size > 0 &&
`if ('$$scope' in ${$$props}) ${component.invalidate('$$scope', `$$scope = ${$$props}.$$scope`)};`}

@ -0,0 +1,6 @@
<script>
export let actualValue;
let x = $$props;
</script>
<input bind:value={actualValue}>

@ -0,0 +1,14 @@
export default {
async test({ assert, target, window }) {
const input = target.querySelector('input');
const event = new window.Event('input');
input.value = 'changed';
await input.dispatchEvent(event);
assert.htmlEqual(target.innerHTML, `
<input>
<p>changed</p>
`);
}
};

@ -0,0 +1,7 @@
<script>
import Input from './TextInput.svelte';
export let actualValue = '';
</script>
<Input bind:actualValue />
<p>{actualValue}</p>
Loading…
Cancel
Save