@thepalaceproject/circulation-admin 1.42.2 → 1.43.0-post.2
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/.node-version +1 -1
- package/.nvmrc +1 -1
- package/.nycrc.json +8 -0
- package/CLAUDE.md +8 -1
- package/README.md +7 -7
- package/dist/circulation-admin.js +1 -1
- package/eslint.config.mjs +9 -1
- package/jest.config.js +15 -0
- package/package.json +10 -6
- package/tests/jest/components/JsonField.test.tsx +20 -0
- package/tests/jest/components/ProtocolFormField.test.tsx +36 -0
package/eslint.config.mjs
CHANGED
|
@@ -8,7 +8,15 @@ import globals from "globals";
|
|
|
8
8
|
|
|
9
9
|
export default tseslint.config(
|
|
10
10
|
{
|
|
11
|
-
ignores: [
|
|
11
|
+
ignores: [
|
|
12
|
+
"dist/",
|
|
13
|
+
"lib/",
|
|
14
|
+
"docs/",
|
|
15
|
+
"typings/",
|
|
16
|
+
"node_modules/",
|
|
17
|
+
"coverage/",
|
|
18
|
+
".nyc_output/",
|
|
19
|
+
],
|
|
12
20
|
},
|
|
13
21
|
js.configs.recommended,
|
|
14
22
|
...tseslint.configs.recommended,
|
package/jest.config.js
CHANGED
|
@@ -13,4 +13,19 @@ module.exports = {
|
|
|
13
13
|
},
|
|
14
14
|
setupFiles: ["./jest.polyfills.js"],
|
|
15
15
|
setupFilesAfterEnv: ["./tests/jest/jest-setup.ts"],
|
|
16
|
+
// `src` must stay in `roots` so that `collectCoverageFrom` can discover source
|
|
17
|
+
// files that no jest test imports — otherwise they are silently omitted from
|
|
18
|
+
// the report rather than counted as uncovered. `testMatch` (not `--roots`) is
|
|
19
|
+
// therefore what keeps jest from picking up the legacy mocha tests that live
|
|
20
|
+
// in `src/**/__tests__/`.
|
|
21
|
+
roots: ["<rootDir>/src", "<rootDir>/tests/jest"],
|
|
22
|
+
testMatch: ["<rootDir>/tests/jest/**/*.test.{js,jsx,ts,tsx}"],
|
|
23
|
+
coverageDirectory: "coverage/jest",
|
|
24
|
+
coverageReporters: ["lcov", "text-summary"],
|
|
25
|
+
collectCoverageFrom: [
|
|
26
|
+
"src/**/*.{ts,tsx}",
|
|
27
|
+
"!src/**/__tests__/**",
|
|
28
|
+
"!src/testHelper.ts",
|
|
29
|
+
"!src/**/*.d.ts",
|
|
30
|
+
],
|
|
16
31
|
};
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"author": "The Palace Project",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=
|
|
12
|
+
"node": ">=24.0.0 <25.0.0",
|
|
13
13
|
"npm": ">=11.10.0"
|
|
14
14
|
},
|
|
15
15
|
"packageManager": "npm@11.17.0",
|
|
@@ -27,8 +27,11 @@
|
|
|
27
27
|
"test-browser": "npm run test-chrome && npm run test-firefox",
|
|
28
28
|
"test-chrome": "node_modules/.bin/selenium-standalone install && nightwatch -e chrome",
|
|
29
29
|
"test-firefox": "node_modules/.bin/selenium-standalone install && nightwatch -e firefox",
|
|
30
|
-
"test-jest": "jest --verbose
|
|
30
|
+
"test-jest": "jest --verbose",
|
|
31
31
|
"test-jest-file": "jest --verbose",
|
|
32
|
+
"coverage": "npm run coverage-ts && npm run coverage-jest",
|
|
33
|
+
"coverage-ts": "nyc npm run test-ts",
|
|
34
|
+
"coverage-jest": "npm run test-jest -- --coverage",
|
|
32
35
|
"dev": "webpack --watch --progress --config webpack.dev.config",
|
|
33
36
|
"dev-server": "dotenv -c -- webpack serve --progress --hot --config webpack.dev-server.config",
|
|
34
37
|
"dev-test-axe": "TEST_AXE=true npm run dev",
|
|
@@ -71,6 +74,7 @@
|
|
|
71
74
|
"url": "^0.11.0"
|
|
72
75
|
},
|
|
73
76
|
"devDependencies": {
|
|
77
|
+
"@eslint/js": "^9.39.4",
|
|
74
78
|
"@tanstack/react-query-devtools": "^4.36.1",
|
|
75
79
|
"@testing-library/jest-dom": "^6.9.1",
|
|
76
80
|
"@testing-library/react": "^12.1.5",
|
|
@@ -87,12 +91,11 @@
|
|
|
87
91
|
"@types/react-router": "^3.0.28",
|
|
88
92
|
"@types/recharts": "^1.8.28",
|
|
89
93
|
"@types/redux-mock-store": "^1.0.3",
|
|
90
|
-
"@eslint/js": "^9.39.4",
|
|
91
94
|
"chai": "4.2.0",
|
|
92
95
|
"clean-webpack-plugin": "^2.0.1",
|
|
93
96
|
"colors-cli": "^1.0.27",
|
|
94
|
-
"copy-webpack-plugin": "
|
|
95
|
-
"css-loader": "^
|
|
97
|
+
"copy-webpack-plugin": "14.0.0",
|
|
98
|
+
"css-loader": "^7.1.4",
|
|
96
99
|
"dotenv-cli": "^11.0.0",
|
|
97
100
|
"enzyme": "^3.11.0",
|
|
98
101
|
"enzyme-adapter-react-16": "^1.15.6",
|
|
@@ -119,6 +122,7 @@
|
|
|
119
122
|
"mocha": "^11.7.6",
|
|
120
123
|
"msw": "^2.7.3",
|
|
121
124
|
"nightwatch": "^3.14.0",
|
|
125
|
+
"nyc": "^17.1.0",
|
|
122
126
|
"prettier": "3.8.4",
|
|
123
127
|
"react-axe": "^3.3.0",
|
|
124
128
|
"react-test-renderer": "^16.14.0",
|
|
@@ -153,5 +157,5 @@
|
|
|
153
157
|
"*.{js,jsx,ts,tsx,css,md}": "prettier --write",
|
|
154
158
|
"*.{js,css,md}": "prettier --write"
|
|
155
159
|
},
|
|
156
|
-
"version": "1.
|
|
160
|
+
"version": "1.43.0-post.2"
|
|
157
161
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { render, screen, act, fireEvent } from "@testing-library/react";
|
|
3
3
|
import JsonField, { JsonFieldHandle } from "../../../src/components/JsonField";
|
|
4
|
+
import { MONOSPACE_FONT_STACK } from "../../../src/fonts";
|
|
4
5
|
|
|
5
6
|
const setting = {
|
|
6
7
|
key: "my_json",
|
|
@@ -472,6 +473,25 @@ describe("JsonField", () => {
|
|
|
472
473
|
});
|
|
473
474
|
});
|
|
474
475
|
|
|
476
|
+
describe("use_monospace_font", () => {
|
|
477
|
+
(
|
|
478
|
+
[
|
|
479
|
+
{ id: "set", use_monospace_font: true, hasStyle: true },
|
|
480
|
+
{ id: "absent", hasStyle: false },
|
|
481
|
+
] as { id: string; use_monospace_font?: boolean; hasStyle: boolean }[]
|
|
482
|
+
).forEach(({ id, use_monospace_font, hasStyle }) => {
|
|
483
|
+
it(id, () => {
|
|
484
|
+
render(<JsonField setting={{ ...setting, use_monospace_font }} />);
|
|
485
|
+
const ta = screen.getByLabelText("JSON Setting");
|
|
486
|
+
if (hasStyle) {
|
|
487
|
+
expect(ta).toHaveStyle({ fontFamily: MONOSPACE_FONT_STACK });
|
|
488
|
+
} else {
|
|
489
|
+
expect(ta).not.toHaveStyle({ fontFamily: MONOSPACE_FONT_STACK });
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
});
|
|
493
|
+
});
|
|
494
|
+
|
|
475
495
|
describe("clear()", () => {
|
|
476
496
|
it("resets text and clears parse error", () => {
|
|
477
497
|
const ref = React.createRef<JsonFieldHandle>();
|
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { render, screen, fireEvent, act } from "@testing-library/react";
|
|
3
3
|
import userEvent from "@testing-library/user-event";
|
|
4
4
|
import ProtocolFormField from "../../../src/components/ProtocolFormField";
|
|
5
|
+
import { MONOSPACE_FONT_STACK } from "../../../src/fonts";
|
|
5
6
|
|
|
6
7
|
// NB: This file adds / duplicates existing tests from:
|
|
7
8
|
// - `src/components/__tests__/ProtocolFormField-test.tsx`.
|
|
@@ -64,6 +65,41 @@ describe("ProtocolFormField — json type", () => {
|
|
|
64
65
|
});
|
|
65
66
|
});
|
|
66
67
|
|
|
68
|
+
describe("ProtocolFormField — use_monospace_font", () => {
|
|
69
|
+
(
|
|
70
|
+
[
|
|
71
|
+
{ id: "text-input", use_monospace_font: true, hasStyle: true },
|
|
72
|
+
{
|
|
73
|
+
id: "textarea",
|
|
74
|
+
type: "textarea",
|
|
75
|
+
use_monospace_font: true,
|
|
76
|
+
hasStyle: true,
|
|
77
|
+
},
|
|
78
|
+
{ id: "absent", hasStyle: false },
|
|
79
|
+
] as {
|
|
80
|
+
id: string;
|
|
81
|
+
type?: string;
|
|
82
|
+
use_monospace_font?: boolean;
|
|
83
|
+
hasStyle: boolean;
|
|
84
|
+
}[]
|
|
85
|
+
).forEach(({ id, type, use_monospace_font, hasStyle }) => {
|
|
86
|
+
it(id, () => {
|
|
87
|
+
render(
|
|
88
|
+
<ProtocolFormField
|
|
89
|
+
setting={{ key: "f", label: "My Field", type, use_monospace_font }}
|
|
90
|
+
disabled={false}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
const el = screen.getByLabelText("My Field");
|
|
94
|
+
if (hasStyle) {
|
|
95
|
+
expect(el).toHaveStyle({ fontFamily: MONOSPACE_FONT_STACK });
|
|
96
|
+
} else {
|
|
97
|
+
expect(el).not.toHaveStyle({ fontFamily: MONOSPACE_FONT_STACK });
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
67
103
|
describe("ProtocolFormField", () => {
|
|
68
104
|
it("renders date-picker setting", async () => {
|
|
69
105
|
const user = userEvent.setup();
|