feat : improve export image dialog

This commit is contained in:
2026-09-20 19:02:46 +07:00 Unverified
parent 71bc247b73
commit bde2f1d09e
5 changed files with 96 additions and 175 deletions
+9 -10
View File
@@ -31,30 +31,29 @@ describe("image export controls", () => {
expect(html).not.toContain("เงื่อนไข 1");
});
it("shows one export action when both note modes are available", () => {
it("shows one export trigger and keeps settings in its dialog", () => {
const html = renderToStaticMarkup(<GuideImageExport fileName="guide.png">No notes</GuideImageExport>);
expect(html).toContain("ส่งออกภาพ");
expect(html).toContain("ไทย");
expect(html).toContain("English");
expect(html).toContain('data-language-flag="th"');
expect(html).toContain('data-language-flag="en"');
expect(html.match(/<button\b/gu)).toHaveLength(3);
expect(html.match(/<button\b/gu)).toHaveLength(1);
});
it("shows only one export action when no-note export is disabled", () => {
const html = renderToStaticMarkup(<GuideImageExport fileName="guide.png" allowWithoutNotes={false}>Content</GuideImageExport>);
expect(html).toContain("ส่งออกภาพ");
expect(html.match(/<button\b/gu)).toHaveLength(3);
expect(html.match(/<button\b/gu)).toHaveLength(1);
});
it("can show note modes inline inside an existing dialog", () => {
it("shows all settings inline with one export action inside an existing dialog", () => {
const html = renderToStaticMarkup(
<GuideImageExport fileName="guide.png" modeSelection="inline">
Content
</GuideImageExport>,
);
expect(html).toContain("ส่งออกภาพโดยไม่รวมโน้ต");
expect(html.match(/<button\b/gu)).toHaveLength(4);
expect(html).toContain("รวมโน้ต");
expect(html).toContain("ไม่รวมโน้ต");
expect(html).toContain("ไทย");
expect(html).toContain("English");
expect(html.match(/>ส่งออกภาพ<\/button>/gu)).toHaveLength(1);
});
it("hides the persistent language chooser when language is prompted on export", () => {