mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
test update while yield fragment is torn down, and tweak code for consistency
This commit is contained in:
parent
4210c238d4
commit
306a931176
@ -1,15 +1,15 @@
|
||||
<p>
|
||||
{{#if show}}
|
||||
{{yield}}
|
||||
{{/if}}
|
||||
{{#if show}}
|
||||
{{yield}}
|
||||
{{/if}}
|
||||
</p>
|
||||
<script>
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -1,13 +1,24 @@
|
||||
export default {
|
||||
html: '<div><p></p></div>',
|
||||
|
||||
test ( assert, component, target ) {
|
||||
const widget = component.refs.widget;
|
||||
|
||||
assert.equal( widget.get( 'show' ), false );
|
||||
|
||||
widget.set({show: true});
|
||||
assert.equal( target.innerHTML, '<div><p>Hello<!--yield--><!--#if show--></p></div>' );
|
||||
assert.htmlEqual( target.innerHTML, '<div><p>Hello</p></div>' );
|
||||
|
||||
component.set({data: 'World'});
|
||||
assert.equal( target.innerHTML, '<div><p>World<!--yield--><!--#if show--></p></div>' );
|
||||
assert.htmlEqual( target.innerHTML, '<div><p>World</p></div>' );
|
||||
|
||||
widget.set({show: false});
|
||||
assert.equal( target.innerHTML, '<div><p><!--#if show--></p></div>' );
|
||||
assert.htmlEqual( target.innerHTML, '<div><p></p></div>' );
|
||||
|
||||
component.set({data: 'Goodbye'});
|
||||
assert.htmlEqual( target.innerHTML, '<div><p></p></div>' );
|
||||
|
||||
widget.set({show: true});
|
||||
assert.htmlEqual( target.innerHTML, '<div><p>Goodbye</p></div>' );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user