@etsoo/react 1.8.68 → 1.8.70

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.
@@ -0,0 +1,51 @@
1
+ import React from "react";
2
+ import { useRefs } from "../src";
3
+ import { ReactUtils } from "../src/app/ReactUtils";
4
+ import { render, renderHook } from "@testing-library/react";
5
+
6
+ test("Tests for ReactUtils.formatInputValue", () => {
7
+ expect(ReactUtils.formatInputValue([1, "a"])).toEqual([1, "a"]);
8
+ expect(ReactUtils.formatInputValue(true)).toEqual("true");
9
+ });
10
+
11
+ test("Tests for ReactUtils.updateRefValues", () => {
12
+ // Input refs
13
+ const refFields = ["name", "retailPrice", "qty"] as const;
14
+
15
+ // Hook
16
+ const { result: refs } = renderHook(() => useRefs(refFields));
17
+
18
+ // Act
19
+ render(
20
+ <div>
21
+ <input name="name" ref={refs.current.name} />
22
+ <input
23
+ name="price.retailPrice"
24
+ type="number"
25
+ ref={refs.current.retailPrice}
26
+ />
27
+ <input name="qty" type="number" ref={refs.current.qty} />
28
+ </div>
29
+ );
30
+
31
+ const data = {
32
+ name: "Test",
33
+ price: { retailPrice: 300.5 },
34
+ qty: 2
35
+ };
36
+
37
+ ReactUtils.updateRefs(refs.current, data);
38
+
39
+ expect(refs.current.name.current?.value).toBe(data.name);
40
+ expect(refs.current.retailPrice.current?.value).toBe(
41
+ data.price.retailPrice.toString()
42
+ );
43
+ expect(refs.current.qty.current?.value).toBe(data.qty.toString());
44
+
45
+ const newData: Partial<typeof data> = {};
46
+ ReactUtils.updateRefValues(refs.current, newData);
47
+
48
+ expect(newData.name).toBe(data.name);
49
+ expect(newData.price?.retailPrice).toBe(data.price.retailPrice);
50
+ expect(newData.qty).toBe(data.qty);
51
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.8.68",
3
+ "version": "1.8.70",
4
4
  "description": "TypeScript ReactJs UI Independent Framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -38,13 +38,13 @@
38
38
  "@emotion/css": "^11.13.5",
39
39
  "@emotion/react": "^11.14.0",
40
40
  "@emotion/styled": "^11.14.1",
41
- "@etsoo/appscript": "^1.6.51",
41
+ "@etsoo/appscript": "^1.6.53",
42
42
  "@etsoo/notificationbase": "^1.1.66",
43
43
  "@etsoo/shared": "^1.2.80",
44
44
  "react": "^19.2.3",
45
45
  "react-dom": "^19.2.3",
46
- "react-router-dom": "^7.11.0",
47
- "react-window": "^2.2.3"
46
+ "react-router-dom": "^7.12.0",
47
+ "react-window": "^2.2.4"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@babel/cli": "^7.28.3",
@@ -54,7 +54,7 @@
54
54
  "@babel/runtime-corejs3": "^7.28.4",
55
55
  "@testing-library/jest-dom": "^6.9.1",
56
56
  "@testing-library/react": "^16.3.1",
57
- "@types/react": "^19.2.7",
57
+ "@types/react": "^19.2.8",
58
58
  "@types/react-dom": "^19.2.3",
59
59
  "@vitejs/plugin-react": "^5.1.2",
60
60
  "jsdom": "^27.4.0",
@@ -1,6 +0,0 @@
1
- import { ReactUtils } from "../src/app/ReactUtils";
2
-
3
- test("Tests for ReactUtils.formatInputValue", () => {
4
- expect(ReactUtils.formatInputValue([1, "a"])).toEqual([1, "a"]);
5
- expect(ReactUtils.formatInputValue(true)).toEqual("true");
6
- });