feat : adding dialog to choose language

This commit is contained in:
2026-09-15 18:31:41 +07:00 Unverified
parent 0f48989e9c
commit d345b72b26
7 changed files with 182 additions and 6 deletions
+18
View File
@@ -17,6 +17,8 @@ describe("image export controls", () => {
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(4);
});
@@ -27,6 +29,22 @@ describe("image export controls", () => {
expect(html.match(/<button\b/gu)).toHaveLength(3);
});
it("hides the persistent language chooser when language is prompted on export", () => {
const html = renderToStaticMarkup(
<GuideImageExport
fileName="guide.png"
allowWithoutNotes={false}
showLanguageSelector={false}
promptForLanguage
>
Content
</GuideImageExport>,
);
expect(html).not.toContain("ภาษาในภาพส่งออก");
expect(html).not.toContain("English");
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>);
expect(html.match(/\sdisabled=""/gu)).toHaveLength(2);