@openmrs/esm-framework 4.0.2-pre.275 → 4.0.2-pre.311

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-framework",
3
- "version": "4.0.2-pre.275",
3
+ "version": "4.0.2-pre.311",
4
4
  "license": "MPL-2.0",
5
5
  "browser": "dist/openmrs-esm-framework.js",
6
6
  "main": "src/index.ts",
@@ -35,18 +35,18 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "@openmrs/esm-api": "^4.0.2-pre.275",
39
- "@openmrs/esm-breadcrumbs": "^4.0.2-pre.275",
40
- "@openmrs/esm-config": "^4.0.2-pre.275",
41
- "@openmrs/esm-error-handling": "^4.0.2-pre.275",
42
- "@openmrs/esm-extensions": "^4.0.2-pre.275",
43
- "@openmrs/esm-globals": "^4.0.2-pre.275",
44
- "@openmrs/esm-offline": "^4.0.2-pre.275",
45
- "@openmrs/esm-react-utils": "^4.0.2-pre.275",
46
- "@openmrs/esm-state": "^4.0.2-pre.275",
47
- "@openmrs/esm-styleguide": "^4.0.2-pre.275",
48
- "@openmrs/esm-utils": "^4.0.2-pre.275",
38
+ "@openmrs/esm-api": "^4.0.2-pre.311",
39
+ "@openmrs/esm-breadcrumbs": "^4.0.2-pre.311",
40
+ "@openmrs/esm-config": "^4.0.2-pre.311",
41
+ "@openmrs/esm-error-handling": "^4.0.2-pre.311",
42
+ "@openmrs/esm-extensions": "^4.0.2-pre.311",
43
+ "@openmrs/esm-globals": "^4.0.2-pre.311",
44
+ "@openmrs/esm-offline": "^4.0.2-pre.311",
45
+ "@openmrs/esm-react-utils": "^4.0.2-pre.311",
46
+ "@openmrs/esm-state": "^4.0.2-pre.311",
47
+ "@openmrs/esm-styleguide": "^4.0.2-pre.311",
48
+ "@openmrs/esm-utils": "^4.0.2-pre.311",
49
49
  "dayjs": "^1.10.7"
50
50
  },
51
- "gitHead": "22600f6d70562c772dbcecc1bd3afe1591781ab1"
51
+ "gitHead": "b3e134d2ea8e0ec5bebf260fbda023dfc010505a"
52
52
  }
@@ -1,4 +1,7 @@
1
1
  import React from "react";
