mirror of https://github.com/sveltejs/svelte
Merge pull request #1151 from sveltejs/gh-1117
in custom elements, call oncreate in connectedCallbackpull/1170/head
commit
173792fd90
@ -1,3 +1,7 @@
|
|||||||
export function equal(a, b, message) {
|
export function equal(a, b, message) {
|
||||||
if (a != b) throw new Error(message || `Expected ${a} to equal ${b}`);
|
if (a != b) throw new Error(message || `Expected ${a} to equal ${b}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ok(condition, message) {
|
||||||
|
if (!condition) throw new Error(message || `Expected ${condition} to be truthy`);
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
tag: 'my-app',
|
||||||
|
|
||||||
|
oncreate() {
|
||||||
|
this.wasCreated = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1,8 @@
|
|||||||
|
import * as assert from 'assert';
|
||||||
|
import './main.html';
|
||||||
|
|
||||||
|
export default function (target) {
|
||||||
|
target.innerHTML = '<my-app/>';
|
||||||
|
const el = target.querySelector('my-app');
|
||||||
|
assert.ok(el.wasCreated);
|
||||||
|
}
|
Loading…
Reference in new issue