Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions web/src/components/core/InstallerOptions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,15 @@ describe("InstallerOptions", () => {
jest.spyOn(utils, "localConnection").mockReturnValue(false);
});

it("does not render keymap value in the toggle button", () => {
installerRender(<InstallerOptions />, { withL10n: true });
const toggle = screen.getByRole("button", {
name: "Change display language",
});
expect(toggle).toHaveTextContent("Deutsch");
expect(toggle).not.toHaveTextContent("us");
});

it("does not allow setting the keyboard layout", async () => {
const { user } = await renderAndOpen();
const dialog = screen.getByRole("dialog");
Expand Down
30 changes: 17 additions & 13 deletions web/src/components/core/InstallerOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -469,19 +469,6 @@ const CenteredContent = ({
</Flex>
);

/** Toggle button for accessing both language and keyboard layout settings. */
const AllSettingsToggle = ({ onClick, language, keymap }: ToggleProps) => (
<Button
onClick={onClick}
aria-label={_("Change display language and keyboard layout")}
variant="plain"
>
<CenteredContent>
<LanguageIcon /> {language} <KeyboardIcon /> <code>{keymap}</code>
</CenteredContent>
</Button>
);

/** Toggle button for accessing only language settings. */
const LanguageOnlyToggle = ({ onClick, language }: ToggleProps) => (
<Button onClick={onClick} aria-label={_("Change display language")} variant="plain">
Expand All @@ -500,6 +487,23 @@ const KeyboardOnlyToggle = ({ onClick, keymap }: ToggleProps) => (
</Button>
);

/** Toggle button for accessing both language and keyboard layout settings. */
const AllSettingsToggle = ({ onClick, language, keymap }: ToggleProps) => {
if (!localConnection()) return <LanguageOnlyToggle onClick={onClick} language={language} />;

return (
<Button
onClick={onClick}
aria-label={_("Change display language and keyboard layout")}
variant="plain"
>
<CenteredContent>
<LanguageIcon /> {language} <KeyboardIcon /> <code>{keymap}</code>
</CenteredContent>
</Button>
);
};

/**
* Maps each dialog variant to its corresponding React component.
*/
Expand Down