mirror of https://github.com/sveltejs/svelte
parent
4210c238d4
commit
306a931176
@ -1,13 +1,24 @@
|
|||||||
export default {
|
export default {
|
||||||
html: '<div><p></p></div>',
|
html: '<div><p></p></div>',
|
||||||
|
|
||||||
test ( assert, component, target ) {
|
test ( assert, component, target ) {
|
||||||
const widget = component.refs.widget;
|
const widget = component.refs.widget;
|
||||||
|
|
||||||
assert.equal( widget.get( 'show' ), false );
|
assert.equal( widget.get( 'show' ), false );
|
||||||
|
|
||||||
widget.set({show: true});
|
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'});
|
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});
|
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