mirror of https://github.com/sveltejs/svelte
Merge pull request #1375 from sveltejs/gh-1369
assign custom methods to custom element prototypepull/1381/head
commit
ff45a5315f
@ -0,0 +1,13 @@
|
||||
<p>{foo}</p>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
tag: 'custom-element',
|
||||
|
||||
methods: {
|
||||
updateFoo(value) {
|
||||
this.foo = value;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,12 @@
|
||||
import * as assert from 'assert';
|
||||
import './main.html';
|
||||
|
||||
export default function (target) {
|
||||
target.innerHTML = '<custom-element name="world"></custom-element>';
|
||||
const el = target.querySelector('custom-element');
|
||||
|
||||
el.updateFoo(42);
|
||||
|
||||
const p = el.shadowRoot.querySelector('p');
|
||||
assert.equal(p.textContent, '42');
|
||||
}
|
Loading…
Reference in new issue