@openmrs/esm-react-utils 5.3.3-pre.1359 → 5.3.3-pre.1370
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 +6 -6
- package/dist/openmrs-esm-react-utils.js +1 -1
- package/dist/openmrs-esm-react-utils.js.map +1 -1
- package/package.json +9 -7
- package/src/ConfigurableLink.test.tsx +1 -6
- package/src/ConfigurableLink.tsx +2 -2
- package/src/extensions.test.tsx +1 -1
- package/src/setup-tests.js +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-react-utils",
|
|
3
|
-
"version": "5.3.3-pre.
|
|
3
|
+
"version": "5.3.3-pre.1370",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "React utilities for OpenMRS.",
|
|
6
6
|
"browser": "dist/openmrs-esm-react-utils.js",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"@openmrs/esm-error-handling": "5.x",
|
|
49
49
|
"@openmrs/esm-extensions": "5.x",
|
|
50
50
|
"@openmrs/esm-globals": "5.x",
|
|
51
|
+
"@openmrs/esm-navigation": "5.x",
|
|
51
52
|
"dayjs": "1.x",
|
|
52
53
|
"i18next": "19.x",
|
|
53
54
|
"react": "18.x",
|
|
@@ -57,12 +58,13 @@
|
|
|
57
58
|
"swr": "2.x"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@openmrs/esm-api": "5.3.3-pre.
|
|
61
|
-
"@openmrs/esm-config": "5.3.3-pre.
|
|
62
|
-
"@openmrs/esm-error-handling": "5.3.3-pre.
|
|
63
|
-
"@openmrs/esm-extensions": "5.3.3-pre.
|
|
64
|
-
"@openmrs/esm-feature-flags": "5.3.3-pre.
|
|
65
|
-
"@openmrs/esm-globals": "5.3.3-pre.
|
|
61
|
+
"@openmrs/esm-api": "5.3.3-pre.1370",
|
|
62
|
+
"@openmrs/esm-config": "5.3.3-pre.1370",
|
|
63
|
+
"@openmrs/esm-error-handling": "5.3.3-pre.1370",
|
|
64
|
+
"@openmrs/esm-extensions": "5.3.3-pre.1370",
|
|
65
|
+
"@openmrs/esm-feature-flags": "5.3.3-pre.1370",
|
|
66
|
+
"@openmrs/esm-globals": "5.3.3-pre.1370",
|
|
67
|
+
"@openmrs/esm-navigation": "5.3.3-pre.1370",
|
|
66
68
|
"dayjs": "^1.10.8",
|
|
67
69
|
"i18next": "^21.10.0",
|
|
68
70
|
"react": "^18.1.0",
|
|
@@ -2,18 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import '@testing-library/jest-dom';
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
|
5
|
-
import { navigate
|
|
5
|
+
import { navigate } from '@openmrs/esm-navigation';
|
|
6
6
|
import { ConfigurableLink } from './ConfigurableLink';
|
|
7
7
|
|
|
8
8
|
jest.mock('single-spa');
|
|
9
9
|
|
|
10
|
-
jest.mock('@openmrs/esm-config');
|
|
11
10
|
const mockNavigate = navigate as jest.Mock;
|
|
12
11
|
|
|
13
|
-
const realInterpolate = jest.requireActual('@openmrs/esm-config').interpolateUrl;
|
|
14
|
-
|
|
15
|
-
(interpolateUrl as jest.Mock).mockImplementation((...args) => realInterpolate(...args));
|
|
16
|
-
|
|
17
12
|
describe(`ConfigurableLink`, () => {
|
|
18
13
|
const path = '${openmrsSpaBase}/home';
|
|
19
14
|
beforeEach(() => {
|
package/src/ConfigurableLink.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @module @category Navigation */
|
|
2
2
|
import React, { type MouseEvent, type AnchorHTMLAttributes, type PropsWithChildren } from 'react';
|
|
3
|
-
import type { TemplateParams } from '@openmrs/esm-
|
|
4
|
-
import { navigate, interpolateUrl } from '@openmrs/esm-
|
|
3
|
+
import type { TemplateParams } from '@openmrs/esm-navigation';
|
|
4
|
+
import { navigate, interpolateUrl } from '@openmrs/esm-navigation';
|
|
5
5
|
|
|
6
6
|
function handleClick(event: MouseEvent, to: string, templateParams?: TemplateParams, onBeforeNavigate?: () => void) {
|
|
7
7
|
if (!event.metaKey && !event.ctrlKey && !event.shiftKey && event.button == 0) {
|
package/src/extensions.test.tsx
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import userEvent from '@testing-library/user-event';
|
|
19
19
|
import { registerFeatureFlag, setFeatureFlag } from '@openmrs/esm-feature-flags';
|
|
20
20
|
|
|
21
|
-
// For some reason in the
|
|
21
|
+
// For some reason in the test context `isEqual` always returns true
|
|
22
22
|
// when using the import substitution in jest.config.js. Here's a custom
|
|
23
23
|
// mock.
|
|
24
24
|
jest.mock('lodash-es/isEqual', () => (a, b) => JSON.stringify(a) == JSON.stringify(b));
|
package/src/setup-tests.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { jest } from '@jest/globals'
|
|
1
2
|
import '@testing-library/jest-dom';
|
|
2
3
|
|
|
3
4
|
global.window.openmrsBase = '/openmrs';
|
|
4
5
|
global.window.spaBase = '/spa';
|
|
5
6
|
global.window.getOpenmrsSpaBase = () => '/openmrs/spa/';
|
|
7
|
+
|
|
8
|
+
jest.mock('@openmrs/esm-navigation', () => ({
|
|
9
|
+
...jest.requireActual('@openmrs/esm-navigation'),
|
|
10
|
+
navigate: jest.fn(),
|
|
11
|
+
}));
|