feat : improve preview for export dialog

This commit is contained in:
2026-09-28 19:57:47 +07:00 Unverified
parent 63341e892b
commit 5b283288f0
6 changed files with 66 additions and 21 deletions
+15 -1
View File
@@ -28,6 +28,8 @@ describe("image export controls", () => {
/>,
);
expect(html).toContain("เปรียบเทียบอาวุธ Raiden");
expect(html).toContain("Raiden’s Weapon Comparison");
expect(html).not.toContain("Condition 1");
expect(html).not.toContain("เงื่อนไข 1");
});
@@ -44,6 +46,17 @@ describe("image export controls", () => {
expect(html.match(/<button\b/gu)).toHaveLength(1);
});
it("renders a direct export trigger without settings UI", () => {
const html = renderToStaticMarkup(
<GuideImageExport fileName="poster.png" modeSelection="direct">
Poster
</GuideImageExport>,
);
expect(html).toContain("ส่งออกภาพ");
expect(html).not.toContain("ตั้งค่าการส่งออกภาพ");
expect(html.match(/<button\b/gu)).toHaveLength(1);
});
it("shows all settings inline with one export action inside an existing dialog", () => {
const html = renderToStaticMarkup(
<GuideImageExport fileName="guide.png" modeSelection="inline">
@@ -55,6 +68,7 @@ describe("image export controls", () => {
expect(html).toContain("ไทย");
expect(html).toContain("English");
expect(html).toContain("ตัวอย่างภาพส่งออก");
expect(html).toContain("h-[clamp(8rem,50svh,32rem)]");
expect(html).toContain('data-slot="dialog-footer"');
expect(html).toContain("sticky bottom-0");
expect(html.match(/>ส่งออกภาพ<\/button>/gu)).toHaveLength(1);
@@ -86,7 +100,7 @@ describe("image export controls", () => {
const group = { rows: [], note } as unknown as PublicGuide["constellationGroups"][number];
const html = renderToStaticMarkup(createElement(ConstellationImage, { guide, group }));
expect(html).toContain("Raiden’s Constellations");
expect(html).not.toContain("กลุ่มดาวของ Raiden");
expect(html).toContain("กลุ่มดาว Raiden");
expect(html).toContain("Team Damage");
expect(html).toContain("ดาเมจทั้งทีม");
expect(html).toContain('data-export-note="true"');