-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a language picker to the header of the website. This will allow users to switch between languages.
- Loading branch information
Showing
15 changed files
with
392 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/frontend/apps/standalone_site/src/assets/svg/logo_marsha.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/frontend/apps/standalone_site/src/features/Language/components/LanguagePicker.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { screen } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import { render } from 'lib-tests'; | ||
|
||
import { useLanguageStore } from '../store/languageStore'; | ||
|
||
import LanguagePicker from './LanguagePicker'; | ||
|
||
describe('<LanguagePicker />', () => { | ||
beforeEach(() => {}); | ||
|
||
it('renders LanguagePicker', async () => { | ||
render(<LanguagePicker />); | ||
expect(screen.getByText(/language/i)).toBeInTheDocument(); | ||
|
||
const select = screen.getByLabelText(/Language Picker; Selected: en/i); | ||
expect(select).toBeInTheDocument(); | ||
await userEvent.click(select); | ||
expect(screen.getByText(/Français/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/English/i)).toBeInTheDocument(); | ||
}); | ||
|
||
it('changes to another language', async () => { | ||
render(<LanguagePicker />); | ||
|
||
await userEvent.click( | ||
screen.getByLabelText(/Language Picker; Selected: en/i), | ||
); | ||
|
||
await userEvent.click(screen.getByText(/Français/i)); | ||
expect( | ||
screen.getByLabelText(/Language Picker; Selected: fr/i), | ||
).toBeInTheDocument(); | ||
|
||
expect(useLanguageStore.getState().language).toEqual('fr_FR'); | ||
}); | ||
}); |
Oops, something went wrong.