@m4l/testing 0.0.21-BC20260224-2 → 0.0.22

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.
@@ -1,42 +1,42 @@
1
- const f = () => {
2
- Cypress.Commands.add("m4lDataGrid", (e, n) => {
3
- cy.get(e).find(`[class^="M4LDataGrid-root"][data-testid^="M4LDataGrid-root-${n}"]`);
4
- }), Cypress.Commands.add("m4lDataGridValidateVisibleColumns", (e, n, l, a, r = 1) => {
5
- let c = 0, t = r;
6
- l(a).forEach((o) => {
7
- o.visible && (cy.log(`Validando columna visible: ${o.headerText} , index: ${t}`), t++, cy.m4lDataGrid(e, n).find("[role=row]").find(`[role=columnheader][aria-colindex=${t}]`).should("have.text", o.headerText), cy.m4lDataGrid(e, n).find("[role=row]").find(`[role=gridcell][aria-colindex=${t}]`).should("contain", o.value), cy.m4lDataGrid(e, n).find("[role=row]").find(`[role=columnheader][aria-colindex=${t}]`).then((m) => {
8
- const d = m.width();
9
- d !== void 0 && (c += d), cy.m4lDataGrid(e, n).find("[role=grid]").scrollTo(c, 0, { duration: 100, ensureScrollable: !1 });
1
+ const u = () => {
2
+ Cypress.Commands.add("m4lDataGrid", (e) => {
3
+ cy.get(e).find('[class^="M4LDataGrid-root"]');
4
+ }), Cypress.Commands.add("m4lDataGridValidateVisibleColumns", (e, d, l, r = 1) => {
5
+ let a = 0, i = r;
6
+ d(l).forEach((n) => {
7
+ n.visible && (cy.log(`Validando columna visible: ${n.headerText} , index: ${i}`), i++, cy.m4lDataGrid(e).find("[role=row]").find(`[role=columnheader][aria-colindex=${i}]`).should("have.text", n.headerText), cy.m4lDataGrid(e).find("[role=row]").find(`[role=gridcell][aria-colindex=${i}]`).should("contain", n.value), cy.m4lDataGrid(e).find("[role=row]").find(`[role=columnheader][aria-colindex=${i}]`).then((s) => {
8
+ const o = s.width();
9
+ o !== void 0 && (a += o), cy.m4lDataGrid(e).find("[role=grid]").scrollTo(a, 0, { duration: 100, ensureScrollable: !1 });
10
10
  }));
11
11
  });
12
- }), Cypress.Commands.add("m4lDataGridRow", (e, n, l, a) => {
13
- let r = 0, c = 0;
14
- const t = 10, o = l + 1;
15
- function m() {
16
- return cy.m4lDataGrid(e, n).find("[role=row]").not('[aria-rowindex="1"]').filter(`[aria-rowindex="${o}"]`).then((d) => {
17
- if (d.length > 0) {
18
- const i = d[0].getBoundingClientRect();
19
- if (i.top >= 0 && i.left >= 0 && i.bottom <= (window.innerHeight || document.documentElement.clientHeight) && i.right <= (window.innerWidth || document.documentElement.clientWidth))
20
- return cy.wrap(d);
12
+ }), Cypress.Commands.add("m4lDataGridRow", (e, d, l) => {
13
+ let r = 0, a = 0;
14
+ const i = 10, n = d + 1;
15
+ function s() {
16
+ return cy.m4lDataGrid(e).find("[role=row]").not('[aria-rowindex="1"]').filter(`[aria-rowindex="${n}"]`).then((o) => {
17
+ if (o.length > 0) {
18
+ const t = o[0].getBoundingClientRect();
19
+ if (t.top >= 0 && t.left >= 0 && t.bottom <= (window.innerHeight || document.documentElement.clientHeight) && t.right <= (window.innerWidth || document.documentElement.clientWidth))
20
+ return cy.wrap(o);
21
21
  }
22
- if (c >= t)
23
- throw new Error(`No se encontró la fila ${o} después de ${t} intentos`);
24
- return c++, cy.m4lDataGrid(e, n).find("[role=row]").not('[aria-rowindex="1"]').filter((u, i) => {
25
- const s = i.getBoundingClientRect();
26
- return s.top >= 0 && s.left >= 0 && s.bottom <= (window.innerHeight || document.documentElement.clientHeight) && s.right <= (window.innerWidth || document.documentElement.clientWidth);
27
- }).first().then((u) => {
28
- const i = u.height() || 0;
29
- return r += i, cy.m4lDataGrid(e, n).find("[role=grid]").scrollTo(0, r, { duration: 100, ensureScrollable: !1 }).then(() => m());
22
+ if (a >= i)
23
+ throw new Error(`No se encontró la fila ${n} después de ${i} intentos`);
24
+ return a++, cy.m4lDataGrid(e).find("[role=row]").not('[aria-rowindex="1"]').filter((m, t) => {
25
+ const c = t.getBoundingClientRect();
26
+ return c.top >= 0 && c.left >= 0 && c.bottom <= (window.innerHeight || document.documentElement.clientHeight) && c.right <= (window.innerWidth || document.documentElement.clientWidth);
27
+ }).first().then((m) => {
28
+ const t = m.height() || 0;
29
+ return r += t, cy.m4lDataGrid(e).find("[role=grid]").scrollTo(0, r, { duration: 100, ensureScrollable: !1 }).then(() => s());
30
30
  });
31
31
  });
32
32
  }
33
- return m().find(`[role=gridcell][aria-colindex="${a}"]`);
34
- }), Cypress.Commands.add("m4lDataGridRowAction", (e, n, l, a = 1, r = 1) => {
35
- cy.m4lDataGridRow(e, n, a, r).find("button").eq(0).should("be.visible", { timeout: 1e4 }).click(), cy.m4lMenuActionsItem(l);
36
- }), Cypress.Commands.add("m4lDataGridFindAllColumns", (e, n) => {
37
- cy.m4lDataGrid(e, n).find('[class^="M4LDataGrid-actionsConfigContainer"]').find("button").eq(2).click();
33
+ return s().find(`[role=gridcell][aria-colindex="${l}"]`);
34
+ }), Cypress.Commands.add("m4lDataGridRowAction", (e, d, l = 1, r = 1) => {
35
+ cy.m4lDataGridRow(e, l, r).find("button").eq(0).should("be.visible", { timeout: 1e4 }).click(), cy.m4lMenuActionsItem(d);
36
+ }), Cypress.Commands.add("m4lDataGridFindAllColumns", (e) => {
37
+ cy.m4lDataGrid(e).find('[class^="M4LDataGrid-actionsConfigContainer"]').find("button").eq(2).click();
38
38
  });
39
39
  };
40
40
  export {
41
- f as r
41
+ u as r
42
42
  };
@@ -0,0 +1,7 @@
1
+ export type M4LDataGridCypressColumn = {
2
+ key: string;
3
+ value: any;
4
+ headerText: string;
5
+ visible: boolean;
6
+ };
7
+ export type M4LGetCypressDataGridColumnsConfig<T> = (data: T) => M4LDataGridCypressColumn[];
@@ -1,18 +1,4 @@
1
- /**
2
- * Configuración de columna para DataGrid en Cypress
3
- */
4
- export type M4LDataGridCypressColumn = {
5
- key: string;
6
- value: any;
7
- headerText: string;
8
- visible: boolean;
9
- };
10
-
11
- /**
12
- * Función que obtiene la configuración de columnas del DataGrid
13
- */
14
- export type M4LGetCypressDataGridColumnsConfig<T> = (data: T) => M4LDataGridCypressColumn[];
15
-
1
+ import { M4LGetCypressDataGridColumnsConfig } from './export';
16
2
  declare global {
17
3
  namespace Cypress {
18
4
  interface Chainable {
@@ -21,18 +7,16 @@ declare global {
21
7
  * @param selector selector del grid
22
8
  * @returns el grid
23
9
  */
24
- m4lDataGrid(selector: string, gridDataTestid: string): Chainable<Element>
10
+ m4lDataGrid(selector: string): Chainable<Element>
25
11
  /**
26
12
  * Valida las columnas visibles del grid
27
13
  * @param selector selector del grid
28
- * @param gridDataTestid testid del grid
29
14
  * @param getColumnsConfig función que obtiene las columnas visibles del grid
30
15
  * @param mockData datos del grid
31
16
  * @param baseColumnIndex índice de la columna a obtener
32
17
  */
33
18
  m4lDataGridValidateVisibleColumns<T>(
34
19
  selector: string,
35
- gridDataTestid: string,
36
20
  getColumnsConfig: M4LGetCypressDataGridColumnsConfig<T>,
37
21
  mockData: T,
38
22
  baseColumnIndex?: number
@@ -40,16 +24,14 @@ declare global {
40
24
  /**
41
25
  * Obtiene la fila del grid especificada por el índice de base 1, garantizando que esté visible en el viewport
42
26
  * @param selector selector del grid
43
- * @param gridDataTestid testid del grid
44
27
  * @param targetRowBaseOneIndex índice de la fila a obtener
45
28
  * @param baseOneColumnIndex índice de la columna a obtener
46
29
  * @returns la fila del grid
47
30
  */
48
- m4lDataGridRow(selector: string, gridDataTestid: string, targetRowBaseOneIndex: number, baseOneColumnIndex: number): Chainable<JQuery<HTMLElement>>;
31
+ m4lDataGridRow(selector: string, targetRowBaseOneIndex: number, baseOneColumnIndex: number): Chainable<JQuery<HTMLElement>>;
49
32
  /**
50
33
  * Obtiene el rowAction del menuActions asociado a la fila del grid especificada por el índice de base 1
51
34
  * @param selector selector del grid
52
- * @param gridDataTestid testid del grid
53
35
  * @param menuItemIndex índice del item del menuActions
54
36
  * @param baseOneTargetRowIndex índice de la fila a obtener
55
37
  * @param baseColbaseOneColumnIndexumnIndex índice de la columna a obtener
@@ -57,7 +39,6 @@ declare global {
57
39
  */
58
40
  m4lDataGridRowAction(
59
41
  selector: string,
60
- gridDataTestid: string,
61
42
  menuItemIndex: number,
62
43
  baseOnetargetRowIndex?: number,
63
44
  baseOneColumnIndex?: number,
@@ -65,10 +46,8 @@ declare global {
65
46
 
66
47
  /**
67
48
  * Busca y muestra todas las columnas del grid principal
68
- * @param selector selector del grid
69
- * @param gridDataTestid testid del grid
70
49
  */
71
- m4lDataGridFindAllColumns(selector: string, gridDataTestid: string): Chainable<Element>
50
+ m4lDataGridFindAllColumns(selector: string): Chainable<Element>
72
51
  }
73
52
  }
74
53
  }
@@ -1,28 +1,12 @@
1
- const u = '[class*="M4LSplitLayout-splitDetail"]', E = () => {
1
+ const n = () => {
2
2
  Cypress.Commands.add("m4lDynamicFilterInputClick", () => {
3
3
  cy.get('[class*="M4LDynamicFilter-root"]').find('[class*="M4LDynamicFilter-inputFilter"]').find("input").click();
4
- }), Cypress.Commands.add("m4lDynamicFilterApplyedDateField", (e) => {
5
- cy.m4lDynamicFilterInputClick(), cy.m4lPopover().find("li").contains(e).click(), cy.m4lPopover().find("button").contains("N_D:[common_actions.intro]").click();
6
- }), Cypress.Commands.add("m4lDynamicFilterRefreshButton", (e) => {
7
- cy.get(e).find('[class*="M4LDynamicFilter-root"]').find('[class*="M4LDynamicFilter-actions"]').find('[class*="MuiButtonBase-root"]').eq(1);
8
- }), Cypress.Commands.add(
9
- "m4lDynamicFilterValidateFilterAndSortOptions",
10
- (e, a, n, o, c, l) => {
11
- const i = () => cy.get('[role="presentation"]', { timeout: 1e3 }).should("exist"), r = (t) => {
12
- i(), cy.get('[role="presentation"]', { timeout: 1e3 }).find("li").contains(t.key).click(), cy.get('[role="presentation"]', { timeout: 1e3 }).find('[class*="MuiPaper-root-MuiPopover-paper"]').should("be.visible").find("input").eq(t.inputIndex).click({ force: !0 });
13
- }, d = () => {
14
- cy.get("[role=presentation]").find("button").contains("N_D:[common_actions.intro]").click({ force: !0 });
15
- }, p = (t) => {
16
- ["select", "selectAsync", "boolean"].includes(t.type) ? (i(), cy.get('[role="presentation"]', { timeout: 1e3 }).find("li").eq(0).click({ force: !0 }), cy.get("[role=presentation]").find('[class*="MuiPaper-root-MuiPopover-paper"]').find('[class*="M4LWindowBase-headerWindowComponent"]').dblclick({ force: !0 })) : ["string", "number"].includes(t.type) && (i(), cy.get('[role="presentation"]', { timeout: 1e3 }).find("input").eq(1).type(t.value));
17
- }, s = (t, m, y, T) => {
18
- cy.log(`Validando filtro ${t.key}`), cy.get(m, { timeout: 1e3 }).find(y).eq(T).click(), r(t), p(t), d();
19
- };
20
- e(a).forEach((t) => {
21
- l ? (s(t, n, o, c), cy.get(`${u} [class*="M4LDynamicFilter-actions"] button`).eq(1).click(), cy.wait(t.endpoint, { timeout: 1e3 })) : (s(t, n, o, c), cy.wait(t.endpoint, { timeout: 1e3 }).wait("@getList", { timeout: 1e3 }));
22
- });
23
- }
24
- );
4
+ }), Cypress.Commands.add("m4lDynamicFilterApplyedDateField", (i) => {
5
+ cy.m4lDynamicFilterInputClick(), cy.m4lPopover().find("li").contains(i).click(), cy.m4lPopover().find("button").contains("N_D:[common_actions.intro]").click();
6
+ }), Cypress.Commands.add("m4lDynamicFilterRefreshButton", (i) => {
7
+ cy.get(i).find('[class*="M4LDynamicFilter-root"]').find('[class*="M4LDynamicFilter-actions"]').find('[class*="MuiButtonBase-root"]').eq(1);
8
+ });
25
9
  };
26
10
  export {
27
- E as r
11
+ n as r
28
12
  };
@@ -1,14 +1,3 @@
1
- /**
2
- * Configuración del filtro para DynamicFilter
3
- */
4
- export type M4lDynamicFilterConfig = {
5
- type: string;
6
- key: string;
7
- value: string;
8
- endpoint: string;
9
- inputIndex: number;
10
- };
11
-
12
1
  declare global {
13
2
  namespace Cypress {
14
3
  interface Chainable {
@@ -24,17 +13,6 @@ declare global {
24
13
  * Obtiene el botón de refrescar
25
14
  */
26
15
  m4lDynamicFilterRefreshButton(selector: string): Chainable<Element>;
27
- /**
28
- * Valida opciones de filtro y orden para DynamicFilter
29
- */
30
- m4lDynamicFilterValidateFilterAndSortOptions(
31
- filters: (mockFilters: M4lDynamicFilterConfig[]) => M4lDynamicFilterConfig[],
32
- mockFilters: M4lDynamicFilterConfig[],
33
- filtersOrSort: string,
34
- section: string,
35
- index: number,
36
- logs?: boolean,
37
- ): Chainable<Element>;
38
16
  }
39
17
  }
40
18
  }
@@ -1,4 +1,3 @@
1
- export * from './Accordions/commands';
2
1
  export * from './DataGrid/commands';
3
2
  export * from './DynamicFilter/commands';
4
3
  export * from './DynamicSort/commands';
@@ -1,4 +1 @@
1
1
  export { registerCommands } from './register';
2
- export type { M4lDynamicFilterConfig } from './components/DynamicFilter/types';
3
- export type { M4lAccordionsConfig } from './components/Accordions/types';
4
- export type { M4LDataGridCypressColumn, M4LGetCypressDataGridColumnsConfig } from './components/DataGrid/types';
@@ -1 +1,2 @@
1
1
  export * from './noPrivileges/interceptCommands';
2
+ export * from './noPrivileges/types';
@@ -1,4 +1,5 @@
1
+ import { Rute } from '../../../types';
1
2
  /**
2
3
  * Registra los comandos de intercepts
3
4
  */
4
- export declare const registerInterceptNoPrivilegesCommands: () => void;
5
+ export declare const registerInterceptNoPrivilegesCommands: (props?: Rute) => void;
@@ -1,6 +1,7 @@
1
- const e = () => {
1
+ const t = (e = {}) => {
2
+ const { rute: s = "main" } = e;
2
3
  Cypress.Commands.add("m4lInterceptNoPrivileges", () => {
3
- cy.intercept("GET", "**/main/auth/login*", {
4
+ cy.intercept("GET", `**/${s}/auth/login*`, {
4
5
  statusCode: 200,
5
6
  body: {
6
7
  data: {},
@@ -10,5 +11,5 @@ const e = () => {
10
11
  });
11
12
  };
12
13
  export {
13
- e as r
14
+ t as r
14
15
  };
@@ -1,4 +1,5 @@
1
+ import { Rute } from '../types';
1
2
  /**
2
3
  * Registra los comandos de la aplicación
3
4
  */
4
- export declare const registerCommands: () => void;
5
+ export declare const registerCommands: (_props?: Rute) => void;
@@ -1,16 +1,15 @@
1
- import { r } from "./components/Accordions/commands.js";
2
1
  import { r as m } from "./components/DataGrid/commands.js";
3
2
  import { r as o } from "./components/DynamicFilter/commands.js";
4
3
  import { r as s } from "./components/DynamicSort/commands.js";
5
4
  import { r as e } from "./components/MenuActions/commands.js";
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";
5
+ import { r as t } from "./components/Popover/commands.js";
6
+ import { r as a } from "./components/PropertyValue/commands.js";
7
+ import { r as i } from "./components/Tab/commands.js";
9
8
  import { r as n } from "./components/WindowBase/commands.js";
10
- import { r as d } from "./intercepts/noPrivileges/interceptCommands.js";
11
- const v = () => {
12
- r(), m(), o(), s(), e(), i(), t(), a(), n(), d();
9
+ import { r as p } from "./intercepts/noPrivileges/interceptCommands.js";
10
+ const u = (r = {}) => {
11
+ m(), o(), s(), e(), t(), a(), i(), n(), p(r);
13
12
  };
14
13
  export {
15
- v as r
14
+ u as r
16
15
  };
package/e2e/cypress.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference path="./commands/components/Accordions/types.d.ts" />
2
1
  /// <reference path="./commands/components/DataGrid/types.d.ts" />
3
2
  /// <reference path="./commands/components/DynamicFilter/types.d.ts" />
4
3
  /// <reference path="./commands/components/DynamicSort/types.d.ts" />
@@ -9,6 +8,7 @@
9
8
  /// <reference path="./commands/components/Tab/types.d.ts" />
10
9
  /// <reference path="./commands/intercepts/noPrivileges/types.d.ts" />
11
10
 
11
+ export type { M4LGetCypressDataGridColumnsConfig , M4LDataGridCypressColumn } from './commands/components/DataGrid/export';
12
12
 
13
13
  declare global {
14
14
  namespace Cypress {
@@ -18,5 +18,3 @@ declare global {
18
18
  }
19
19
  }
20
20
  }
21
-
22
- export {};
package/e2e/types.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export type OptionsRute = 'main' | 'domain' | 'admin';
2
+ export interface Rute {
3
+ rute?: OptionsRute;
4
+ }
package/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from './e2e/cypress.d';
2
1
  export * from './e2e/commands';
3
2
  export * from './testComponents';
4
3
  export * from './testTools';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@m4l/testing",
3
3
  "description": "Shared testing utilities for MFs",
4
- "version": "0.0.21-BC20260224-2+prueba-cypress",
4
+ "version": "0.0.22",
5
5
  "license": "UNLICENSED",
6
6
  "author": "M4L Team",
7
7
  "scripts": {
@@ -29,78 +29,89 @@
29
29
  "*.{js,ts,tsx}": "eslint --fix --max-warnings 0"
30
30
  },
31
31
  "dependencies": {
32
- "@storybook/addon-designs": "^8.0.0",
33
- "@storybook/addon-essentials": "8.3.4",
34
- "@storybook/addon-interactions": "8.3.4",
35
- "@storybook/addon-links": "8.3.4",
32
+ "@storybook/addon-designs": "^8.0.3",
33
+ "@storybook/addon-essentials": "^8.3.4",
34
+ "@storybook/addon-interactions": "^8.3.4",
35
+ "@storybook/addon-links": "^8.3.4",
36
36
  "@storybook/addon-onboarding": "^8.3.4",
37
37
  "@storybook/blocks": "^8.3.4",
38
- "@storybook/react": "8.3.4",
39
- "@storybook/react-vite": "8.3.4",
40
- "@storybook/test": "8.3.4",
38
+ "@storybook/react": "^8.3.4",
39
+ "@storybook/react-vite": "^8.3.4",
40
+ "@storybook/test": "^8.3.4",
41
41
  "@testing-library/dom": "^10.4.0",
42
42
  "@testing-library/jest-dom": "^6.5.0",
43
43
  "@testing-library/react": "^16.0.0",
44
44
  "@testing-library/react-hooks": "^8.0.1",
45
45
  "@testing-library/user-event": "^14.5.2",
46
+ "@types/cypress": "^1.1.6",
46
47
  "@types/jest": "^29.5.10",
47
48
  "@vitejs/plugin-react": "^4.0.0",
48
- "@vitest/coverage-istanbul": "3.1.1",
49
- "@vitest/coverage-v8": "3.1.1",
49
+ "@vitest/coverage-istanbul": "^3.1.1",
50
+ "@vitest/coverage-v8": "^3.1.1",
50
51
  "@vitest/ui": "^3.1.1",
51
52
  "cypress": "^14.1.0",
52
- "cypress-vite": "1.6.0",
53
+ "cypress-vite": "^1.5.0",
53
54
  "happy-dom": "^17.1.9",
54
- "jest-environment-jsdom": "29.7.0",
55
+ "jest-environment-jsdom": "^29.7.0",
55
56
  "jsdom": "^25.0.1",
56
57
  "storybook": "^8.3.4"
57
58
  },
58
59
  "peerDependencies": {
59
- "@types/react": "18.3.23",
60
- "react": "18.3.1",
61
- "vitest": "3.1.1"
60
+ "@types/react": "^18.0.0",
61
+ "react": "^18.0.0",
62
+ "vitest": "^3.1.1"
62
63
  },
63
64
  "devDependencies": {
64
65
  "@m4l/components": "^9.0.0",
65
66
  "@m4l/config": "^1.1.2",
66
67
  "@m4l/vite-plugins": "^1.1.5",
67
68
  "@types/node": "^22.7.3",
68
- "@types/react": "18.3.23",
69
- "@types/react-dom": "18.3.7",
70
- "eslint": "9.28.0",
71
- "lefthook": "1.11.13",
72
- "lint-staged": "15.5.2",
73
- "react": "18.3.1",
74
- "react-dom": "18.3.1",
75
- "typescript": "5.8.3",
76
- "vite": "6.3.5",
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",
77
78
  "vite-plugin-dts": "^4.2.1",
78
- "vitest": "3.1.1"
79
+ "vitest": "^3.1.1"
79
80
  },
80
81
  "resolutions": {
81
82
  "glob": "^10.4.5",
82
- "react": "18.3.1",
83
- "@types/react": "18.3.23",
84
- "@types/react-dom": "18.3.7",
85
- "react-dom": "18.3.1",
83
+ "react": "^18.0.0",
84
+ "@types/react": "^18.0.0",
85
+ "@types/react-dom": "^18.0.0",
86
+ "react-dom": "^18.0.0",
86
87
  "@vitejs/plugin-react": "^4.0.0"
87
88
  },
88
89
  "overrides": {
89
90
  "glob": "^10.4.5",
90
- "eslint": "9.28.0",
91
- "react": "18.3.1",
92
- "@types/react": "18.3.23",
93
- "@types/react-dom": "18.3.7",
94
- "react-dom": "18.3.1"
91
+ "eslint": "^9.0.0",
92
+ "react": "^18.0.0",
93
+ "@types/react": "^18.0.0",
94
+ "@types/react-dom": "^18.0.0",
95
+ "react-dom": "^18.0.0"
95
96
  },
96
97
  "files": [
97
98
  "*"
98
99
  ],
99
- "type": "module",
100
100
  "source": "./index.js",
101
- "main": "./index.js",
101
+ "main": "src/index.ts",
102
102
  "module": "./index.js",
103
+ "type": "module",
103
104
  "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
+ },
104
115
  "sideEffects": false,
105
116
  "publishConfig": {
106
117
  "access": "public"
@@ -1,95 +1,73 @@
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})`, () => {
1
+ import { expect as t } from "vitest";
2
+ const n = (o) => o?.type === "nested", h = (o) => o?.type === "date", d = (o) => o?.type === "boolean", k = (o) => o?.type === "setCheck", C = (o) => o?.type === "price", p = (o) => o?.type === "points", y = (o) => o?.type === "uncertainty", f = (o) => o?.type === "concatenated", m = (o) => o?.type === "chipStatus", V = (o, a) => {
3
+ t(o).toHaveLength(a.length), a.forEach((e, s) => {
4
+ const l = o[s], u = e.hookCall?.type ?? "none";
5
+ describe(`Column ${s + 1}: ${e.key} (${u})`, () => {
6
6
  if (it("should have the correct basic properties", () => {
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);
7
+ t(l.key).toBe(e.key), t(l.name).toBe(e.name), t(l.type).toBe(e.type), t(l.align).toBe(e.align), t(l.width).toBe(e.width), t(l.visible).toBe(e.visible), e.fixed && t(l.fixed).toBe(e.fixed);
8
8
  }), e.hookCall) {
9
- let a = !0, s = !0;
9
+ let r = !0, i = !0;
10
10
  it("should have the correct hook call properties", () => {
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
11
+ if (n(e.hookCall))
12
+ t(l.testProps).toEqual({
13
+ fieldValue: e.hookCall.fieldValue
16
14
  });
17
- else if (k(e.hookCall))
18
- l(o.testProps).toEqual({
15
+ else if (h(e.hookCall))
16
+ t(l.testProps).toEqual({
19
17
  fieldValue: e.hookCall.fieldValue,
20
18
  presentationType: e.hookCall.presentationType
21
19
  });
22
- else if (C(e.hookCall))
23
- l(o.testProps).toEqual({
20
+ else if (d(e.hookCall))
21
+ t(l.testProps).toEqual({
24
22
  fieldValue: e.hookCall.fieldValue,
25
23
  presentationType: e.hookCall.presentationType
26
24
  });
27
- else if (d(e.hookCall))
28
- l(o.testProps).toEqual({
25
+ else if (k(e.hookCall))
26
+ t(l.testProps).toEqual({
29
27
  field: e.hookCall.field,
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({
28
+ disabledGetter: t.any(Function),
29
+ rowKeyGetter: t.any(Function),
30
+ useHook: t.any(Function)
31
+ }), r = !1, i = !1;
32
+ else if (C(e.hookCall))
33
+ t(l.testProps).toEqual({
36
34
  fieldValue: e.hookCall.fieldValue
37
35
  });
38
36
  else if (p(e.hookCall))
39
- l(o.testProps).toEqual({
37
+ t(l.testProps).toEqual({
40
38
  fieldValue: e.hookCall.fieldValue,
41
39
  fieldUnit: e.hookCall.fieldUnit
42
40
  });
43
41
  else if (y(e.hookCall))
44
- l(o.testProps).toEqual({
42
+ t(l.testProps).toEqual({
45
43
  fieldValue: e.hookCall.fieldValue,
46
44
  fieldUnit: e.hookCall.fieldUnit,
47
45
  fieldSymbol: e.hookCall.fieldSymbol
48
46
  });
49
47
  else if (f(e.hookCall))
50
- l(o.testProps).toEqual({
48
+ t(l.testProps).toEqual({
51
49
  fieldValue: e.hookCall.fieldValue,
52
50
  fieldSeparator: e.hookCall.fieldSeparator
53
51
  });
54
52
  else if (m(e.hookCall))
55
- l(o.testProps).toEqual({
56
- fieldLabel: typeof e.hookCall.fieldLabel == "function" ? l.any(Function) : e.hookCall.fieldLabel,
53
+ t(l.testProps).toEqual({
54
+ fieldLabel: typeof e.hookCall.fieldLabel == "function" ? t.any(Function) : e.hookCall.fieldLabel,
57
55
  fieldStatus: e.hookCall.fieldStatus,
58
56
  statusesColors: e.hookCall.statusesColors,
59
57
  fallbackColor: e.hookCall.fallbackColor
60
58
  });
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;
81
59
  else
82
60
  throw new Error(`Unknown hook call type: ${e.hookCall?.type}`);
83
61
  }), it("should have formatter, customFilter and customSort functions", () => {
84
- l(o.formatter).toBeDefined(), a && l(o.customFilter).toBeDefined(), s && l(o.customSort).toBeDefined();
62
+ t(l.formatter).toBeDefined(), r && t(l.customFilter).toBeDefined(), i && t(l.customSort).toBeDefined();
85
63
  });
86
64
  } else
87
65
  it("should not have formatter functions", () => {
88
- l(o.formatter).toBeUndefined(), l(o.customFilter).toBeUndefined(), l(o.customSort).toBeUndefined();
66
+ t(l.formatter).toBeUndefined(), t(l.customFilter).toBeUndefined(), t(l.customSort).toBeUndefined();
89
67
  });
90
68
  });
91
69
  });
92
70
  };
93
71
  export {
94
- B as t
72
+ V as t
95
73
  };
@@ -1,7 +1,7 @@
1
- import { ColumnNestedValueFormatterProps, ColumnDateFormatterProps, ColumnBooleanFormatterProps, ColumnPriceFormatterProps, ColumnPointsFormatterProps, ColumnSetCheckFormatterProps, ColumnUncertaintyFormatterProps, ColumnConcatenatedValuesFormatterProps, Column, ColumnInteractiveCheckFormatterProps, ColumnChipStatusFormatterProps, ColumnTagsFormatterProps, ColumnIconFormatterProps, ColumnColorFormatterProps, ColumnImageFormatterProps } from '@m4l/components';
1
+ import { ColumnNestedValueFormatterProps, ColumnDateFormatterProps, ColumnBooleanFormatterProps, ColumnPriceFormatterProps, ColumnPointsFormatterProps, ColumnSetCheckFormatterProps, ColumnUncertaintyFormatterProps, ColumnConcatenatedValuesFormatterProps, Column, ColumnInteractiveCheckFormatterProps, ColumnChipStatusFormatterProps } 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' | 'tags' | 'icon' | 'color' | 'image';
4
+ type: 'nested' | 'date' | 'boolean' | 'price' | 'points' | 'interactiveCheck' | 'setCheck' | 'uncertainty' | 'concatenated' | 'chipStatus';
5
5
  };
6
6
  export type TestingNestedValueHookCall<T> = BaseHookCall & ColumnNestedValueFormatterProps<T> & {
7
7
  type: 'nested';
@@ -33,20 +33,8 @@ 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
- };
48
36
  export type TestingColumnConfig<T> = BaseColumnConfig<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>;
37
+ hookCall?: TestingNestedValueHookCall<T> | TestingDateHookCall<T> | TestingBooleanHookCall<T> | TestingPriceHookCall<T> | TestingPointsHookCall<T> | TestingInteractiveCheckHookCall<T> | TestingSetCheckHookCall<T> | TestingUncertaintyHookCall<T> | TestingConcatenatedHookCall<T> | TestingChipStatusHookCall<T>;
50
38
  };
51
39
  export type TestingColumn = Column<unknown, unknown> & {
52
40
  testProps?: Record<string, unknown>;
@@ -1,4 +0,0 @@
1
- /**
2
- * Registra los comandos de Accordions
3
- */
4
- export declare const registerAccordionsCommands: () => void;
@@ -1,19 +0,0 @@
1
- const a = () => {
2
- Cypress.Commands.add(
3
- "m4lAccordionsValidateAccordions",
4
- (o, c, r, t, l, i, n) => {
5
- cy.get('[class^="M4LDataGrid-root"]').find("[role=row]").find("[role=gridcell]").eq(1).click(), cy.get(i).find("[role=tablist]").find("button").eq(n).should("have.text", r), cy.get('[class*="M4LTabContent-root"]').find("[role=listitem]").find("[role=list]").find('[class*="M4LAccordion-accordionRoot"]').eq(t).as("currentAccordion"), cy.get("@currentAccordion").find('[class*="M4LAccordion-accordionSummary"]').should("have.text", l).click(), cy.get("@currentAccordion").within(() => {
6
- cy.get('[class*="MuiCollapse-hidden"]').should("exist");
7
- }), cy.get("@currentAccordion").find('[class*="M4LAccordion-accordionSummary"]').click(), cy.get("@currentAccordion").within(() => {
8
- cy.get('[class*="MuiCollapse-entered"]').should("exist");
9
- }), o(c).forEach((e) => {
10
- cy.get("@currentAccordion").find('[class*="M4LAccordion-accordionDetails"]').find('[role="property-value-form-role"]').eq(e.index).within(() => {
11
- cy.log(`Validando nombre ${e.key}`), cy.get('[class*="M4LPropertyValue-name"]').should("have.text", e.key), cy.log(`Validando valor ${e.value}`), cy.get('[role="property-value-value-role"][class*="M4LPropertyValue-value"]').should("have.text", e.value);
12
- });
13
- });
14
- }
15
- );
16
- };
17
- export {
18
- a as r
19
- };
@@ -1,30 +0,0 @@
1
- /**
2
- * Configuración del accordion
3
- */
4
- export type M4lAccordionsConfig = {
5
- title: string;
6
- key: string;
7
- value: any;
8
- index: number;
9
- };
10
-
11
- declare global {
12
- namespace Cypress {
13
- interface Chainable {
14
- /**
15
- * Valida los accordions
16
- */
17
- m4lAccordionsValidateAccordions(
18
- accordions: (mockAccordions: M4lAccordionsConfig[]) => M4lAccordionsConfig[],
19
- mockAccordions: M4lAccordionsConfig[],
20
- tabTitle: string,
21
- index: number,
22
- title: string,
23
- sectionGrid: string,
24
- tabIndex: number,
25
- ): Chainable<Element>;
26
- }
27
- }
28
- }
29
-
30
- export {};