forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (31 loc) · 784 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import assert from "assert";
import { svelte, deindent } from "../helpers.js";
describe("create", () => {
it("should return a component constructor", () => {
const source = deindent`
<div>{prop}</div>
`;
const component = svelte.create(source);
assert(component instanceof Function);
});
it("should throw error when source is invalid ", done => {
const source = deindent`
<div>{prop</div>
`;
const component = svelte.create(source, {
onerror: () => {
done();
}
});
assert.equal(component, undefined);
});
it("should return undefined when source is invalid ", () => {
const source = deindent`
<div>{prop</div>
`;
const component = svelte.create(source, {
onerror: () => {}
});
assert.equal(component, undefined);
});
});