feat : dreamgineer ask me try to use this and now im ran out of token sad [no ci]
This commit is contained in:
@@ -2,28 +2,29 @@ import { createElement } from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { GuideImageExport } from "@/components/public/guide-image-export";
|
||||
import { TakumiImageExport } from "@/components/public/takumi-image-export";
|
||||
import { exportFixtures } from "@/lib/image-export/fixtures";
|
||||
import { MaterialPoster } from "@/components/public/material-poster";
|
||||
import { ConstellationImage } from "@/components/public/constellation-image";
|
||||
import { ConstellationImage } from "@/lib/image-export/templates/constellation";
|
||||
import type { PublicGuide } from "@/lib/guides/queries";
|
||||
|
||||
describe("image export controls", () => {
|
||||
it("always offers both export modes even without notes", () => {
|
||||
const html = renderToStaticMarkup(<GuideImageExport fileName="guide.png">No notes</GuideImageExport>);
|
||||
const html = renderToStaticMarkup(<TakumiImageExport template={exportFixtures[0]} fileName="guide.png"/>);
|
||||
expect(html).toContain("ส่งออกภาพ");
|
||||
expect(html).toContain("ส่งออกภาพโดยไม่รวมโน้ต");
|
||||
expect(html.match(/<button\b/gu)).toHaveLength(2);
|
||||
});
|
||||
|
||||
it("shows only the Thai export button when no-note export is disabled", () => {
|
||||
const html = renderToStaticMarkup(<GuideImageExport fileName="guide.png" allowWithoutNotes={false}>Content</GuideImageExport>);
|
||||
const html = renderToStaticMarkup(<TakumiImageExport template={exportFixtures[0]} fileName="guide.png" allowWithoutNotes={false}/>);
|
||||
expect(html).toContain("ส่งออกภาพ");
|
||||
expect(html).not.toContain("ส่งออกภาพโดยไม่รวมโน้ต");
|
||||
expect(html.match(/<button\b/gu)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("disables both modes when an export selection is empty", () => {
|
||||
const html = renderToStaticMarkup(<GuideImageExport fileName="guide.png" disabled>No sections</GuideImageExport>);
|
||||
const html = renderToStaticMarkup(<TakumiImageExport template={exportFixtures[0]} fileName="guide.png" disabled/>);
|
||||
expect(html.match(/\sdisabled=""/gu)).toHaveLength(2);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user