-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(test) O3-3937 Add test coverage around form readonly mode #401
base: main
Are you sure you want to change the base?
Conversation
Size Change: 0 B Total Size: 1.15 MB ℹ️ View Unchanged
|
src/form-engine.test.tsx
Outdated
describe('Read only mode', () => { | ||
it('should ascertain that each field with readonly = true passed will not be editable', async () => { | ||
await act(async () => { | ||
renderForm(null, readOnlyValidationForm); | ||
}); | ||
|
||
const visitTypeDropdown = screen.getByRole('combobox', { | ||
name: /visit type/i, | ||
}); | ||
const visitPunctualityTextbox = screen.getByLabelText(/visit punctuality/i); | ||
|
||
expect(visitTypeDropdown).toBeInTheDocument(); | ||
expect(visitTypeDropdown).toHaveClass('cds--list-box__field'); | ||
|
||
const visitTypeWrapper = visitTypeDropdown.closest('.cds--dropdown'); | ||
expect(visitTypeWrapper).toHaveClass('cds--dropdown cds--dropdown--readonly cds--list-box'); | ||
|
||
expect(visitPunctualityTextbox).toBeInTheDocument(); | ||
expect(visitPunctualityTextbox).toHaveClass('cds--text-input'); | ||
|
||
const visitPunctualityWrapper = visitPunctualityTextbox.closest('.cds--text-input-wrapper'); | ||
expect(visitPunctualityWrapper).toHaveClass( | ||
'cds--form-item cds--text-input-wrapper cds--text-input-wrapper--readonly', | ||
); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love tests but this test is supposed to be testing a form rendered in "view" mode. I've updated the ticket to clearly reflect this. (sorry for the confusion)
The form-engine supports three major modes: enter (new), edit and view (readonly). This ticket is meant for adding test coverage of the form’s behaviour while in view mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, let me do a rework
de82e10
to
7a498c2
Compare
Requirements
Summary
O3-3937 Add test coverage around form readonly mode
Screenshots
Related Issue
https://openmrs.atlassian.net/browse/O3-3937
Other