mirror of https://github.com/sveltejs/svelte
24 lines
503 B
24 lines
503 B
import * as assert from 'assert';
|
|
|
|
export default {
|
|
data: {
|
|
visible: true
|
|
},
|
|
html: '<div><!--#if visible--><p>i am a widget</p></div>', // TODO comment should follow component...
|
|
test ( component ) {
|
|
let count = 0;
|
|
|
|
component.on( 'widgetTornDown', function () {
|
|
assert.equal( this, component );
|
|
count += 1;
|
|
});
|
|
|
|
component.set({ visible: false });
|
|
assert.equal( count, 1 );
|
|
|
|
component.set({ visible: true });
|
|
component.set({ visible: false });
|
|
assert.equal( count, 2 );
|
|
}
|
|
};
|