Skip to content

Commit

Permalink
Rename isPublic to userRegistrationRequired
Browse files Browse the repository at this point in the history
  • Loading branch information
aialok committed Jan 7, 2024
1 parent 3819bd8 commit c9f747c
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 27 deletions.
4 changes: 2 additions & 2 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"createSampleOrganization": "Create Sample Organization",
"description": "Description",
"location": "Location",
"isPublic": "Is Public",
"userRegistrationRequired": "User Registration Required",
"visibleInSearch": "Visible In Search",
"displayImage": "Display Image",
"enterName": "Enter Name",
Expand Down Expand Up @@ -468,7 +468,7 @@
"description": "Description",
"location": "Location",
"displayImage": "Display Image",
"isPublic": "Public",
"userRegistrationRequired": "User Registration Required",
"isVisibleInSearch": "Visible in Search",
"saveChanges": "Save Changes",
"enterNameOrganization": "Enter Organization Name",
Expand Down
4 changes: 2 additions & 2 deletions public/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"createSampleOrganization": "Créer une organisation d'exemple",
"description": "La description",
"location": "Emplacement",
"isPublic": "Est publique",
"userRegistrationRequired": "enregistrement requis",
"visibleInSearch": "Visible dans la recherche",
"displayImage": "Afficher l'image",
"enterName": "Entrez le nom",
Expand Down Expand Up @@ -465,7 +465,7 @@
"description": "La description",
"location": "emplacement",
"displayImage": "Afficher l'image",
"isPublic": "Public",
"userRegistrationRequired": "enregistrement requis",
"isVisibleInSearch": "Visible dans la recherche",
"saveChanges": "Sauvegarder les modifications",
"enterNameOrganization": "Entrez le nom de l'organisation",
Expand Down
4 changes: 2 additions & 2 deletions public/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"createSampleOrganization": " सैंपल संगठन बनाएं",
"description": "विवरण",
"location": "स्थान",
"isPublic": "सार्वजनिक है",
"userRegistrationRequired": "उपयोगकर्ता पंजीकरण आवश्यक",
"visibleInSearch": "खोज में दृश्यमान",
"displayImage": "प्रदर्शन छवि",
"enterName": "नाम दर्ज करें",
Expand Down Expand Up @@ -464,7 +464,7 @@
"description": "विवरण",
"location": "जगह",
"displayImage": "प्रदर्शन छवि",
"isPublic": "सार्वजनिक",
"userRegistrationRequired": "उपयोगकर्ता पंजीकरण आवश्यक",
"isVisibleInSearch": "खोज में दिखाए जा सकते हैं",
"saveChanges": "परिवर्तनों को सुरक्षित करें",
"cancel": "रद्द करना",
Expand Down
4 changes: 2 additions & 2 deletions public/locales/sp.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"createSampleOrganization": "Crear organización de muestra",
"description": "Descripción",
"location": "Ubicación",
"isPublic": "Es público",
"userRegistrationRequired": "Registro de usuario requerido",
"visibleInSearch": "Visible en la búsqueda",
"displayImage": "Mostrar imagen",
"enterName": "Ingrese su nombre",
Expand Down Expand Up @@ -464,7 +464,7 @@
"description": "Descripción",
"location": "ubicación",
"displayImage": "Mostrar imagen",
"isPublic": "Público",
"userRegistrationRequired": "Registro de usuario requerido",
"isVisibleInSearch": "Visible en la búsqueda",
"saveChanges": "Guardar cambios",
"cancel": "Cancelar",
Expand Down
4 changes: 2 additions & 2 deletions public/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"createSampleOrganization": "创建示范组织",
"description": "描述",
"location": "地點",
"isPublic": "是否公開",
"isPubluserRegistrationRequiredic": "需要用户注册",
"visibleInSearch": "在搜索中可見",
"displayImage": "顯示圖像",
"enterName": "输入名字",
Expand Down Expand Up @@ -464,7 +464,7 @@
"description": "描述",
"location": "地點",
"displayImage": "顯示圖像",
"isPublic": "公开",
"userRegistrationRequired": "需要用户注册",
"isVisibleInSearch": "在搜索中可见",
"saveChanges": "保存更改",
"cancel": "取消",
Expand Down
19 changes: 11 additions & 8 deletions src/components/OrgUpdate/OrgUpdate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,22 @@ describe('Testing Organization Update', () => {
expect(screen.getByText('Description')).toBeInTheDocument();
expect(screen.getByText('Location')).toBeInTheDocument();
expect(screen.getByText('Display Image:')).toBeInTheDocument();
expect(screen.getByText('Public:')).toBeInTheDocument();
expect(screen.getByText(/Registration/)).toBeInTheDocument();
expect(screen.getByText('Visible in Search:')).toBeInTheDocument();

// Get the input fields, and btns
const name = screen.getByPlaceholderText(/Enter Organization Name/i);
const des = screen.getByPlaceholderText(/Description/i);
const location = screen.getByPlaceholderText(/Location/i);
const isPublic = screen.getByPlaceholderText(/Public/i);
const userRegistrationRequired =
screen.getByPlaceholderText(/Registration/i);
const isVisible = screen.getByPlaceholderText(/Visible/i);

// Checking if form fields got updated according to the mock data
expect(name).toHaveValue('Palisadoes');
expect(des).toHaveValue('Equitable Access to STEM Education Jobs');
expect(location).toHaveValue('Jamaica');
expect(isPublic).toBeChecked();
expect(userRegistrationRequired).toBeChecked();
expect(isVisible).not.toBeChecked();
});

