-
Notifications
You must be signed in to change notification settings - Fork 66
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
Conversation
Size Change: 0 B Total Size: 1.22 MB ℹ️ View Unchanged
|
7a498c2
to
8f30422
Compare
src/form-engine.test.tsx
Outdated
@@ -842,15 +844,68 @@ describe('Form engine component', () => { | |||
}); | |||
}); | |||
|
|||
function renderForm(formUUID, formJson, intent?: string) { | |||
describe('Read only mode', () => { | |||
it('should ascertain that each field with readonly = true passed will not be editable', async () => { |
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.
it('should ascertain that each field with readonly = true passed will not be editable', async () => { | |
it('should ensure that each read-only field is not editable', async () => {', async () => { |
src/form-engine.test.tsx
Outdated
}); | ||
|
||
describe('Form view mode', () => { | ||
it('should ascertain that fields cannot be edited on view mode', async () => { |
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.
it('should ascertain that fields cannot be edited on view mode', async () => { | |
it('should ensure that the form isn't editable in view mode', async () => { |
inputs.forEach((input) => { | ||
expect(input).toHaveAttribute('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.
Can you also assert that the "Save" button is disabled?
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.
Added it on line 884
{ | ||
id: 'sampleQuestion', | ||
label: 'Question title', | ||
questionOptions: { | ||
concept: '193e8a03-1581-46e9-b0a4-17c55fa2649f', | ||
rendering: 'text', | ||
}, | ||
type: 'obs', | ||
}, |
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.
Do you need this?
{ | ||
id: 'sampleQuestion', | ||
label: 'Question title', | ||
questionOptions: { | ||
concept: '193e8a03-1581-46e9-b0a4-17c55fa2649f', | ||
rendering: 'text', | ||
}, | ||
type: 'obs', | ||
}, |
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.
Ditto
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.
src/form-engine.test.tsx
Outdated
expect(visitTypeDropdown).toHaveClass('cds--list-box__field'); | ||
|
||
const visitTypeWrapper = visitTypeDropdown.closest('.cds--dropdown'); | ||
expect(visitTypeWrapper).toHaveClass('cds--dropdown cds--dropdown--readonly cds--list-box'); |
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.
What happens if the CSS names change? Can you use attributes instead?
Requirements
Summary
O3-3937 Add test coverage around form readonly mode
Screenshots
Related Issue
https://openmrs.atlassian.net/browse/O3-3937
Other