@corva/create-app 0.115.0 → 0.117.0
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/lib/constants/cli.js +1 -0
- package/lib/flows/lib/manifest.js +1 -1
- package/lib/flows/steps/zip-file-list-resolve.js +3 -1
- package/lib/helpers/resolve-app-runtime.js +1 -0
- package/package.json +1 -1
- package/templates/ui/javascript/AGENTS.md +301 -0
- package/templates/ui/javascript/CLAUDE.md +1 -0
- package/templates/ui/javascript/src/App.completion.js +5 -16
- package/templates/ui/javascript/src/App.drilling.js +6 -10
- package/templates/ui/javascript/src/AppSettings.js +6 -20
- package/templates/ui/javascript/src/__tests__/App.test.js +4 -24
- package/templates/ui/javascript/src/__tests__/AppSettings.test.js +12 -5
- package/templates/ui/javascript/src/index.js +1 -0
- package/templates/ui/typescript/AGENTS.md +339 -0
- package/templates/ui/typescript/CLAUDE.md +1 -0
- package/templates/ui/typescript/src/App.completion.tsx +5 -9
- package/templates/ui/typescript/src/App.drilling.tsx +6 -8
- package/templates/ui/typescript/src/AppSettings.tsx +4 -4
- package/templates/ui/typescript/src/__mocks__/mockData.ts +15 -187
- package/templates/ui/typescript/src/__tests__/App.test.tsx +5 -73
- package/templates/ui/typescript/src/__tests__/AppSettings.test.tsx +9 -13
- package/templates/ui/typescript/src/index.js +1 -0
- package/templates/ui/typescript/src/types.ts +0 -615
- package/templates/ui/javascript/src/__mocks__/mockAppProps.js +0 -590
- package/templates/ui/javascript/src/__mocks__/mockAppSettingsProps.js +0 -290
|
@@ -2,47 +2,13 @@ import { render, screen } from '@testing-library/react';
|
|
|
2
2
|
import { AppTestWrapper } from '@corva/ui/testing';
|
|
3
3
|
|
|
4
4
|
import App from '../App';
|
|
5
|
-
import {
|
|
5
|
+
import { mockAppSettings } from '../__mocks__/mockData';
|
|
6
6
|
|
|
7
7
|
describe('<App />', () => {
|
|
8
8
|
it('should show correct layout', () => {
|
|
9
9
|
render(
|
|
10
|
-
<AppTestWrapper
|
|
11
|
-
|
|
12
|
-
appId={123}
|
|
13
|
-
maximized={false}
|
|
14
|
-
appSettings={{}}
|
|
15
|
-
onSettingChange={() => {
|
|
16
|
-
/* noop */
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
<App
|
|
20
|
-
app={mockApp}
|
|
21
|
-
package="test"
|
|
22
|
-
coordinates={{ w: 0, h: 0, x: 0, y: 0, pixelHeight: 0, pixelWidth: 0 }}
|
|
23
|
-
currentUser={mockUser}
|
|
24
|
-
devCenterRouter={{ location: { pathname: '', query: {} } }}
|
|
25
|
-
segment="test"
|
|
26
|
-
appHeaderProps={mockAppHeaderProps}
|
|
27
|
-
isNative={false}
|
|
28
|
-
layoutEnvironment={{ type: 'test', pdfReportMode: false }}
|
|
29
|
-
onSettingChange={() => {
|
|
30
|
-
/* noop */
|
|
31
|
-
}}
|
|
32
|
-
onSettingsChange={() => {
|
|
33
|
-
/* noop */
|
|
34
|
-
}}
|
|
35
|
-
setIsFullscreenModalMode={() => Promise.resolve()}
|
|
36
|
-
setIsMaximized={() => {
|
|
37
|
-
/* noop */
|
|
38
|
-
}}
|
|
39
|
-
setMainMenuItems={() => {
|
|
40
|
-
/* noop */
|
|
41
|
-
}}
|
|
42
|
-
setSecondaryMenuItems={() => {
|
|
43
|
-
/* noop */
|
|
44
|
-
}}
|
|
45
|
-
/>
|
|
10
|
+
<AppTestWrapper appSettings={mockAppSettings}>
|
|
11
|
+
<App />
|
|
46
12
|
</AppTestWrapper>
|
|
47
13
|
);
|
|
48
14
|
|
|
@@ -51,42 +17,8 @@ describe('<App />', () => {
|
|
|
51
17
|
|
|
52
18
|
it('should show correct layout when settings are not provided', () => {
|
|
53
19
|
render(
|
|
54
|
-
<AppTestWrapper
|
|
55
|
-
|
|
56
|
-
appId={123}
|
|
57
|
-
maximized={false}
|
|
58
|
-
appSettings={{}}
|
|
59
|
-
onSettingChange={() => {
|
|
60
|
-
/* noop */
|
|
61
|
-
}}
|
|
62
|
-
>
|
|
63
|
-
<App
|
|
64
|
-
app={mockApp}
|
|
65
|
-
package="test"
|
|
66
|
-
coordinates={{ w: 0, h: 0, x: 0, y: 0, pixelHeight: 0, pixelWidth: 0 }}
|
|
67
|
-
currentUser={mockUser}
|
|
68
|
-
devCenterRouter={{ location: { pathname: '', query: {} } }}
|
|
69
|
-
segment="test"
|
|
70
|
-
appHeaderProps={mockAppHeaderProps}
|
|
71
|
-
isNative={false}
|
|
72
|
-
layoutEnvironment={{ type: 'test', pdfReportMode: false }}
|
|
73
|
-
onSettingChange={() => {
|
|
74
|
-
/* noop */
|
|
75
|
-
}}
|
|
76
|
-
onSettingsChange={() => {
|
|
77
|
-
/* noop */
|
|
78
|
-
}}
|
|
79
|
-
setIsFullscreenModalMode={() => Promise.resolve()}
|
|
80
|
-
setIsMaximized={() => {
|
|
81
|
-
/* noop */
|
|
82
|
-
}}
|
|
83
|
-
setMainMenuItems={() => {
|
|
84
|
-
/* noop */
|
|
85
|
-
}}
|
|
86
|
-
setSecondaryMenuItems={() => {
|
|
87
|
-
/* noop */
|
|
88
|
-
}}
|
|
89
|
-
/>
|
|
20
|
+
<AppTestWrapper appSettings={{}}>
|
|
21
|
+
<App />
|
|
90
22
|
</AppTestWrapper>
|
|
91
23
|
);
|
|
92
24
|
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import { render, screen, act } from '@testing-library/react';
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { AppTestWrapper } from '@corva/ui/testing';
|
|
3
4
|
|
|
4
5
|
import AppSettings from '../AppSettings';
|
|
5
|
-
import { mockApp, mockUser, mockAppData } from '../__mocks__/mockData';
|
|
6
6
|
|
|
7
7
|
describe('<AppSettings />', () => {
|
|
8
8
|
it('should call onChange with a changed setting on settings change', async () => {
|
|
9
|
-
const
|
|
10
|
-
const handleSettingsChangeAll = jest.fn();
|
|
9
|
+
const handleSettingChange = jest.fn();
|
|
11
10
|
|
|
12
11
|
render(
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
onSettingChange={handleSettingsChange}
|
|
20
|
-
onSettingsChange={handleSettingsChangeAll}
|
|
21
|
-
/>
|
|
12
|
+
<AppTestWrapper
|
|
13
|
+
appSettings={{ isExampleCheckboxChecked: true }}
|
|
14
|
+
onSettingChange={handleSettingChange}
|
|
15
|
+
>
|
|
16
|
+
<AppSettings />
|
|
17
|
+
</AppTestWrapper>
|
|
22
18
|
);
|
|
23
19
|
|
|
24
20
|
const exampleCheckbox = screen.getByRole('checkbox', { name: /example/i });
|
|
@@ -27,6 +23,6 @@ describe('<AppSettings />', () => {
|
|
|
27
23
|
await userEvent.click(exampleCheckbox);
|
|
28
24
|
});
|
|
29
25
|
|
|
30
|
-
expect(
|
|
26
|
+
expect(handleSettingChange).toBeCalledWith('isExampleCheckboxChecked', false);
|
|
31
27
|
});
|
|
32
28
|
});
|