Skip to content

Commit

Permalink
data-test id added in pending admin part (#131)
Browse files Browse the repository at this point in the history
* data-testid added in pending admin part

* roles part updated

* select option and modal data-testid updated

* change in data-testid (btn to button)
  • Loading branch information
Ajay-aot authored Jan 19, 2024
1 parent effe444 commit 9211a9e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
14 changes: 9 additions & 5 deletions forms-flow-admin/src/components/roles/roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,14 @@ const Roles = React.memo((props: any) => {
<button
type="button"
className="btn btn-link text-dark" onClick={handleCloseDeleteModal}
data-testid="roles-cancel-delete-btn">
data-testid="roles-cancel-delete-button">
{t("Cancel")}
</button>
<Button
variant="danger"
disabled={disabled}
onClick={() => deleteRole(deleteCandidate)}
data-testid="roles-confirm-delete-btn"
data-testid="roles-confirm-delete-button"
>
{t("Delete")}
</Button>
Expand Down Expand Up @@ -310,14 +310,15 @@ const Roles = React.memo((props: any) => {
</Modal.Body>
<Modal.Footer>
<button type="button"
className="btn btn-link text-dark" onClick={handleCloseRoleModal}>
className="btn btn-link text-dark" onClick={handleCloseRoleModal} data-testid="create-new-role-modal-cancel-button">
{t("Cancel")}
</button>
<Button
variant="primary"
disabled={disabled}
onClick={handleCreateRole}
type="submit"
data-testid="create-new-role-modal-submit-button"
>
{t("Create")}
</Button>
Expand Down Expand Up @@ -358,14 +359,15 @@ const Roles = React.memo((props: any) => {
</Modal.Body>
<Modal.Footer>
<button type="button"
className="btn btn-link text-dark" onClick={handleCloseEditRoleModal}>
className="btn btn-link text-dark" onClick={handleCloseEditRoleModal} data-testid="edit-role-modal-cancel-button">
{t("Cancel")}
</button>
<Button
variant="primary"
disabled={disabled}
onClick={handleUpdateRole}
type="submit"
data-testid="edit-role-modal-save-button"
>
{t("Save")}
</Button>
Expand Down Expand Up @@ -538,6 +540,7 @@ const Roles = React.memo((props: any) => {
onChange={handlFilter}
value={search}
title={t("Search...")}
data-testid="search-role-input"
/>

{search.length > 0 && (
Expand All @@ -547,12 +550,13 @@ const Roles = React.memo((props: any) => {
setSerach("");
setRoles(props.roles);
}}
data-testid="clear-role-search-button"
>
{t("Clear")}
</Button>
)}
</div>
<Button variant="primary" onClick={handleShowRoleModal}>
<Button variant="primary" onClick={handleShowRoleModal} data-testid="roles-create-new-role-button">
<i className="fa-solid fa-plus me-2"></i> <Translation>{(t) => t("Create New Role")}</Translation>
</Button>
</div>
Expand Down
12 changes: 9 additions & 3 deletions forms-flow-admin/src/components/users/users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,15 @@ const Users = React.memo((props: any) => {
onChange={handleSearch}
value={props.search || ""}
title={t("Search...")}
data-testid="search-users-input"
/>
{props.search?.length > 0 && (
<Button
variant="outline-secondary btn-small clear"
onClick={() => {
props.setSearch("");
}}
data-testid="clear-users-search-button"
>
{t("Clear")}
</Button>
Expand All @@ -352,12 +354,16 @@ const Users = React.memo((props: any) => {

<div className="user-filter-container col-lg-4 col-xl-4 col-md-4 col-sm-6 col-12 d-flex justify-content-end gap-2">
<span className="my-2">{t("Filter By:")} </span>
<Form.Select className="bg-light text-dark" onChange={handleSelectFilter} title={t("Filter here")}>
<option value="ALL" selected={!props.filter}>
<Form.Select
className="bg-light text-dark"
onChange={handleSelectFilter}
title={t("Filter here")}
data-testid="users-roles-filter-select">
<option value="ALL" selected={!props.filter} data-testid="users-roles-filter-option-all">
{t("All roles")}
</option>
{roles?.map((role, i) => (
<option key={i} value={role.name}>
<option key={i} value={role.name} data-testid={`users-roles-filter-option-${i}`}>
{role.name}
</option>
))}
Expand Down

0 comments on commit 9211a9e

Please sign in to comment.