Skip to content

Commit 9293c9c

Browse files
committed
Updates deprecated workspace functiona and styles
1 parent 94dafab commit 9293c9c

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

packages/esm-nutrition-app/src/nutrition/nutrition-summary.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@
4444
background-color: colors.$red-30 !important;
4545
}
4646

47-
&[data-status='+'] {
47+
&[data-status='X'] {
4848
background-color: colors.$orange-20 !important;
4949
}
5050

51-
&[data-status='++'] {
51+
&[data-status='XX'] {
5252
background-color: colors.$yellow-20 !important;
5353
}
5454

55-
&[data-status='+++'] {
55+
&[data-status='XXX'] {
5656
background-color: colors.$cyan-20 !important;
5757
}
5858

59-
&[data-status='++++'] {
59+
&[data-status='XXXX'] {
6060
background-color: colors.$green-30 !important;
6161
}
6262

packages/esm-nutrition-app/src/utils/helpers.test.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { launchClinicalViewForm, mealSymbol, getPatientEncounterDates } from './helpers';
2-
import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib';
3-
import { openmrsFetch } from '@openmrs/esm-framework';
1+
import { launchWorkspace, openmrsFetch } from '@openmrs/esm-framework';
42
import dayjs from 'dayjs';
3+
import { launchClinicalViewForm, mealSymbol, getPatientEncounterDates } from './helpers';
54
import { dateFormat } from '../constants';
65

76
jest.mock('@openmrs/esm-patient-common-lib', () => ({
8-
launchPatientWorkspace: jest.fn(),
7+
launchWorkspace: jest.fn(),
98
}));
109

1110
jest.mock('@openmrs/esm-framework', () => ({
@@ -14,15 +13,15 @@ jest.mock('@openmrs/esm-framework', () => ({
1413
}));
1514

1615
describe('launchClinicalViewForm', () => {
17-
it('should call launchPatientWorkspace with correct parameters', () => {
16+
it('should call launchWorkspace with correct parameters', () => {
1817
const form = { name: 'Test Form' } as any;
1918
const patientUuid = 'patient-uuid';
2019
const onFormSave = jest.fn();
2120
const action = 'add';
2221

2322
launchClinicalViewForm(form, patientUuid, onFormSave, action);
2423

25-
expect(launchPatientWorkspace).toHaveBeenCalledWith('patient-form-entry-workspace', {
24+
expect(launchWorkspace).toHaveBeenCalledWith('patient-form-entry-workspace', {
2625
workspaceTitle: form.name,
2726
mutateForm: onFormSave,
2827
formInfo: {
@@ -44,10 +43,10 @@ describe('launchClinicalViewForm', () => {
4443
describe('mealSymbol', () => {
4544
it.each([
4645
['0%', '-'],
47-
['25%', '+'],
48-
['50%', '++'],
49-
['75%', '+++'],
50-
['100%', '++++'],
46+
['25%', 'X'],
47+
['50%', 'XX'],
48+
['75%', 'XXX'],
49+
['100%', 'XXXX'],
5150
['unknown', ''],
5251
])('should return correct symbol for %s', (input, expected) => {
5352
expect(mealSymbol(input)).toBe(expected);

packages/esm-nutrition-app/src/utils/helpers.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib';
21
import { type FormSchema } from '@openmrs/esm-form-engine-lib';
3-
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
2+
import { launchWorkspace, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
43
import dayjs from 'dayjs';
54
import { dateFormat } from '../constants';
65

@@ -14,7 +13,7 @@ export function launchClinicalViewForm(
1413
encounterUuid?: string,
1514
workspaceWindowSize?: 'minimized' | 'maximized',
1615
) {
17-
launchPatientWorkspace('patient-form-entry-workspace', {
16+
launchWorkspace('patient-form-entry-workspace', {
1817
workspaceTitle: form.name,
1918
mutateForm: onFormSave,
2019
formInfo: {

0 commit comments

Comments
 (0)