Expand All @@ -90,7 +91,8 @@ describe('Testing Organization Update', () => {
const des = screen.getByPlaceholderText(/Description/i);
const location = screen.getByPlaceholderText(/Location/i);
const displayImage = screen.getByPlaceholderText(/Display Image/i);
const isPublic = screen.getByPlaceholderText(/Public/i);
const userRegistrationRequired =
screen.getByPlaceholderText(/Registration/i);
const isVisible = screen.getByPlaceholderText(/Visible/i);
const saveChangesBtn = screen.getByText(/Save Changes/i);

Expand All @@ -104,7 +106,7 @@ describe('Testing Organization Update', () => {
userEvent.type(des, formData.description);
userEvent.type(location, formData.location);
userEvent.upload(displayImage, formData.displayImage);
userEvent.click(isPublic);
userEvent.click(userRegistrationRequired);
userEvent.click(isVisible);

await wait();
Expand All @@ -115,7 +117,7 @@ describe('Testing Organization Update', () => {
expect(des).toHaveValue(formData.description);
expect(location).toHaveValue(formData.location);
expect(displayImage).toBeTruthy();
expect(isPublic).not.toBeChecked();
expect(userRegistrationRequired).not.toBeChecked();
expect(isVisible).toBeChecked();
});

Expand Down Expand Up @@ -151,7 +153,8 @@ describe('Testing Organization Update', () => {
const des = screen.getByPlaceholderText(/Description/i);
const location = screen.getByPlaceholderText(/Location/i);
const displayImage = screen.getByPlaceholderText(/Display Image/i);
const isPublic = screen.getByPlaceholderText(/Public/i);
const userRegistrationRequired =
screen.getByPlaceholderText(/Registration/i);
const isVisible = screen.getByPlaceholderText(/Visible/i);
const saveChangesBtn = screen.getByText(/Save Changes/i);

Expand All @@ -165,7 +168,7 @@ describe('Testing Organization Update', () => {
userEvent.type(des, formData.description);
userEvent.type(location, formData.location);
userEvent.upload(displayImage, formData.displayImage);
userEvent.click(isPublic);
userEvent.click(userRegistrationRequired);
userEvent.click(isVisible);

await wait();
Expand Down
6 changes: 4 additions & 2 deletions src/components/OrgUpdate/OrgUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,11 @@ function orgUpdate(props: InterfaceOrgUpdateProps): JSX.Element {
/>
<Row>
<Col sm={6} className="d-flex mb-3">
<Form.Label className="me-3">{t('isPublic')}:</Form.Label>
<Form.Label className="me-3">
{t('userRegistrationRequired')}:
</Form.Label>
<Form.Switch
placeholder={t('isPublic')}
placeholder={t('userRegistrationRequired')}
checked={publicchecked}
onChange={(): void => setPublicChecked(!publicchecked)}
/>
Expand Down
8 changes: 4 additions & 4 deletions src/screens/OrgList/OrgList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe('Organisations Page testing as SuperAdmin', () => {
formData.description
);
userEvent.type(screen.getByPlaceholderText(/Location/i), formData.location);
userEvent.click(screen.getByTestId(/isPublic/i));
userEvent.click(screen.getByTestId(/userRegistrationRequired/i));
userEvent.click(screen.getByTestId(/visibleInSearch/i));
userEvent.upload(screen.getByLabelText(/Display Image/i), formData.image);

Expand All @@ -180,7 +180,7 @@ describe('Organisations Page testing as SuperAdmin', () => {
expect(screen.getByPlaceholderText(/Location/i)).toHaveValue(
formData.location
);
expect(screen.getByTestId(/isPublic/i)).not.toBeChecked();
expect(screen.getByTestId(/userRegistrationRequired/i)).not.toBeChecked();
expect(screen.getByTestId(/visibleInSearch/i)).toBeChecked();
expect(screen.getByLabelText(/Display Image/i)).toBeTruthy();

Expand Down Expand Up @@ -228,7 +228,7 @@ describe('Organisations Page testing as SuperAdmin', () => {
formData.description
);
userEvent.type(screen.getByPlaceholderText(/Location/i), formData.location);
userEvent.click(screen.getByTestId(/isPublic/i));
userEvent.click(screen.getByTestId(/userRegistrationRequired/i));
userEvent.click(screen.getByTestId(/visibleInSearch/i));
userEvent.upload(screen.getByLabelText(/Display Image/i), formData.image);

Expand All @@ -241,7 +241,7 @@ describe('Organisations Page testing as SuperAdmin', () => {
expect(screen.getByPlaceholderText(/Location/i)).toHaveValue(
formData.location
);
expect(screen.getByTestId(/isPublic/i)).not.toBeChecked();
expect(screen.getByTestId(/userRegistrationRequired/i)).not.toBeChecked();
expect(screen.getByTestId(/visibleInSearch/i)).toBeChecked();
expect(screen.getByLabelText(/Display Image/i)).toBeTruthy();

Expand Down
8 changes: 5 additions & 3 deletions src/screens/OrgList/OrgList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,12 @@ function orgList(): JSX.Element {

<Row className="mb-3">
<Col>
<Form.Label htmlFor="ispublic">{t('isPublic')}</Form.Label>
<Form.Label htmlFor="userRegistrationRequired">
{t('userRegistrationRequired')}
</Form.Label>
<Form.Switch
id="ispublic"
data-testid="isPublic"
id="userRegistrationRequired"
data-testid="userRegistrationRequired"
type="checkbox"
defaultChecked={formState.ispublic}
onChange={(): void =>
Expand Down

0 comments on commit c9f747c

Please sign in to comment.