pull/5621/head
pushkine 5 years ago
parent f9ca419bdb
commit 8a7d3cd259

@ -0,0 +1,15 @@
export default {
props: { text: "first" },
test({ assert, target, component }) {
assert.htmlEqual(target.innerHTML, "<button>first</button>");
component.text = "second";
assert.htmlEqual(target.innerHTML, "<button>second</button>");
let last_text;
component.text = "third";
component.on_destroy = (text) => {
last_text = text;
};
component.$destroy();
assert.equal(last_text, "third");
},
};

@ -0,0 +1,18 @@
<script>
export let on_destroy;
export let text;
function tooltip(node, text) {
node.textContent = text;
return {
node,
update(text) {
this.node.textContent = text;
},
destroy() {
on_destroy(this.node.textContent);
},
};
}
</script>
<button use:tooltip={text} />
Loading…
Cancel
Save