@m4l/testing 0.0.22 → 0.0.23-AQ200320226-2.beta
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/e2e/commands/components/Accordions/commands.d.ts +4 -0
- package/e2e/commands/components/Accordions/commands.js +19 -0
- package/e2e/commands/components/Accordions/types.d.ts +63 -0
- package/e2e/commands/components/CommonActions/commands.d.ts +4 -0
- package/e2e/commands/components/CommonActions/commands.js +11 -0
- package/e2e/commands/components/CommonActions/types.d.ts +20 -0
- package/e2e/commands/components/DataGrid/commands.d.ts +1 -1
- package/e2e/commands/components/DataGrid/commands.js +29 -29
- package/e2e/commands/components/DataGrid/types.d.ts +109 -24
- package/e2e/commands/components/DynamicFilter/commands.d.ts +1 -1
- package/e2e/commands/components/DynamicFilter/types.d.ts +10 -3
- package/e2e/commands/components/DynamicSort/commands.d.ts +1 -1
- package/e2e/commands/components/DynamicSort/types.d.ts +17 -1
- package/e2e/commands/components/Filters/commands.d.ts +4 -0
- package/e2e/commands/components/Filters/commands.js +24 -0
- package/e2e/commands/components/Filters/types.d.ts +91 -0
- package/e2e/commands/components/Form/commands.d.ts +4 -0
- package/e2e/commands/components/Form/commands.js +11 -0
- package/e2e/commands/components/Form/cypress/assertInitialFormState/assertInitialFormState.d.ts +5 -0
- package/e2e/commands/components/Form/cypress/assertInitialFormState/assertInitialFormState.js +20 -0
- package/e2e/commands/components/Form/cypress/assertInitialFormState/type.d.ts +105 -0
- package/e2e/commands/components/Form/cypress/assertInitialFormState/type.js +1 -0
- package/e2e/commands/components/Form/cypress/assertMandatoryFields/assertMandatoryFields.d.ts +17 -0
- package/e2e/commands/components/Form/cypress/assertMandatoryFields/assertMandatoryFields.js +14 -0
- package/e2e/commands/components/Form/cypress/assertMandatoryFields/type.d.ts +28 -0
- package/e2e/commands/components/Form/cypress/assertMandatoryFields/type.js +1 -0
- package/e2e/commands/components/Form/cypress/constants.d.ts +3 -0
- package/e2e/commands/components/Form/cypress/constants.js +6 -0
- package/e2e/commands/components/Form/cypress/fillAndAssertFormFields/fillAndAssertFormFields.d.ts +8 -0
- package/e2e/commands/components/Form/cypress/fillAndAssertFormFields/fillAndAssertFormFields.js +29 -0
- package/e2e/commands/components/Form/cypress/fillAndAssertFormFields/type.d.ts +5 -0
- package/e2e/commands/components/Form/cypress/fillAndAssertFormFields/type.js +1 -0
- package/e2e/commands/components/Form/cypress/getFormScope/getFormScope.d.ts +20 -0
- package/e2e/commands/components/Form/cypress/getFormScope/getFormScope.js +8 -0
- package/e2e/commands/components/Form/cypress/proceedFormStep/proceedFormStep.d.ts +10 -0
- package/e2e/commands/components/Form/cypress/proceedFormStep/proceedFormStep.js +6 -0
- package/e2e/commands/components/Form/cypress/proceedFormStep/type.d.ts +13 -0
- package/e2e/commands/components/Form/helpers/getFieldNameDomElement.d.ts +7 -0
- package/e2e/commands/components/Form/helpers/getFieldNameDomElement.js +13 -0
- package/e2e/commands/components/Form/types.d.ts +88 -0
- package/e2e/commands/components/MenuActions/commands.d.ts +1 -1
- package/e2e/commands/components/MenuActions/commands.js +2 -2
- package/e2e/commands/components/MenuActions/types.d.ts +16 -1
- package/e2e/commands/components/Popover/commands.d.ts +1 -1
- package/e2e/commands/components/Popover/types.d.ts +6 -0
- package/e2e/commands/components/PropertyValue/commands.d.ts +1 -1
- package/e2e/commands/components/PropertyValue/types.d.ts +9 -4
- package/e2e/commands/components/Tab/commands.d.ts +1 -1
- package/e2e/commands/components/Tab/commands.js +3 -2
- package/e2e/commands/components/Tab/types.d.ts +19 -4
- package/e2e/commands/components/WindowBase/commands.d.ts +1 -1
- package/e2e/commands/components/WindowBase/commands.js +18 -10
- package/e2e/commands/components/WindowBase/types.d.ts +89 -7
- package/e2e/commands/components/index.d.ts +4 -0
- package/e2e/commands/index.d.ts +6 -0
- package/e2e/commands/register.d.ts +1 -2
- package/e2e/commands/register.js +11 -7
- package/e2e/cypress.d.js +1 -0
- package/e2e/cypress.d.ts +5 -1
- package/index.d.ts +1 -0
- package/index.js +23 -23
- package/package.json +33 -76
- package/testComponents/DataGrid/helpers.js +52 -30
- package/testComponents/DataGrid/types.d.ts +15 -3
- package/e2e/commands/components/DataGrid/export.d.ts +0 -7
|
@@ -1,18 +1,100 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
namespace Cypress {
|
|
3
3
|
interface Chainable {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Gets the module header (draggable handle area).
|
|
6
|
+
* @example
|
|
7
|
+
* cy.m4lWindowBaseHeader().find('button').first().click();
|
|
8
|
+
*/
|
|
9
|
+
m4lWindowBaseHeader (): Chainable<Element>
|
|
10
|
+
/**
|
|
11
|
+
* Gets a button on the left side of the module by 0-based index.
|
|
12
|
+
* @example
|
|
13
|
+
* cy.m4lWindowBaseLeftAction(0).click(); // first left button
|
|
14
|
+
*/
|
|
15
|
+
m4lWindowBaseLeftAction (
|
|
16
|
+
/**
|
|
17
|
+
* Button position
|
|
18
|
+
*/
|
|
19
|
+
buttonPosition: number,
|
|
20
|
+
): Chainable<Element>
|
|
21
|
+
/**
|
|
22
|
+
* Clicks on the left button of the module by 0-based index.
|
|
23
|
+
* @example
|
|
24
|
+
* cy.m4lWindowBaseLeftActionClick(0);
|
|
25
|
+
*/
|
|
26
|
+
m4lWindowBaseLeftActionClick (
|
|
27
|
+
/**
|
|
28
|
+
* Button position
|
|
29
|
+
*/
|
|
30
|
+
buttonPosition: number,
|
|
31
|
+
): Chainable<Element>
|
|
32
|
+
/**
|
|
33
|
+
* Opens the header menu and returns the menu item at the given 0-based position.
|
|
34
|
+
* @example
|
|
35
|
+
* cy.m4lWindowBaseMenuAction(0).click(); // click first menu item
|
|
36
|
+
*/
|
|
37
|
+
m4lWindowBaseMenuAction (
|
|
38
|
+
/**
|
|
39
|
+
* Button position
|
|
40
|
+
*/
|
|
41
|
+
menuItemPosition: number,
|
|
42
|
+
): Chainable<Element>
|
|
43
|
+
/**
|
|
44
|
+
* Asserts that the menu item at the given position is disabled.
|
|
45
|
+
* @example
|
|
46
|
+
* cy.m4lWindowBaseMenuActionDisabled(2);
|
|
47
|
+
*/
|
|
48
|
+
m4lWindowBaseMenuActionDisabled (
|
|
49
|
+
/**
|
|
50
|
+
* Button position
|
|
51
|
+
*/
|
|
52
|
+
menuItemPosition: number,
|
|
53
|
+
): Chainable<Element>
|
|
54
|
+
/**
|
|
55
|
+
* Finds the dialog by title and returns the container (e.g. to then find and click accept).
|
|
56
|
+
* @example
|
|
57
|
+
* cy.m4lDialogWindowActions('Confirm').find('button').contains('Accept').click();
|
|
58
|
+
*/
|
|
59
|
+
m4lDialogWindowActions (
|
|
60
|
+
/**
|
|
61
|
+
* Dialog title
|
|
62
|
+
*/
|
|
63
|
+
title: string,
|
|
64
|
+
): Chainable<Element>
|
|
65
|
+
/**
|
|
66
|
+
* Asserts that a popup window has the given title.
|
|
67
|
+
* @example
|
|
68
|
+
* cy.m4lDialogWindowActionsValidateTitle('Edit item');
|
|
69
|
+
*/
|
|
70
|
+
m4lDialogWindowActionsValidateTitle (
|
|
71
|
+
/**
|
|
72
|
+
* Dialog title
|
|
73
|
+
*/
|
|
74
|
+
title: string,
|
|
75
|
+
): Chainable<Element>
|
|
10
76
|
// login(email: string, password: string): Chainable<void>
|
|
11
77
|
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
|
12
78
|
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
|
13
79
|
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
|
|
80
|
+
/**
|
|
81
|
+
* Validate title module of the Window Base
|
|
82
|
+
* @example
|
|
83
|
+
* ```
|
|
84
|
+
* cy.assertModuleHeaderTitle('N_D:[module_name]');
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
m4lAssertModuleHeaderTitle (title: string): Chainable<Element>
|
|
88
|
+
/**
|
|
89
|
+
* Validate icon module of the Window Base
|
|
90
|
+
* @example
|
|
91
|
+
* ```
|
|
92
|
+
* cy.assertModuleHeaderIcon('i_common_general_action_add');
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
m4lAssertModuleHeaderIcon (icon: string): Chainable<Element>
|
|
14
96
|
}
|
|
15
97
|
}
|
|
16
98
|
}
|
|
17
99
|
|
|
18
|
-
export {};
|
|
100
|
+
export { };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './Accordions/commands';
|
|
1
2
|
export * from './DataGrid/commands';
|
|
2
3
|
export * from './DynamicFilter/commands';
|
|
3
4
|
export * from './DynamicSort/commands';
|
|
@@ -6,3 +7,6 @@ export * from './Popover/commands';
|
|
|
6
7
|
export * from './PropertyValue/commands';
|
|
7
8
|
export * from './Tab/commands';
|
|
8
9
|
export * from './WindowBase/commands';
|
|
10
|
+
export * from './CommonActions/commands';
|
|
11
|
+
export * from './Filters/commands';
|
|
12
|
+
export * from './Form/commands';
|
package/e2e/commands/index.d.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
1
|
export { registerCommands } from './register';
|
|
2
|
+
export type { M4lFiltersAndSortsConfig } from './components/Filters/types';
|
|
3
|
+
export type { M4lPropertyValuesAccordionsConfig } from './components/Accordions/types';
|
|
4
|
+
export type { M4LDataGridCypressColumn, M4LGetCypressDataGridColumnsConfig } from './components/DataGrid/types';
|
|
5
|
+
export * from './components/Form/cypress/assertInitialFormState/type';
|
|
6
|
+
export * from './components/Form/cypress/assertMandatoryFields/type';
|
|
7
|
+
export * from './components/Form/cypress/fillAndAssertFormFields/type';
|
package/e2e/commands/register.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import { r } from "./components/Accordions/commands.js";
|
|
1
2
|
import { r as m } from "./components/DataGrid/commands.js";
|
|
2
3
|
import { r as o } from "./components/DynamicFilter/commands.js";
|
|
3
4
|
import { r as s } from "./components/DynamicSort/commands.js";
|
|
4
5
|
import { r as e } from "./components/MenuActions/commands.js";
|
|
5
|
-
import { r as
|
|
6
|
-
import { r as
|
|
7
|
-
import { r as
|
|
6
|
+
import { r as i } from "./components/Popover/commands.js";
|
|
7
|
+
import { r as t } from "./components/PropertyValue/commands.js";
|
|
8
|
+
import { r as a } from "./components/Tab/commands.js";
|
|
8
9
|
import { r as n } from "./components/WindowBase/commands.js";
|
|
9
|
-
import { r as
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
import { r as d } from "./components/CommonActions/commands.js";
|
|
11
|
+
import { r as p } from "./components/Filters/commands.js";
|
|
12
|
+
import { r as g } from "./intercepts/noPrivileges/interceptCommands.js";
|
|
13
|
+
import { r as C } from "./components/Form/commands.js";
|
|
14
|
+
const B = () => {
|
|
15
|
+
r(), m(), o(), s(), e(), i(), t(), a(), n(), d(), p(), g(), C();
|
|
12
16
|
};
|
|
13
17
|
export {
|
|
14
|
-
|
|
18
|
+
B as r
|
|
15
19
|
};
|
package/e2e/cypress.d.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/e2e/cypress.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="./commands/components/Accordions/types.d.ts" />
|
|
1
2
|
/// <reference path="./commands/components/DataGrid/types.d.ts" />
|
|
2
3
|
/// <reference path="./commands/components/DynamicFilter/types.d.ts" />
|
|
3
4
|
/// <reference path="./commands/components/DynamicSort/types.d.ts" />
|
|
@@ -6,9 +7,10 @@
|
|
|
6
7
|
/// <reference path="./commands/components/Popover/types.d.ts" />
|
|
7
8
|
/// <reference path="./commands/components/PropertyValue/types.d.ts" />
|
|
8
9
|
/// <reference path="./commands/components/Tab/types.d.ts" />
|
|
10
|
+
/// <reference path="./commands/components/CommonActions/types.d.ts" />
|
|
9
11
|
/// <reference path="./commands/intercepts/noPrivileges/types.d.ts" />
|
|
12
|
+
/// <reference path="./commands/components/Form/types.d.ts" />
|
|
10
13
|
|
|
11
|
-
export type { M4LGetCypressDataGridColumnsConfig , M4LDataGridCypressColumn } from './commands/components/DataGrid/export';
|
|
12
14
|
|
|
13
15
|
declare global {
|
|
14
16
|
namespace Cypress {
|
|
@@ -18,3 +20,5 @@ declare global {
|
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
}
|
|
23
|
+
|
|
24
|
+
export { };
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { act as t } from "react";
|
|
2
|
+
import { beforeEach as s, describe as f, expect as a } from "vitest";
|
|
3
|
+
import { cleanup as p, fireEvent as i, renderHook as n, screen as x, waitFor as c, within as d } from "@testing-library/react";
|
|
4
|
+
import { r as u } from "./e2e/commands/register.js";
|
|
5
|
+
import { c as C } from "./testTools/utils.js";
|
|
6
|
+
import { t as b } from "./testComponents/DataGrid/helpers.js";
|
|
7
|
+
import { t as h } from "./testComponents/DynamicFilter/helpers.js";
|
|
8
|
+
import { t as w } from "./testComponents/DynamicSort/helpers.js";
|
|
9
9
|
import { default as H } from "@testing-library/user-event";
|
|
10
10
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
t as act,
|
|
12
|
+
s as beforeEach,
|
|
13
|
+
p as cleanup,
|
|
14
|
+
f as describe,
|
|
15
|
+
a as expect,
|
|
16
|
+
i as fireEvent,
|
|
17
|
+
u as registerCommands,
|
|
18
|
+
C as render,
|
|
19
|
+
n as renderHook,
|
|
20
|
+
x as screen,
|
|
21
|
+
b as testColumnConfigs,
|
|
22
|
+
h as testFilterFields,
|
|
23
|
+
w as testSortFields,
|
|
24
24
|
H as userEvent,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
c as waitFor,
|
|
26
|
+
d as within
|
|
27
27
|
};
|
package/package.json
CHANGED
|
@@ -1,117 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/testing",
|
|
3
3
|
"description": "Shared testing utilities for MFs",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.23-AQ200320226-2.beta",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "M4L Team",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"clean": "npx -y rimraf node_modules **/node_modules/ **/dist/ dist yarn.lock .yarn .config/yarn package-lock.json",
|
|
9
|
-
"typescript": "tsc --noEmit",
|
|
10
|
-
"build": "yarn lint:fix && tsc && vite build && buildM4lPackage",
|
|
11
|
-
"build:only": "vite build && buildM4lPackage",
|
|
12
|
-
"buildM4Lpackage:monorepo": "node ../m4l_vite_plugins/dist/bin/buildM4lPackage.js",
|
|
13
|
-
"build:monorepo": "yarn lint:fix && tsc && vite build",
|
|
14
|
-
"build:only:monorepo": "tsc && vite build && yarn buildM4Lpackage:monorepo",
|
|
15
|
-
"release": "yarn build && npm publish ./dist",
|
|
16
|
-
"release:monorepo": "yarn build:monorepo && cd dist && npm publish",
|
|
17
|
-
"release:monorepo:beta": "yarn build:monorepo && cd dist && npm publish --tag beta",
|
|
18
|
-
"release:monorepo:beta:only": "cd dist && npm publish --tag beta",
|
|
19
|
-
"lint": "npx eslint . --max-warnings 0",
|
|
20
|
-
"lint:fix": "yarn lint --fix --max-warnings 0",
|
|
21
|
-
"lefthook:install": "lefthook install",
|
|
22
|
-
"test": "vitest --config vitest.config.ts",
|
|
23
|
-
"test:only": "vitest --config vitest.config.ts --allowOnly",
|
|
24
|
-
"coverage": "vitest run --coverage",
|
|
25
|
-
"coverage:ui": "vitest --ui run --coverage ",
|
|
26
|
-
"docs": "typedoc --entryPointStrategy expand --tsconfig ./tsconfig.json"
|
|
27
|
-
},
|
|
28
7
|
"lint-staged": {
|
|
29
8
|
"*.{js,ts,tsx}": "eslint --fix --max-warnings 0"
|
|
30
9
|
},
|
|
31
10
|
"dependencies": {
|
|
32
|
-
"@storybook/addon-designs": "^8.0.
|
|
33
|
-
"@storybook/addon-essentials": "
|
|
34
|
-
"@storybook/addon-interactions": "
|
|
35
|
-
"@storybook/addon-links": "
|
|
11
|
+
"@storybook/addon-designs": "^8.0.0",
|
|
12
|
+
"@storybook/addon-essentials": "8.3.4",
|
|
13
|
+
"@storybook/addon-interactions": "8.3.4",
|
|
14
|
+
"@storybook/addon-links": "8.3.4",
|
|
36
15
|
"@storybook/addon-onboarding": "^8.3.4",
|
|
37
16
|
"@storybook/blocks": "^8.3.4",
|
|
38
|
-
"@storybook/react": "
|
|
39
|
-
"@storybook/react-vite": "
|
|
40
|
-
"@storybook/test": "
|
|
17
|
+
"@storybook/react": "8.3.4",
|
|
18
|
+
"@storybook/react-vite": "8.3.4",
|
|
19
|
+
"@storybook/test": "8.3.4",
|
|
41
20
|
"@testing-library/dom": "^10.4.0",
|
|
42
21
|
"@testing-library/jest-dom": "^6.5.0",
|
|
43
22
|
"@testing-library/react": "^16.0.0",
|
|
44
23
|
"@testing-library/react-hooks": "^8.0.1",
|
|
45
24
|
"@testing-library/user-event": "^14.5.2",
|
|
46
|
-
"@types/cypress": "^1.1.6",
|
|
47
25
|
"@types/jest": "^29.5.10",
|
|
48
26
|
"@vitejs/plugin-react": "^4.0.0",
|
|
49
|
-
"@vitest/coverage-istanbul": "
|
|
50
|
-
"@vitest/coverage-v8": "
|
|
27
|
+
"@vitest/coverage-istanbul": "3.1.1",
|
|
28
|
+
"@vitest/coverage-v8": "3.1.1",
|
|
51
29
|
"@vitest/ui": "^3.1.1",
|
|
52
30
|
"cypress": "^14.1.0",
|
|
53
|
-
"cypress-vite": "
|
|
31
|
+
"cypress-vite": "1.6.0",
|
|
54
32
|
"happy-dom": "^17.1.9",
|
|
55
|
-
"jest-environment-jsdom": "
|
|
33
|
+
"jest-environment-jsdom": "29.7.0",
|
|
56
34
|
"jsdom": "^25.0.1",
|
|
57
35
|
"storybook": "^8.3.4"
|
|
58
36
|
},
|
|
59
37
|
"peerDependencies": {
|
|
60
|
-
"@types/react": "
|
|
61
|
-
"react": "
|
|
62
|
-
"vitest": "
|
|
63
|
-
},
|
|
64
|
-
"devDependencies": {
|
|
65
|
-
"@m4l/components": "^9.0.0",
|
|
66
|
-
"@m4l/config": "^1.1.2",
|
|
67
|
-
"@m4l/vite-plugins": "^1.1.5",
|
|
68
|
-
"@types/node": "^22.7.3",
|
|
69
|
-
"@types/react": "^18.0.0",
|
|
70
|
-
"@types/react-dom": "^18.0.0",
|
|
71
|
-
"eslint": "^9.0.0",
|
|
72
|
-
"lefthook": "^1.7.18",
|
|
73
|
-
"lint-staged": "^15.2.10",
|
|
74
|
-
"react": "^18.0.0",
|
|
75
|
-
"react-dom": "^18.0.0",
|
|
76
|
-
"typescript": "^5.4.5",
|
|
77
|
-
"vite": "^6.3.5",
|
|
78
|
-
"vite-plugin-dts": "^4.2.1",
|
|
79
|
-
"vitest": "^3.1.1"
|
|
38
|
+
"@types/react": "18.3.23",
|
|
39
|
+
"react": "18.3.1",
|
|
40
|
+
"vitest": "3.1.1"
|
|
80
41
|
},
|
|
81
42
|
"resolutions": {
|
|
82
43
|
"glob": "^10.4.5",
|
|
83
|
-
"react": "
|
|
84
|
-
"@types/react": "
|
|
85
|
-
"@types/react-dom": "
|
|
86
|
-
"react-dom": "
|
|
44
|
+
"react": "18.3.1",
|
|
45
|
+
"@types/react": "18.3.23",
|
|
46
|
+
"@types/react-dom": "18.3.7",
|
|
47
|
+
"react-dom": "18.3.1",
|
|
87
48
|
"@vitejs/plugin-react": "^4.0.0"
|
|
88
49
|
},
|
|
89
50
|
"overrides": {
|
|
90
51
|
"glob": "^10.4.5",
|
|
91
|
-
"eslint": "
|
|
92
|
-
"react": "
|
|
93
|
-
"@types/react": "
|
|
94
|
-
"@types/react-dom": "
|
|
95
|
-
"react-dom": "
|
|
52
|
+
"eslint": "9.28.0",
|
|
53
|
+
"react": "18.3.1",
|
|
54
|
+
"@types/react": "18.3.23",
|
|
55
|
+
"@types/react-dom": "18.3.7",
|
|
56
|
+
"react-dom": "18.3.1"
|
|
96
57
|
},
|
|
97
58
|
"files": [
|
|
98
59
|
"*"
|
|
99
60
|
],
|
|
61
|
+
"type": "module",
|
|
100
62
|
"source": "./index.js",
|
|
101
|
-
"main": "src/index.ts",
|
|
63
|
+
"main": "./src/index.ts",
|
|
102
64
|
"module": "./index.js",
|
|
103
|
-
"type": "module",
|
|
104
65
|
"types": "./index.d.ts",
|
|
105
|
-
"exports": {
|
|
106
|
-
".": {
|
|
107
|
-
"types": "./index.d.ts",
|
|
108
|
-
"import": "./index.js",
|
|
109
|
-
"require": null
|
|
110
|
-
},
|
|
111
|
-
"./cypress": {
|
|
112
|
-
"types": "./e2e/cypress.d.ts"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
66
|
"sideEffects": false,
|
|
116
67
|
"publishConfig": {
|
|
117
68
|
"access": "public"
|
|
@@ -119,5 +70,11 @@
|
|
|
119
70
|
"engines": {
|
|
120
71
|
"node": ">=12.0.0"
|
|
121
72
|
},
|
|
122
|
-
"packageManager": "yarn@4.5.0"
|
|
73
|
+
"packageManager": "yarn@4.5.0",
|
|
74
|
+
"private": false,
|
|
75
|
+
"exports": {
|
|
76
|
+
".": {
|
|
77
|
+
"import": "./index.js"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
123
80
|
}
|
|
@@ -1,73 +1,95 @@
|
|
|
1
|
-
import { expect as
|
|
2
|
-
const
|
|
3
|
-
t
|
|
4
|
-
const
|
|
5
|
-
describe(`Column ${
|
|
1
|
+
import { expect as l } from "vitest";
|
|
2
|
+
const i = (t) => t?.type === "nested", k = (t) => t?.type === "date", C = (t) => t?.type === "boolean", d = (t) => t?.type === "setCheck", n = (t) => t?.type === "price", p = (t) => t?.type === "points", y = (t) => t?.type === "uncertainty", f = (t) => t?.type === "concatenated", m = (t) => t?.type === "chipStatus", V = (t) => t?.type === "tags", I = (t) => t?.type === "icon", P = (t) => t?.type === "color", E = (t) => t?.type === "image", B = (t, r) => {
|
|
3
|
+
l(t).toHaveLength(r.length), r.forEach((e, u) => {
|
|
4
|
+
const o = t[u], h = e.hookCall?.type ?? "none";
|
|
5
|
+
describe(`Column ${u + 1}: ${e.key} (${h})`, () => {
|
|
6
6
|
if (it("should have the correct basic properties", () => {
|
|
7
|
-
|
|
7
|
+
l(o.key).toBe(e.key), l(o.name).toBe(e.name), l(o.type).toBe(e.type), l(o.align).toBe(e.align), l(o.width).toBe(e.width), l(o.visible).toBe(e.visible), e.fixed && l(o.fixed).toBe(e.fixed);
|
|
8
8
|
}), e.hookCall) {
|
|
9
|
-
let
|
|
9
|
+
let a = !0, s = !0;
|
|
10
10
|
it("should have the correct hook call properties", () => {
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
fieldValue: e.hookCall.fieldValue
|
|
11
|
+
if (i(e.hookCall))
|
|
12
|
+
l(o.testProps).toEqual({
|
|
13
|
+
fieldValue: e.hookCall.fieldValue,
|
|
14
|
+
defaultValue: e.hookCall.defaultValue,
|
|
15
|
+
Component: e.hookCall.Component
|
|
14
16
|
});
|
|
15
|
-
else if (
|
|
16
|
-
|
|
17
|
+
else if (k(e.hookCall))
|
|
18
|
+
l(o.testProps).toEqual({
|
|
17
19
|
fieldValue: e.hookCall.fieldValue,
|
|
18
20
|
presentationType: e.hookCall.presentationType
|
|
19
21
|
});
|
|
20
|
-
else if (
|
|
21
|
-
|
|
22
|
+
else if (C(e.hookCall))
|
|
23
|
+
l(o.testProps).toEqual({
|
|
22
24
|
fieldValue: e.hookCall.fieldValue,
|
|
23
25
|
presentationType: e.hookCall.presentationType
|
|
24
26
|
});
|
|
25
|
-
else if (
|
|
26
|
-
|
|
27
|
+
else if (d(e.hookCall))
|
|
28
|
+
l(o.testProps).toEqual({
|
|
27
29
|
field: e.hookCall.field,
|
|
28
|
-
disabledGetter:
|
|
29
|
-
rowKeyGetter:
|
|
30
|
-
useHook:
|
|
31
|
-
}),
|
|
32
|
-
else if (
|
|
33
|
-
|
|
30
|
+
disabledGetter: l.any(Function),
|
|
31
|
+
rowKeyGetter: l.any(Function),
|
|
32
|
+
useHook: l.any(Function)
|
|
33
|
+
}), a = !1, s = !1;
|
|
34
|
+
else if (n(e.hookCall))
|
|
35
|
+
l(o.testProps).toEqual({
|
|
34
36
|
fieldValue: e.hookCall.fieldValue
|
|
35
37
|
});
|
|
36
38
|
else if (p(e.hookCall))
|
|
37
|
-
|
|
39
|
+
l(o.testProps).toEqual({
|
|
38
40
|
fieldValue: e.hookCall.fieldValue,
|
|
39
41
|
fieldUnit: e.hookCall.fieldUnit
|
|
40
42
|
});
|
|
41
43
|
else if (y(e.hookCall))
|
|
42
|
-
|
|
44
|
+
l(o.testProps).toEqual({
|
|
43
45
|
fieldValue: e.hookCall.fieldValue,
|
|
44
46
|
fieldUnit: e.hookCall.fieldUnit,
|
|
45
47
|
fieldSymbol: e.hookCall.fieldSymbol
|
|
46
48
|
});
|
|
47
49
|
else if (f(e.hookCall))
|
|
48
|
-
|
|
50
|
+
l(o.testProps).toEqual({
|
|
49
51
|
fieldValue: e.hookCall.fieldValue,
|
|
50
52
|
fieldSeparator: e.hookCall.fieldSeparator
|
|
51
53
|
});
|
|
52
54
|
else if (m(e.hookCall))
|
|
53
|
-
|
|
54
|
-
fieldLabel: typeof e.hookCall.fieldLabel == "function" ?
|
|
55
|
+
l(o.testProps).toEqual({
|
|
56
|
+
fieldLabel: typeof e.hookCall.fieldLabel == "function" ? l.any(Function) : e.hookCall.fieldLabel,
|
|
55
57
|
fieldStatus: e.hookCall.fieldStatus,
|
|
56
58
|
statusesColors: e.hookCall.statusesColors,
|
|
57
59
|
fallbackColor: e.hookCall.fallbackColor
|
|
58
60
|
});
|
|
61
|
+
else if (V(e.hookCall))
|
|
62
|
+
l(o.testProps).toEqual({
|
|
63
|
+
fieldValue: e.hookCall.fieldValue
|
|
64
|
+
});
|
|
65
|
+
else if (I(e.hookCall))
|
|
66
|
+
l(o.testProps).toEqual({
|
|
67
|
+
getIconProps: l.any(Function)
|
|
68
|
+
}), a = !1, s = !1;
|
|
69
|
+
else if (P(e.hookCall))
|
|
70
|
+
l(o.testProps).toEqual({
|
|
71
|
+
fieldValue: e.hookCall.fieldValue
|
|
72
|
+
}), a = !1, s = !1;
|
|
73
|
+
else if (E(e.hookCall))
|
|
74
|
+
l(o.testProps).toEqual({
|
|
75
|
+
fieldValue: e.hookCall.fieldValue,
|
|
76
|
+
fieldText: e.hookCall.fieldText,
|
|
77
|
+
cover: e.hookCall.cover,
|
|
78
|
+
width: e.hookCall.width,
|
|
79
|
+
height: e.hookCall.height
|
|
80
|
+
}), a = !1, s = !1;
|
|
59
81
|
else
|
|
60
82
|
throw new Error(`Unknown hook call type: ${e.hookCall?.type}`);
|
|
61
83
|
}), it("should have formatter, customFilter and customSort functions", () => {
|
|
62
|
-
|
|
84
|
+
l(o.formatter).toBeDefined(), a && l(o.customFilter).toBeDefined(), s && l(o.customSort).toBeDefined();
|
|
63
85
|
});
|
|
64
86
|
} else
|
|
65
87
|
it("should not have formatter functions", () => {
|
|
66
|
-
|
|
88
|
+
l(o.formatter).toBeUndefined(), l(o.customFilter).toBeUndefined(), l(o.customSort).toBeUndefined();
|
|
67
89
|
});
|
|
68
90
|
});
|
|
69
91
|
});
|
|
70
92
|
};
|
|
71
93
|
export {
|
|
72
|
-
|
|
94
|
+
B as t
|
|
73
95
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ColumnNestedValueFormatterProps, ColumnDateFormatterProps, ColumnBooleanFormatterProps, ColumnPriceFormatterProps, ColumnPointsFormatterProps, ColumnSetCheckFormatterProps, ColumnUncertaintyFormatterProps, ColumnConcatenatedValuesFormatterProps, Column, ColumnInteractiveCheckFormatterProps, ColumnChipStatusFormatterProps } from '@m4l/components';
|
|
1
|
+
import { ColumnNestedValueFormatterProps, ColumnDateFormatterProps, ColumnBooleanFormatterProps, ColumnPriceFormatterProps, ColumnPointsFormatterProps, ColumnSetCheckFormatterProps, ColumnUncertaintyFormatterProps, ColumnConcatenatedValuesFormatterProps, Column, ColumnInteractiveCheckFormatterProps, ColumnChipStatusFormatterProps, ColumnTagsFormatterProps, ColumnIconFormatterProps, ColumnColorFormatterProps, ColumnImageFormatterProps } from '@m4l/components';
|
|
2
2
|
type BaseColumnConfig<T> = Column<T, unknown>;
|
|
3
3
|
type BaseHookCall = {
|
|
4
|
-
type: 'nested' | 'date' | 'boolean' | 'price' | 'points' | 'interactiveCheck' | 'setCheck' | 'uncertainty' | 'concatenated' | 'chipStatus';
|
|
4
|
+
type: 'nested' | 'date' | 'boolean' | 'price' | 'points' | 'interactiveCheck' | 'setCheck' | 'uncertainty' | 'concatenated' | 'chipStatus' | 'tags' | 'icon' | 'color' | 'image';
|
|
5
5
|
};
|
|
6
6
|
export type TestingNestedValueHookCall<T> = BaseHookCall & ColumnNestedValueFormatterProps<T> & {
|
|
7
7
|
type: 'nested';
|
|
@@ -33,8 +33,20 @@ export type TestingConcatenatedHookCall<T> = BaseHookCall & ColumnConcatenatedVa
|
|
|
33
33
|
export type TestingChipStatusHookCall<T> = BaseHookCall & ColumnChipStatusFormatterProps<T> & {
|
|
34
34
|
type: 'chipStatus';
|
|
35
35
|
};
|
|
36
|
+
export type TestingTagsHookCall<T> = BaseHookCall & ColumnTagsFormatterProps<T> & {
|
|
37
|
+
type: 'tags';
|
|
38
|
+
};
|
|
39
|
+
export type TestingIconHookCall<T> = BaseHookCall & ColumnIconFormatterProps<T> & {
|
|
40
|
+
type: 'icon';
|
|
41
|
+
};
|
|
42
|
+
export type TestingColorHookCall<T> = BaseHookCall & ColumnColorFormatterProps<T> & {
|
|
43
|
+
type: 'color';
|
|
44
|
+
};
|
|
45
|
+
export type TestingImageHookCall<T> = BaseHookCall & ColumnImageFormatterProps<T> & {
|
|
46
|
+
type: 'image';
|
|
47
|
+
};
|
|
36
48
|
export type TestingColumnConfig<T> = BaseColumnConfig<T> & {
|
|
37
|
-
hookCall?: TestingNestedValueHookCall<T> | TestingDateHookCall<T> | TestingBooleanHookCall<T> | TestingPriceHookCall<T> | TestingPointsHookCall<T> | TestingInteractiveCheckHookCall<T> | TestingSetCheckHookCall<T> | TestingUncertaintyHookCall<T> | TestingConcatenatedHookCall<T> | TestingChipStatusHookCall<T>;
|
|
49
|
+
hookCall?: TestingNestedValueHookCall<T> | TestingDateHookCall<T> | TestingBooleanHookCall<T> | TestingPriceHookCall<T> | TestingPointsHookCall<T> | TestingInteractiveCheckHookCall<T> | TestingSetCheckHookCall<T> | TestingUncertaintyHookCall<T> | TestingConcatenatedHookCall<T> | TestingChipStatusHookCall<T> | TestingTagsHookCall<T> | TestingIconHookCall<T> | TestingColorHookCall<T> | TestingImageHookCall<T>;
|
|
38
50
|
};
|
|
39
51
|
export type TestingColumn = Column<unknown, unknown> & {
|
|
40
52
|
testProps?: Record<string, unknown>;
|