@openmrs/esm-form-engine-lib 2.1.0-pre.1462 → 2.1.0-pre.1464
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{5bad9d4a3f2bed27/5bad9d4a3f2bed27.gz → 5948f6a2f7307d43/5948f6a2f7307d43.gz} +0 -0
- package/a5554c5d36ee0258/a5554c5d36ee0258.gz +0 -0
- package/package.json +1 -1
- package/src/components/inputs/multi-select/multi-select.test.tsx +9 -11
- package/cfeaf25d976dbd2e/cfeaf25d976dbd2e.gz +0 -0
- /package/{9b51d62ae699c65c/9b51d62ae699c65c.gz → cccd29dacee5e078/cccd29dacee5e078.gz} +0 -0
- /package/{8f9d17c6bed90e8b/8f9d17c6bed90e8b.gz → e8833b3751c12211/e8833b3751c12211.gz} +0 -0
Binary file
|
Binary file
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { act, render, screen } from '@testing-library/react';
|
3
|
-
import
|
3
|
+
import userEvent from '@testing-library/user-event'; // Correct import for userEvent
|
4
4
|
import { type FetchResponse, openmrsFetch, usePatient, useSession } from '@openmrs/esm-framework';
|
5
5
|
import { type FormSchema } from '../../../types';
|
6
6
|
import { mockPatient } from '__mocks__/patient.mock';
|
@@ -31,7 +31,7 @@ jest.mock('../../../api', () => {
|
|
31
31
|
});
|
32
32
|
|
33
33
|
const renderForm = async () => {
|
34
|
-
await act(() =>
|
34
|
+
await act(async () => {
|
35
35
|
render(
|
36
36
|
<FormEngine
|
37
37
|
formJson={multiSelectFormSchema as unknown as FormSchema}
|
@@ -40,11 +40,11 @@ const renderForm = async () => {
|
|
40
40
|
formSessionIntent={undefined}
|
41
41
|
visit={visit}
|
42
42
|
/>,
|
43
|
-
)
|
44
|
-
);
|
43
|
+
);
|
44
|
+
});
|
45
45
|
};
|
46
46
|
|
47
|
-
describe
|
47
|
+
describe('MultiSelect Component', () => {
|
48
48
|
beforeEach(() => {
|
49
49
|
mockOpenmrsFetch.mockResolvedValue({
|
50
50
|
data: { results: [{ ...multiSelectFormSchema }] },
|
@@ -69,22 +69,20 @@ describe.skip('MultiSelect Component', () => {
|
|
69
69
|
it('should disable checkbox option if the field value depends on evaluates the expression to true', async () => {
|
70
70
|
const user = userEvent.setup();
|
71
71
|
await renderForm();
|
72
|
-
|
73
72
|
await user.click(screen.getByRole('combobox', { name: /Patient covered by NHIF/i }));
|
74
73
|
await user.click(screen.getByRole('option', { name: /no/i }));
|
75
|
-
|
76
74
|
await user.click(screen.getByText('Was this visit scheduled?'));
|
77
|
-
|
75
|
+
const unscheduledVisitOption = screen.getByRole('option', { name: /Unscheduled visit early/i });
|
76
|
+
expect(unscheduledVisitOption).toHaveAttribute('disabled');
|
78
77
|
});
|
79
78
|
|
80
79
|
it('should enable checkbox option if the field value depends on evaluates the expression to false', async () => {
|
81
80
|
const user = userEvent.setup();
|
82
81
|
await renderForm();
|
83
|
-
|
84
82
|
await user.click(screen.getByRole('combobox', { name: /patient covered by nhif/i }));
|
85
83
|
await user.click(screen.getByRole('option', { name: /yes/i }));
|
86
|
-
|
87
84
|
await user.click(screen.getByText('Was this visit scheduled?'));
|
88
|
-
|
85
|
+
const unscheduledVisitOption = screen.getByRole('option', { name: /Unscheduled visit early/i });
|
86
|
+
expect(unscheduledVisitOption).not.toBeDisabled();
|
89
87
|
});
|
90
88
|
});
|
Binary file
|
File without changes
|
File without changes
|