mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
28 lines
715 B
TypeScript
28 lines
715 B
TypeScript
/// <reference lib="dom" />
|
|
|
|
import { SveltePlugin } from "bun-plugin-svelte";
|
|
import { Window } from "happy-dom";
|
|
import { expect } from "bun:test";
|
|
|
|
Bun.plugin(SveltePlugin({ forceSide: "client", development: true }));
|
|
|
|
const { mount } = await import("svelte");
|
|
|
|
// @ts-ignore
|
|
const window = globalThis.window = new Window({
|
|
width: 1024,
|
|
height: 768,
|
|
url: "http://localhost:3000",
|
|
});
|
|
|
|
|
|
const document = globalThis.document = window.document as unknown as Document;
|
|
const body = document.body;
|
|
|
|
const root = document.body.appendChild(document.createElement("div"));
|
|
|
|
const { default: TodoApp } = await import("./todo-list.svelte");
|
|
|
|
mount(TodoApp, { target: root });
|
|
expect(root.innerHTML).not.toBeEmpty();
|