test: cover share authentication and copy behavior
This commit is contained in:
@@ -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("คัดลอกข้อความแล้ว");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user