@openmrs/esm-patient-vitals-app 11.3.1-pre.9452 → 11.3.1-pre.9458
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 +11 -11
- 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/7437.js +1 -0
- package/dist/7437.js.map +1 -0
- package/dist/9228.js +1 -1
- package/dist/9228.js.map +1 -1
- 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 +78 -53
- package/dist/routes.json +1 -1
- package/package.json +3 -2
- package/src/components/action-menu/vitals-biometrics-action-menu.component.tsx +2 -2
- package/src/index.ts +5 -1
- package/src/routes.json +9 -3
- package/src/vitals-and-biometrics-header/vitals-header.extension.tsx +18 -14
- package/src/vitals-and-biometrics-header/vitals-header.scss +3 -10
- package/src/vitals-and-biometrics-header/vitals-header.test.tsx +9 -13
- package/src/vitals-biometrics-form/exported-vitals-biometrics-form.workspace.tsx +644 -0
- package/src/vitals-biometrics-form/vitals-biometrics-form.test.tsx +37 -18
- package/src/vitals-biometrics-form/vitals-biometrics-form.workspace.tsx +20 -603
- package/dist/5415.js +0 -1
- package/dist/5415.js.map +0 -1
- package/dist/8803.js +0 -1
- package/dist/8803.js.map +0 -1
|
@@ -2,6 +2,7 @@ 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__';
|
|
@@ -17,16 +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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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,
|
|
30
37
|
};
|
|
31
38
|
|
|
32
39
|
const mockShowSnackbar = jest.mocked(showSnackbar);
|
|
@@ -147,10 +154,10 @@ function setupMockUseEncounterVitalsAndBiometrics() {
|
|
|
147
154
|
|
|
148
155
|
describe('VitalsBiometricsForm', () => {
|
|
149
156
|
it('renders the vitals and biometrics form', async () => {
|
|
150
|
-
|
|
157
|
+
renderVitalsAndBiometricsForm();
|
|
151
158
|
|
|
152
|
-
expect(screen.getByText(/vitals
|
|
153
|
-
expect(screen.getByText(/biometrics/i)).toBeInTheDocument();
|
|
159
|
+
expect(screen.getByText(/record vitals$/i)).toBeInTheDocument();
|
|
160
|
+
expect(screen.getByText(/record biometrics/i)).toBeInTheDocument();
|
|
154
161
|
expect(screen.getByText(/blood pressure/i)).toBeInTheDocument();
|
|
155
162
|
expect(screen.getByRole('spinbutton', { name: /systolic/i })).toBeInTheDocument();
|
|
156
163
|
expect(screen.getByRole('spinbutton', { name: /diastolic/i })).toBeInTheDocument();
|
|
@@ -180,7 +187,7 @@ describe('VitalsBiometricsForm', () => {
|
|
|
180
187
|
it("computes a patient's BMI from the given height and weight values", async () => {
|
|
181
188
|
const user = userEvent.setup();
|
|
182
189
|
|
|
183
|
-
|
|
190
|
+
renderVitalsAndBiometricsForm();
|
|
184
191
|
|
|
185
192
|
const heightInput = screen.getByRole('spinbutton', { name: /height/i });
|
|
186
193
|
const weightInput = screen.getByRole('spinbutton', { name: /weight/i });
|
|
@@ -205,7 +212,7 @@ describe('VitalsBiometricsForm', () => {
|
|
|
205
212
|
response as ReturnType<typeof createOrUpdateVitalsAndBiometrics>,
|
|
206
213
|
);
|
|
207
214
|
|
|
208
|
-
|
|
215
|
+
renderVitalsAndBiometricsForm();
|
|
209
216
|
|
|
210
217
|
const heightInput = screen.getByRole('spinbutton', { name: /height/i });
|
|
211
218
|
const weightInput = screen.getByRole('spinbutton', { name: /weight/i });
|
|
@@ -274,7 +281,7 @@ describe('VitalsBiometricsForm', () => {
|
|
|
274
281
|
|
|
275
282
|
it('correctly initializes the form with existing vitals and biometrics data while in edit mode', async () => {
|
|
276
283
|
setupMockUseEncounterVitalsAndBiometrics();
|
|
277
|
-
|
|
284
|
+
renderVitalsAndBiometricsForm('editing', 'encounter-uuid');
|
|
278
285
|
|
|
279
286
|
expect(screen.getByRole('spinbutton', { name: /height/i })).toHaveValue(170);
|
|
280
287
|
expect(screen.getByRole('spinbutton', { name: /weight/i })).toHaveValue(65);
|
|
@@ -301,7 +308,7 @@ describe('VitalsBiometricsForm', () => {
|
|
|
301
308
|
response as ReturnType<typeof createOrUpdateVitalsAndBiometrics>,
|
|
302
309
|
);
|
|
303
310
|
|
|
304
|
-
|
|
311
|
+
renderVitalsAndBiometricsForm('editing', 'encounter-uuid');
|
|
305
312
|
|
|
306
313
|
const weightInput = screen.getByRole('spinbutton', { name: /weight/i });
|
|
307
314
|
const systolicInput = screen.getByRole('spinbutton', { name: /systolic/i });
|
|
@@ -370,7 +377,7 @@ describe('VitalsBiometricsForm', () => {
|
|
|
370
377
|
|
|
371
378
|
mockCreateOrUpdateVitalsAndBiometrics.mockRejectedValueOnce(error);
|
|
372
379
|
|
|
373
|
-
|
|
380
|
+
renderVitalsAndBiometricsForm();
|
|
374
381
|
|
|
375
382
|
const heightInput = screen.getByRole('spinbutton', { name: /height/i });
|
|
376
383
|
const weightInput = screen.getByRole('spinbutton', { name: /weight/i });
|
|
@@ -403,3 +410,15 @@ describe('VitalsBiometricsForm', () => {
|
|
|
403
410
|
});
|
|
404
411
|
});
|
|
405
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
|
+
}
|