Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

fix: fix ui language dropdown not being shown without also having skipped sentences #566

Merged
merged 1 commit into from
Nov 25, 2021
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
5 changes: 5 additions & 0 deletions web/src/components/profile/settings.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ test('should render title', async () => {
expect(screen.getByText('Settings')).toBeTruthy();
});

test('should render ui language section', async () => {
await renderWithLocalization(<Settings />);
expect(screen.getByText('Interface Language')).toBeTruthy();
});

test('should render error message', async () => {
(redux.useSelector as jest.Mock).mockImplementation(() => ({
showErrorMessage: true,
Expand Down
28 changes: 13 additions & 15 deletions web/src/components/profile/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ export default function Settings() {
dispatch(resetSkippedSentences());
};

if (!skippedSentences || skippedSentences.length === 0) {
return null;
}

const onLanguageSelect = (locale: string) => {
history.push(`/${locale}/profile`);
};
Expand Down Expand Up @@ -77,17 +73,19 @@ export default function Settings() {
)}
</section>

<section className="settings-section">
<Localized id="sc-settings-reset-skipped">
<h3></h3>
</Localized>
<Localized id="sc-settings-skipped-decription">
<p></p>
</Localized>
<button className="standalone" onClick={resetSkipped}>
<Localized id="sc-settings-show-all-button" />
</button>
</section>
{skippedSentences && skippedSentences.length > 0 && (
<section className="settings-section">
<Localized id="sc-settings-reset-skipped">
<h3></h3>
</Localized>
<Localized id="sc-settings-skipped-decription">
<p></p>
</Localized>
<button className="standalone" onClick={resetSkipped}>
<Localized id="sc-settings-show-all-button" />
</button>
</section>
)}
</section>
</section>
);
Expand Down