Skip to content

Commit

Permalink
pagination and placeholder 2117 (#2297)
Browse files Browse the repository at this point in the history
* pagination and placeholder

* linting and language translation

* code rabbit suggestions

* test fix
  • Loading branch information
prayanshchh authored Sep 28, 2024
1 parent e009361 commit 895e094
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 8 deletions.
3 changes: 2 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,8 @@
"organizations": "Organizations",
"search": "search",
"filter": "filter",
"searchByName": "searchByName"
"searchByName": "searchByName",
"searchOrganizations": "Search Organization"
},
"userSidebarOrg": {
"yourOrganizations": "Your Organizations",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,8 @@
"organizations": "Organisations",
"search": "Rechercher",
"filter": "Filtrer",
"searchByName": "Rechercher par nom"
"searchByName": "Rechercher par nom",
"searchOrganizations": "Rechercher Organisations"
},
"userSidebarOrg": {
"yourOrganizations": "Vos organisations",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,8 @@
"organizations": "संगठनों",
"search": "खोजें",
"filter": "फ़िल्टर",
"searchByName": "नाम से खोजें"
"searchByName": "नाम से खोजें",
"searchOrganizations": "संगठनों खोजें"
},
"userSidebarOrg": {
"yourOrganizations": "आपके संगठन",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/sp/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,8 @@
"filter": "Filtrar",
"organizations": "Organizaciones",
"searchByName": "Buscar por nombre",
"searchUsers": "Buscar usuarios"
"searchUsers": "Buscar usuarios",
"searchOrganizations": "Buscar Organizaciones"
},
"userSidebarOrg": {
"yourOrganizations": "Tus Organizaciones",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,8 @@
"organizations": "组织机构",
"search": "搜索",
"filter": "筛选",
"searchByName": "按名称搜索"
"searchByName": "按名称搜索",
"searchOrganizations": "搜索组织"
},
"userSidebarOrg": {
"yourOrganizations": "您的组织",
Expand Down
1 change: 0 additions & 1 deletion src/components/PaginationList/PaginationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const PaginationList = ({
<Hidden smDown initialWidth={'lg'}>
<TablePagination
rowsPerPageOptions={[
-1,
5,
10,
30,
Expand Down
40 changes: 40 additions & 0 deletions src/screens/UserPortal/Organizations/Organizations.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -519,4 +519,44 @@ describe('Testing Organizations Screen [User Portal]', () => {
settingsBtn.click();
});
});
test('Rows per Page values', async () => {
render(
<MockedProvider addTypename={false} link={link}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<Organizations />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>,
);
await wait();
const dropdown = screen.getByTestId('table-pagination');
userEvent.click(dropdown);
expect(screen.queryByText('-1')).not.toBeInTheDocument();
expect(screen.getByText('5')).toBeInTheDocument();
expect(screen.getByText('10')).toBeInTheDocument();
expect(screen.getByText('30')).toBeInTheDocument();
expect(screen.getByText('All')).toBeInTheDocument();
});

test('Search input has correct placeholder text', async () => {
render(
<MockedProvider addTypename={false} link={link}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<Organizations />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>,
);

await wait();

const searchInput = screen.getByPlaceholderText('Search Organization');
expect(searchInput).toBeInTheDocument();
});
});
4 changes: 2 additions & 2 deletions src/screens/UserPortal/Organizations/Organizations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ export default function organizations(): JSX.Element {
<div className="mt-4">
<InputGroup className={styles.maxWidth}>
<Form.Control
placeholder={t('searchUsers')}
id="searchUserOrgs"
placeholder={t('searchOrganizations')}
id="searchOrganizations"
type="text"
className={`${styles.borderNone} ${styles.backgroundWhite}`}
onKeyUp={handleSearchByEnter}
Expand Down

0 comments on commit 895e094

Please sign in to comment.