blowater/UI/editor.test.tsx

30 lines
807 B
TypeScript
Raw Normal View History

2023-06-30 14:05:57 +00:00
/** @jsx h */
import { h, render } from "https://esm.sh/preact@10.17.1";
2023-06-30 14:05:57 +00:00
import { Editor } from "./editor.tsx";
2023-09-11 15:27:38 +00:00
import { InMemoryAccountContext, NostrKind } from "../lib/nostr-ts/nostr.ts";
import { PrivateKey } from "../lib/nostr-ts/key.ts";
import { testEventBus } from "./_setup.test.ts";
2023-06-30 14:05:57 +00:00
2023-09-11 15:27:38 +00:00
const ctx = InMemoryAccountContext.New(PrivateKey.Generate());
2023-06-30 14:05:57 +00:00
let vdom = (
<Editor
placeholder="Message @xxx"
maxHeight="50vh"
2023-09-11 15:27:38 +00:00
eventEmitter={testEventBus}
2023-06-30 14:05:57 +00:00
model={{
files: [],
2023-09-11 15:27:38 +00:00
id: "",
tags: [],
target: {
kind: NostrKind.DIRECT_MESSAGE,
receiver: {
pubkey: ctx.publicKey,
},
},
2023-06-30 14:05:57 +00:00
text: "",
}}
/>
);
render(vdom, document.body);