mirror of https://github.com/sveltejs/svelte
parent
2171c67225
commit
d146c297ac
@ -0,0 +1,21 @@
|
||||
export default {
|
||||
html: `
|
||||
<h1>tag is h1.</h1>
|
||||
`,
|
||||
|
||||
async test({ assert, component, target }) {
|
||||
|
||||
assert.equal(component.tag, 'h1');
|
||||
assert.equal(component.updateText, '');
|
||||
assert.equal(component.destroyText, '');
|
||||
|
||||
component.tag = 'h2';
|
||||
|
||||
assert.equal(component.tag, 'h2');
|
||||
assert.equal(component.updateText, 'update: h2');
|
||||
assert.equal(component.destroyText, 'destroy');
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<h2>tag is h2.</h2>
|
||||
`);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
export let updateText = "";
|
||||
export let destroyText = "";
|
||||
export let tag = "h1";
|
||||
function foo(node, tag) {
|
||||
return {
|
||||
update: (tag) => updateText = `update: ${tag}`,
|
||||
destroy: () => destroyText = 'destroy'
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:element this={tag} use:foo={tag}>tag is {tag}.</svelte:element>
|
||||
Loading…
Reference in new issue