mirror of https://github.com/sveltejs/svelte
support methods as actions (#5398)
parent
b3f54bd2cf
commit
254096d320
@ -0,0 +1,8 @@
|
||||
export default {
|
||||
html: `
|
||||
<button>action</button>
|
||||
`,
|
||||
async test({ assert, target, window }) {
|
||||
assert.equal(target.querySelector('button').foo, 'bar1337');
|
||||
}
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
const obj = {
|
||||
foo : "bar",
|
||||
action(element, { leet }) {
|
||||
element.foo = this.foo + leet;
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<button use:obj.action={{ leet: 1337 }}>action</button>
|
Loading…
Reference in new issue