2
+ import { act, render, screen, waitFor } from "@testing-library/react";
3
+ import { Person } from "@openmrs/esm-api";
4
+ import { mockSessionStore } from "../../mock";
2
5
  import {
3
6
  attach,
4
7
  registerExtension,
@@ -19,9 +22,6 @@ import {
19
22
  configInternalStore,
20
23
  getExtensionSlotsConfigStore,
21
24
  } from "../../../esm-config/src";
22
- import { act, render, screen, waitFor } from "@testing-library/react";
23
- import { Person } from "@openmrs/esm-api";
24
- import { mockSessionStore } from "../../mock";
25
25
 
26
26
  jest.mock("@openmrs/esm-api", () => {
27
27
  const original = jest.requireActual("@openmrs/esm-api");
@@ -71,10 +71,13 @@ describe("Interaction between configuration and extension systems", () => {
71
71
 
72
72
  const slot = screen.getByTestId("slot");
73
73
  const extensions = slot.childNodes;
74
- expect(extensions[0]).toHaveTextContent("Betty");
75
- expect(extensions[1]).toHaveTextContent("Wilma");
76
- expect(extensions[2]).toHaveTextContent("Barney");
77
- expect(screen.queryByText("Fred")).not.toBeInTheDocument();
74
+
75
+ await waitFor(() => {
76
+ expect(extensions[0]).toHaveTextContent("Betty");
77
+ expect(extensions[1]).toHaveTextContent("Wilma");
78
+ expect(extensions[2]).toHaveTextContent("Barney");
79
+ expect(screen.queryByText("Fred")).not.toBeInTheDocument();
80
+ });
78
81
  });
79
82
 
80
83
  test("Extensions should recieve config from module and from 'configure' key", async () => {
@@ -114,9 +117,12 @@ describe("Interaction between configuration and extension systems", () => {
114
117
  await screen.findAllByText(/.*Pebbles.*/);
115
118
 
116
119
  const flintstonePebbles = screen.getByTestId("flintstone-slot");
117
- expect(flintstonePebbles).toHaveTextContent(/Pebbles:.*Springfield/);
118
120
  const futurePebbles = screen.getByTestId("future-slot");
119
- expect(futurePebbles).toHaveTextContent(/Pebbles:.*New New York/);
121
+
122
+ await waitFor(() => {
123
+ expect(flintstonePebbles).toHaveTextContent(/Pebbles:.*Springfield/);
124
+ expect(futurePebbles).toHaveTextContent(/Pebbles:.*New New York/);
125
+ });
120
126
  });
121
127
 
122
128
  test("Should be possible to attach the same extension twice with different configurations", async () => {
@@ -157,8 +163,11 @@ describe("Interaction between configuration and extension systems", () => {
157
163
  await screen.findAllByText(/.*Dino.*/);
158
164
 
159
165
  const slot = screen.getByTestId("flintstone-slot");
160
- expect(slot.firstChild).toHaveTextContent(/Dino/);
161
- expect(slot.lastChild).toHaveTextContent(/Baby Puss/);
166
+
167
+ await waitFor(() => {
168
+ expect(slot.firstChild).toHaveTextContent(/Dino/);
169
+ expect(slot.lastChild).toHaveTextContent(/Baby Puss/);
170
+ });
162
171
  });
163
172
 
164
173
  test("Slot config should update with temporary config", async () => {
@@ -189,7 +198,9 @@ describe("Interaction between configuration and extension systems", () => {
189
198
  });
190
199
  });
191
200
 
192
- expect(screen.queryByText("Pearl")).not.toBeInTheDocument();
201
+ await waitFor(() =>
202
+ expect(screen.queryByText("Pearl")).not.toBeInTheDocument()
203
+ );
193
204
  });
194
205
 
195
206
  test("Extension config should update with temporary config", async () => {
@@ -226,10 +237,10 @@ describe("Interaction between configuration and extension systems", () => {
226
237
  });
227
238
  });
228
239
 
229
- expect(screen.queryByText("green")).not.toBeInTheDocument();
230
- waitFor(() =>
231
- expect(screen.getByTestId("slot")).toHaveTextContent(/black/)
232
- );
240
+ await waitFor(() => {
241
+ expect(screen.queryByText("green")).not.toBeInTheDocument();
242
+ expect(screen.getByTestId("slot")).toHaveTextContent(/black/);
243
+ });
233
244
  });
234
245
 
235
246
  test("Extension config should be available in extension store", async () => {
@@ -441,12 +452,14 @@ describe("Interaction between configuration and extension systems", () => {
441
452
 
442
453
  render(<App />);
443
454
 
444
- await waitFor(() => expect(screen.getByTestId(/slot/)).toBeInTheDocument());
445
- expect(screen.getByTestId("slot").firstChild).toHaveAttribute(
446
- "data-extension-id",
447
- "Wilma"
448
- );
449
- expect(screen.queryAllByText(/\bSchmoo\b/)).toHaveLength(0);
455
+ await waitFor(() => {
456
+ expect(screen.getByTestId(/slot/)).toBeInTheDocument();
457
+ expect(screen.getByTestId("slot").firstChild).toHaveAttribute(
458
+ "data-extension-id",
459
+ "Wilma"
460
+ );
461
+ expect(screen.queryAllByText(/\bSchmoo\b/)).toHaveLength(0);
462
+ });
450
463
  });
451
464
  });
452
465