Merge pull request #647 from sveltejs/gh-643

#643 redux
pull/660/head
Rich Harris 8 years ago committed by GitHub
commit af1f87bb98

@ -271,11 +271,12 @@ function compound(
`); `);
} }
block.builders.unmount.addLine(
`${if_name}${name}.unmount();`
);
block.builders.destroy.addLine( block.builders.destroy.addLine(
`${if_name}{ `${if_name}${name}.destroy();`
${name}.unmount();
${name}.destroy();
}`
); );
} }

@ -164,15 +164,13 @@ function create_main_fragment ( state, component ) {
}, },
unmount: function () { unmount: function () {
if_block.unmount();
detachNode( if_block_anchor ); detachNode( if_block_anchor );
}, },
destroy: function () { destroy: function () {
{
if_block.unmount();
if_block.destroy(); if_block.destroy();
} }
}
}; };
} }

@ -29,15 +29,13 @@ function create_main_fragment ( state, component ) {
}, },
unmount: function () { unmount: function () {
if_block.unmount();
detachNode( if_block_anchor ); detachNode( if_block_anchor );
}, },
destroy: function () { destroy: function () {
{
if_block.unmount();
if_block.destroy(); if_block.destroy();
} }
}
}; };
} }

@ -0,0 +1,22 @@
<div class="level1">
{{#each values as value}}
<h4>level 1 #{{value}}</h4>
<Level2 condition="{{value % 2}}">
<Level3>
<span>And more stuff goes in here</span>
</Level3>
</Level2>
{{/each}}
</div>
<script>
import Level2 from './Level2.html';
import Level3 from './Level3.html';
export default {
components: {
Level2,
Level3
}
};
</script>

@ -0,0 +1,8 @@
<div class="level2" ref:wat>
<h4>level 2</h4>
{{#if condition}}
<span>TRUE! {{yield}}</span>
{{else}}
<span>FALSE! {{yield}}</span>
{{/if}}
</div>

@ -0,0 +1,4 @@
<div class="level3" ref:thingy>
<h4>level 3</h4>
{{yield}}
</div>

@ -0,0 +1,9 @@
export default {
data: {
values: [1, 2, 3, 4]
},
test(assert, component) {
component.set({ values: [2, 3] });
}
};

@ -0,0 +1,11 @@
<Level1 :values/>
<script>
import Level1 from './Level1.html';
export default {
components: {
Level1
}
}
</script>
Loading…
Cancel
Save