test: cover share authentication and copy behavior

This commit is contained in:
2026-08-16 01:20:59 +07:00 Unverified
parent f32171a576
commit 649eac1776
5 changed files with 86 additions and 8 deletions
+5 -2
View File
@@ -31,11 +31,14 @@ import {
import { Spinner } from "@/components/ui/spinner";
import { Textarea } from "@/components/ui/textarea";
import { MAX_SHARE_COMMENT_LENGTH } from "@/lib/share/limits";
import { getShareContentForClipboard } from "@/lib/share/copy";
export function CopyShareActions() {
async function copyText() {
const content = document.getElementById("share-content")?.textContent;
if (content === undefined) return;
const content = getShareContentForClipboard((id) =>
document.getElementById(id),
);
if (content === null) return;
await navigator.clipboard.writeText(content);
toast.success("คัดลอกข้อความแล้ว");
}