@openmrs/esm-patient-vitals-app 11.3.1-patch.9064 → 11.3.1-patch.9310
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/.turbo/turbo-build.log +21 -18
- package/dist/3174.js +2 -0
- package/dist/3174.js.map +1 -0
- package/dist/4341.js +1 -0
- package/dist/4341.js.map +1 -0
- package/dist/5652.js +1 -0
- package/dist/5652.js.map +1 -0
- package/dist/5670.js +1 -1
- package/dist/5670.js.map +1 -1
- package/dist/6336.js +1 -0
- package/dist/6336.js.map +1 -0
- package/dist/7299.js +1 -1
- package/dist/7437.js +1 -0
- package/dist/7437.js.map +1 -0
- package/dist/8953.js +1 -1
- package/dist/9228.js +1 -0
- package/dist/9228.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-patient-vitals-app.js +1 -1
- package/dist/openmrs-esm-patient-vitals-app.js.buildmanifest.json +155 -130
- package/dist/openmrs-esm-patient-vitals-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +4 -3
- package/src/biometrics/biometrics-base.component.tsx +4 -2
- package/src/biometrics/biometrics-main.component.tsx +11 -2
- package/src/biometrics/biometrics-overview.component.tsx +11 -2
- package/src/biometrics/biometrics-overview.test.tsx +3 -0
- package/src/biometrics/paginated-biometrics.component.tsx +3 -1
- package/src/common/data.resource.ts +20 -18
- package/src/common/helpers.ts +38 -9
- package/src/common/types.ts +13 -1
- package/src/components/action-menu/vitals-biometrics-action-menu.component.tsx +5 -5
- package/src/index.ts +6 -2
- package/src/routes.json +10 -4
- package/src/utils.ts +2 -1
- package/src/vitals/paginated-vitals.component.tsx +3 -1
- package/src/vitals/vitals-overview.component.tsx +2 -1
- package/src/vitals-and-biometrics-header/{vitals-header.component.tsx → vitals-header.extension.tsx} +31 -21
- package/src/vitals-and-biometrics-header/vitals-header.test.tsx +107 -11
- package/src/vitals-biometrics-form/exported-vitals-biometrics-form.workspace.tsx +640 -0
- package/src/vitals-biometrics-form/vitals-biometrics-form.test.tsx +38 -17
- package/src/vitals-biometrics-form/vitals-biometrics-form.workspace.tsx +19 -604
- package/src/vitals-biometrics-form/vitals-biometrics-input.component.tsx +4 -1
- package/dist/5415.js +0 -1
- package/dist/5415.js.map +0 -1
- package/dist/5639.js +0 -1
- package/dist/5639.js.map +0 -1
- package/dist/5810.js +0 -1
- package/dist/5810.js.map +0 -1
- package/dist/6712.js +0 -2
- package/dist/6712.js.map +0 -1
- package/dist/8803.js +0 -1
- package/dist/8803.js.map +0 -1
- /package/dist/{6712.js.LICENSE.txt → 3174.js.LICENSE.txt} +0 -0
|
@@ -2,11 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import { screen, render } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import { type FetchResponse, showSnackbar, useConfig, getDefaultsFromConfigSchema } from '@openmrs/esm-framework';
|
|
5
|
+
import { type PatientWorkspace2DefinitionProps } from '@openmrs/esm-patient-common-lib';
|
|
5
6
|
import { createOrUpdateVitalsAndBiometrics, useEncounterVitalsAndBiometrics } from '../common';
|
|
6
7
|
import { type ConfigObject, configSchema } from '../config-schema';
|
|
7
8
|
import { mockConceptUnits, mockVitalsConceptMetadata, mockVitalsConfig } from '__mocks__';
|
|
8
9
|
import { mockPatient } from 'tools';
|
|
9
|
-
import VitalsAndBiometricsForm from './vitals-biometrics-form.workspace';
|
|
10
|
+
import VitalsAndBiometricsForm, { type VitalsAndBiometricsFormProps } from './vitals-biometrics-form.workspace';
|
|
10
11
|
|
|
11
12
|
const heightValue = 180;
|
|
12
13
|
const muacValue = 23;
|
|
@@ -17,14 +18,22 @@ const weightValue = 62;
|
|
|
17
18
|
const systolicBloodPressureValue = 120;
|
|
18
19
|
const temperatureValue = 37;
|
|
19
20
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
const defaultProps: PatientWorkspace2DefinitionProps<VitalsAndBiometricsFormProps, {}> = {
|
|
22
|
+
workspaceProps: {
|
|
23
|
+
formContext: 'creating',
|
|
24
|
+
},
|
|
25
|
+
windowProps: {},
|
|
26
|
+
groupProps: {
|
|
27
|
+
patientUuid: mockPatient.id,
|
|
28
|
+
patient: mockPatient,
|
|
29
|
+
visitContext: null,
|
|
30
|
+
mutateVisitContext: null,
|
|
31
|
+
},
|
|
32
|
+
workspaceName: '',
|
|
33
|
+
launchChildWorkspace: jest.fn(),
|
|
34
|
+
closeWorkspace: jest.fn(),
|
|
35
|
+
windowName: '',
|
|
36
|
+
isRootWorkspace: false,
|
|
28
37
|
};
|
|
29
38
|
|
|
30
39
|
const mockShowSnackbar = jest.mocked(showSnackbar);
|
|
@@ -145,10 +154,10 @@ function setupMockUseEncounterVitalsAndBiometrics() {
|
|
|
145
154
|
|
|
146
155
|
describe('VitalsBiometricsForm', () => {
|
|
147
156
|
it('renders the vitals and biometrics form', async () => {
|
|
148
|
-
|
|
157
|
+
renderVitalsAndBiometricsForm();
|
|
149
158
|
|
|
150
|
-
expect(screen.getByText(/vitals
|
|
151
|
-
expect(screen.getByText(/biometrics/i)).toBeInTheDocument();
|
|
159
|
+
expect(screen.getByText(/record vitals$/i)).toBeInTheDocument();
|
|
160
|
+
expect(screen.getByText(/record biometrics/i)).toBeInTheDocument();
|
|
152
161
|
expect(screen.getByText(/blood pressure/i)).toBeInTheDocument();
|
|
153
162
|
expect(screen.getByRole('spinbutton', { name: /systolic/i })).toBeInTheDocument();
|
|
154
163
|
expect(screen.getByRole('spinbutton', { name: /diastolic/i })).toBeInTheDocument();
|
|
@@ -178,7 +187,7 @@ describe('VitalsBiometricsForm', () => {
|
|
|
178
187
|
it("computes a patient's BMI from the given height and weight values", async () => {
|
|
179
188
|
const user = userEvent.setup();
|
|
180
189
|
|
|
181
|
-
|
|
190
|
+
renderVitalsAndBiometricsForm();
|
|
182
191
|
|
|
183
192
|
const heightInput = screen.getByRole('spinbutton', { name: /height/i });
|
|
184
193
|
const weightInput = screen.getByRole('spinbutton', { name: /weight/i });
|
|
@@ -203,7 +212,7 @@ describe('VitalsBiometricsForm', () => {
|
|
|
203
212
|
response as ReturnType<typeof createOrUpdateVitalsAndBiometrics>,
|
|
204
213
|
);
|
|
205
214
|
|
|
206
|
-
|
|
215
|
+
renderVitalsAndBiometricsForm();
|
|
207
216
|
|
|
208
217
|
const heightInput = screen.getByRole('spinbutton', { name: /height/i });
|
|
209
218
|
const weightInput = screen.getByRole('spinbutton', { name: /weight/i });
|
|
@@ -272,7 +281,7 @@ describe('VitalsBiometricsForm', () => {
|
|
|
272
281
|
|
|
273
282
|
it('correctly initializes the form with existing vitals and biometrics data while in edit mode', async () => {
|
|
274
283
|
setupMockUseEncounterVitalsAndBiometrics();
|
|
275
|
-
|
|
284
|
+
renderVitalsAndBiometricsForm('editing', 'encounter-uuid');
|
|
276
285
|
|
|
277
286
|
expect(screen.getByRole('spinbutton', { name: /height/i })).toHaveValue(170);
|
|
278
287
|
expect(screen.getByRole('spinbutton', { name: /weight/i })).toHaveValue(65);
|
|
@@ -299,7 +308,7 @@ describe('VitalsBiometricsForm', () => {
|
|
|
299
308
|
response as ReturnType<typeof createOrUpdateVitalsAndBiometrics>,
|
|
300
309
|
);
|
|
301
310
|
|
|
302
|
-
|
|
311
|
+
renderVitalsAndBiometricsForm('editing', 'encounter-uuid');
|
|
303
312
|
|
|
304
313
|
const weightInput = screen.getByRole('spinbutton', { name: /weight/i });
|
|
305
314
|
const systolicInput = screen.getByRole('spinbutton', { name: /systolic/i });
|
|
@@ -368,7 +377,7 @@ describe('VitalsBiometricsForm', () => {
|
|
|
368
377
|
|
|
369
378
|
mockCreateOrUpdateVitalsAndBiometrics.mockRejectedValueOnce(error);
|
|
370
379
|
|
|
371
|
-
|
|
380
|
+
renderVitalsAndBiometricsForm();
|
|
372
381
|
|
|
373
382
|
const heightInput = screen.getByRole('spinbutton', { name: /height/i });
|
|
374
383
|
const weightInput = screen.getByRole('spinbutton', { name: /weight/i });
|
|
@@ -401,3 +410,15 @@ describe('VitalsBiometricsForm', () => {
|
|
|
401
410
|
});
|
|
402
411
|
});
|
|
403
412
|
});
|
|
413
|
+
|
|
414
|
+
function renderVitalsAndBiometricsForm(formContext?: 'creating' | 'editing', editEncounterUuid?: string) {
|
|
415
|
+
const props: PatientWorkspace2DefinitionProps<VitalsAndBiometricsFormProps, {}> = {
|
|
416
|
+
...defaultProps,
|
|
417
|
+
workspaceProps: {
|
|
418
|
+
...defaultProps.workspaceProps,
|
|
419
|
+
formContext: formContext ?? defaultProps.workspaceProps.formContext,
|
|
420
|
+
editEncounterUuid: editEncounterUuid ?? defaultProps.workspaceProps.editEncounterUuid,
|
|
421
|
+
},
|
|
422
|
+
};
|
|
423
|
+
return render(<VitalsAndBiometricsForm {...props} />);
|
|
424
|
+
}
|