Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

CynthiaKamau
Copy link
Contributor

@CynthiaKamau CynthiaKamau commented Sep 25, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

O3-3937 Add test coverage around form readonly mode

Screenshots

Related Issue

https://openmrs.atlassian.net/browse/O3-3937

Other

Copy link

github-actions bot commented Sep 25, 2024

Size Change: 0 B

Total Size: 1.15 MB

ℹ️ View Unchanged
Filename Size
dist/151.js 300 kB
dist/225.js 2.57 kB
dist/277.js 1.84 kB
dist/300.js 642 B
dist/335.js 968 B
dist/353.js 3.02 kB
dist/41.js 3.37 kB
dist/422.js 6.8 kB
dist/501.js 108 kB
dist/540.js 2.63 kB
dist/55.js 758 B
dist/572.js 252 kB
dist/617.js 86.9 kB
dist/635.js 14.3 kB
dist/70.js 483 B
dist/901.js 11.8 kB
dist/99.js 691 B
dist/993.js 3.09 kB
dist/main.js 342 kB
dist/openmrs-esm-form-engine-lib.js 3.67 kB

compressed-size-action

Comment on lines 219 to 244
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',
);
});
});
Copy link
Member

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.

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants