-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UIU-2951: ECS - Prevent editing of specific shadow user data
- Loading branch information
1 parent
5ec0743
commit c703098
Showing
16 changed files
with
133 additions
and
44 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,4 +76,11 @@ describe('Render Edit contact Information component', () => { | |
await userEvent.type(document.querySelector('[id="adduser_email"]'), '[email protected]'); | ||
expect(document.querySelector('[id="adduser_email"]').value).toBe('[email protected]'); | ||
}); | ||
it('should render with disabled fields', () => { | ||
renderEditContactInfo({ ...props, disabled: true }); | ||
expect(document.querySelector('[id="adduser_email"]')).toBeDisabled(); | ||
expect(document.querySelector('[id="adduser_phone"]')).toBeDisabled(); | ||
expect(document.querySelector('[id="adduser_mobilePhone"]')).toBeDisabled(); | ||
expect(document.querySelector('[id="adduser_preferredcontact"]')).toBeDisabled(); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -10,4 +10,9 @@ | |
&:focus { | ||
outline: none; | ||
} | ||
|
||
&:disabled { | ||
color: var(--checkable-disabled-fill); | ||
cursor: not-allowed; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ jest.unmock('@folio/stripes/smart-components'); | |
|
||
const renderCreateResetPasswordControl = (props) => renderWithRouter(<CreateResetPasswordControl {...props} />); | ||
|
||
const propData = (postMock) => { | ||
const propData = (postMock, disabled = false) => { | ||
return { | ||
email: '[email protected]', | ||
name: 'sample', | ||
|
@@ -22,6 +22,7 @@ const propData = (postMock) => { | |
POST: postMock, | ||
} | ||
}, | ||
disabled, | ||
}; | ||
}; | ||
|
||
|
@@ -42,6 +43,13 @@ describe('CreateResetPasswordControl component', () => { | |
await waitFor(() => userEvent.click(screen.getByText('ui-users.extended.sendResetPassword'))); | ||
await waitFor(() => expect(screen.getByText('ui-users.extended.copyLink')).toBeInTheDocument()); | ||
}); | ||
it('should link be disabled', () => { | ||
const mockFunc = jest.fn(() => new Promise((resolve, _) => { | ||
resolve({ ok: true, link: 'bl-users/password-reset/link' }); | ||
})); | ||
renderCreateResetPasswordControl(propData(mockFunc, true)); | ||
expect(screen.getByText('ui-users.extended.sendResetPassword')).toBeDisabled(); | ||
}); | ||
/* Can be uncommented after the createResetpasswordControl modal logic is reworked. Should add an assertion at the end after the results */ | ||
// it('If it redirects after POST fails', async () => { | ||
// const mockFunc = jest.fn(() => new Promise((_, reject) => { | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,4 +120,8 @@ describe('Render Extended User Information component', () => { | |
renderEditExtendedInfo(props); | ||
expect(screen.getByText('[email protected]')).toBeInTheDocument(); | ||
}); | ||
it('should fields to be disabled', () => { | ||
renderEditExtendedInfo(props); | ||
expect(screen.getByText(props.username)).toBeDisabled(); | ||
}); | ||
}); |
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
Oops, something went wrong.