@openmrs/esm-patient-programs-app 3.1.0 → 3.1.1-pre.1097
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/dist/119.js +2 -0
- package/dist/119.js.map +1 -0
- package/dist/313.js +1 -1
- package/dist/363.js +2 -0
- package/dist/363.js.map +1 -0
- package/dist/440.js +2 -0
- package/dist/440.js.map +1 -0
- package/dist/47.js +3 -0
- package/dist/{628.js.LICENSE.txt → 47.js.LICENSE.txt} +0 -0
- package/dist/47.js.map +1 -0
- package/dist/539.js +1 -1
- package/dist/600.js +1 -1
- package/dist/600.js.map +1 -1
- package/dist/678.js +2 -0
- package/dist/{943.js.map → 678.js.map} +1 -1
- package/dist/754.js +1 -1
- package/dist/754.js.map +1 -1
- package/dist/openmrs-esm-patient-programs-app.js +1 -1
- package/dist/openmrs-esm-patient-programs-app.js.buildmanifest.json +93 -94
- package/dist/openmrs-esm-patient-programs-app.js.map +1 -1
- package/package.json +3 -3
- package/src/programs/programs-form.component.tsx +3 -16
- package/src/programs/programs-form.test.tsx +3 -13
- package/dist/482.js +0 -2
- package/dist/482.js.map +0 -1
- package/dist/628.js +0 -3
- package/dist/628.js.map +0 -1
- package/dist/9.js +0 -2
- package/dist/9.js.map +0 -1
- package/dist/943.js +0 -2
- package/dist/968.js +0 -2
- package/dist/968.js.map +0 -1
|
@@ -6,14 +6,7 @@ import includes from 'lodash-es/includes';
|
|
|
6
6
|
import map from 'lodash-es/map';
|
|
7
7
|
import styles from './programs-form.scss';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
9
|
-
import {
|
|
10
|
-
createErrorHandler,
|
|
11
|
-
detach,
|
|
12
|
-
showNotification,
|
|
13
|
-
showToast,
|
|
14
|
-
useSessionUser,
|
|
15
|
-
useLocations,
|
|
16
|
-
} from '@openmrs/esm-framework';
|
|
9
|
+
import { createErrorHandler, showNotification, showToast, useSessionUser, useLocations } from '@openmrs/esm-framework';
|
|
17
10
|
import {
|
|
18
11
|
Button,
|
|
19
12
|
DatePicker,
|
|
@@ -25,13 +18,9 @@ import {
|
|
|
25
18
|
ButtonSet,
|
|
26
19
|
} from 'carbon-components-react';
|
|
27
20
|
import { createProgramEnrollment, useAvailablePrograms, useEnrollments } from './programs.resource';
|
|
21
|
+
import { DefaultWorkspaceProps } from '@openmrs/esm-patient-common-lib';
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
patientUuid: string;
|
|
31
|
-
isTablet: boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const ProgramsForm: React.FC<ProgramsFormProps> = ({ patientUuid, isTablet }) => {
|
|
23
|
+
const ProgramsForm: React.FC<DefaultWorkspaceProps> = ({ closeWorkspace, patientUuid, isTablet }) => {
|
|
35
24
|
const { t } = useTranslation();
|
|
36
25
|
const session = useSessionUser();
|
|
37
26
|
const availableLocations = useLocations();
|
|
@@ -53,8 +42,6 @@ const ProgramsForm: React.FC<ProgramsFormProps> = ({ patientUuid, isTablet }) =>
|
|
|
53
42
|
setUserLocation(session?.sessionLocation?.uuid);
|
|
54
43
|
}
|
|
55
44
|
|
|
56
|
-
const closeWorkspace = React.useCallback(() => detach('patient-chart-workspace-slot', 'programs-form-workspace'), []);
|
|
57
|
-
|
|
58
45
|
const handleSubmit = React.useCallback(
|
|
59
46
|
(event: SyntheticEvent<HTMLFormElement>) => {
|
|
60
47
|
event.preventDefault();
|
|
@@ -4,14 +4,7 @@ import * as SWR from 'swr';
|
|
|
4
4
|
import { throwError } from 'rxjs';
|
|
5
5
|
import { of } from 'rxjs/internal/observable/of';
|
|
6
6
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
7
|
-
import {
|
|
8
|
-
createErrorHandler,
|
|
9
|
-
detach,
|
|
10
|
-
openmrsFetch,
|
|
11
|
-
showNotification,
|
|
12
|
-
showToast,
|
|
13
|
-
useLocations,
|
|
14
|
-
} from '@openmrs/esm-framework';
|
|
7
|
+
import { createErrorHandler, openmrsFetch, showNotification, showToast, useLocations } from '@openmrs/esm-framework';
|
|
15
8
|
import { mockPatient } from '../../../../__mocks__/patient.mock';
|
|
16
9
|
import {
|
|
17
10
|
mockCareProgramsResponse,
|
|
@@ -24,15 +17,14 @@ import ProgramsForm from './programs-form.component';
|
|
|
24
17
|
const testProps = {
|
|
25
18
|
patientUuid: mockPatient.id,
|
|
26
19
|
isTablet: false,
|
|
20
|
+
closeWorkspace: jest.fn(),
|
|
27
21
|
};
|
|
28
22
|
|
|
29
23
|
const mockCreateErrorHandler = createErrorHandler as jest.Mock;
|
|
30
24
|
const mockCreateProgramEnrollment = createProgramEnrollment as jest.Mock;
|
|
31
|
-
const mockDetach = detach as jest.Mock;
|
|
32
25
|
const mockOpenmrsFetch = openmrsFetch as jest.Mock;
|
|
33
26
|
const mockShowNotification = showNotification as jest.Mock;
|
|
34
27
|
const mockShowToast = showToast as jest.Mock;
|
|
35
|
-
const mockUseLocations = useLocations as jest.Mock;
|
|
36
28
|
|
|
37
29
|
jest.mock('@openmrs/esm-framework', () => {
|
|
38
30
|
const originalModule = jest.requireActual('@openmrs/esm-framework');
|
|
@@ -40,7 +32,6 @@ jest.mock('@openmrs/esm-framework', () => {
|
|
|
40
32
|
return {
|
|
41
33
|
...originalModule,
|
|
42
34
|
createErrorHandler: jest.fn(),
|
|
43
|
-
detach: jest.fn(),
|
|
44
35
|
showNotification: jest.fn(),
|
|
45
36
|
showToast: jest.fn(),
|
|
46
37
|
useLocations: jest.fn().mockImplementation(() => mockLocationsResponse),
|
|
@@ -90,8 +81,7 @@ describe('ProgramsForm: ', () => {
|
|
|
90
81
|
const cancelButton = screen.getByRole('button', { name: /Cancel/i });
|
|
91
82
|
fireEvent.click(cancelButton);
|
|
92
83
|
|
|
93
|
-
expect(
|
|
94
|
-
expect(mockDetach).toHaveBeenCalledWith('patient-chart-workspace-slot', 'programs-form-workspace');
|
|
84
|
+
expect(testProps.closeWorkspace).toHaveBeenCalledTimes(1);
|
|
95
85
|
});
|
|
96
86
|
|
|
97
87
|
it('renders a light background for date inputs in the tablet viewport ', () => {
|