@plurix/ecom-components 0.0.2-beta.8 → 1.0.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.
@@ -1,4 +1,4 @@
1
- import { HAS_WINDOW as a } from "./constants.js";
1
+ import { HAS_WINDOW as a } from "../../../constants/index.js";
2
2
  const n = (t, e) => {
3
3
  a && localStorage.setItem(t, e);
4
4
  }, s = (t) => {
@@ -0,0 +1 @@
1
+ .no-scroll{overflow:hidden;touch-action:none}#modal-container{position:fixed;top:0;right:0;bottom:0;left:0;z-index:999;width:100%;height:100%;display:flex;align-items:flex-end;background-color:var(--color-support-overlay)}@media (min-width: 768px){#modal-container{justify-content:center;align-items:center}}#modal-content-container{max-height:85%;height:100%;width:100%}@media (min-width: 768px){#modal-content-container{max-width:550px}}#modal-content-container>div{height:100%;width:100%}#modal-content-container>div #modal-content{width:100%;height:100%;background-color:var(--color-grayScale-white);border-radius:16px 16px 0 0;position:relative}#modal-content-container>div #modal-content header{display:flex;justify-content:space-between;align-items:flex-start;height:56px;padding:16px}#modal-content-container>div #modal-content header .modal-title{color:var(--color-grayScale);font-size:14px;line-height:18px;font-weight:400}@media (min-width: 768px){#modal-content-container>div #modal-content header .modal-title{font-size:16px;line-height:20px}}#modal-content-container>div #modal-content header button{display:flex;align-items:center;justify-content:center;outline:none;border:none;padding:0;background-color:transparent;cursor:pointer}#modal-content-container>div #modal-content header button.modal-title{color:var(--color-support-links);text-decoration:underline}#modal-content-container>div #modal-content header button.modal-close{margin-left:10px}#modal-content-container>div #modal-content #modal-scroll{max-height:calc(100% - 56px);height:100%;overflow-y:auto}#modal-content-container>div #modal-content #modal-scroll::-webkit-scrollbar{width:4px;background-color:var(--color-grayScale-light)}#modal-content-container>div #modal-content #modal-scroll::-webkit-scrollbar-thumb{width:4px;background-color:var(--color-main);border-radius:20px}#modal-content-container>div footer{position:absolute;bottom:0;left:0;width:100%;box-shadow:0 -4px 4px var(--color-support-shadow);padding:24px 16px;background-color:var(--color-grayScale-white)}
package/package.json CHANGED
@@ -1,58 +1,72 @@
1
- {
2
- "name": "@plurix/ecom-components",
3
- "author": "Plurix",
4
- "private": false,
5
- "version": "0.0.2-beta.8",
6
- "type": "module",
7
- "main": "dist/main.js",
8
- "types": "dist/main.d.ts",
9
- "files": [
10
- "dist"
11
- ],
12
- "repository": {
13
- "type": "git",
14
- "url": "https://github.com/plurix-ecommerce/ecom-components"
15
- },
16
- "sideEffects": [
17
- "**/*.css"
18
- ],
19
- "scripts": {
20
- "dev": "vite",
21
- "build": "tsc --p ./tsconfig-build.json && vite build",
22
- "format": "prettier --write .",
23
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
24
- "preview": "vite preview"
25
- },
26
- "peerDependencies": {
27
- "react": "^18.2.0",
28
- "react-dom": "^18.2.0"
29
- },
30
- "devDependencies": {
31
- "@commitlint/cli": "^17.4.2",
32
- "@commitlint/config-conventional": "^17.4.2",
33
- "@testing-library/jest-dom": "^6.4.5",
34
- "@testing-library/react": "^15.0.7",
35
- "@types/jest": "^29.5.12",
36
- "@types/node": "^20.11.30",
37
- "@types/react": "^18.2.71",
38
- "@types/react-dom": "^18.2.22",
39
- "@typescript-eslint/eslint-plugin": "^6.21.0",
40
- "@typescript-eslint/parser": "^6.21.0",
41
- "@vitejs/plugin-react": "^4.2.1",
42
- "eslint": "^8.57.0",
43
- "eslint-plugin-react-hooks": "^4.6.0",
44
- "eslint-plugin-react-refresh": "^0.4.6",
45
- "glob": "^10.3.10",
46
- "prettier": "^2.2.1",
47
- "react": "^18.2.0",
48
- "react-dom": "^18.2.0",
49
- "typescript": "^5.4.3",
50
- "vite": "^4.5.3",
51
- "vite-plugin-dts": "^3.7.3",
52
- "vite-plugin-lib-inject-css": "^2.0.1"
53
- },
54
- "dependencies": {
55
- "@acctglobal/skeleton": "^1.0.0",
56
- "axios": "1.3.0"
57
- }
58
- }
1
+ {
2
+ "name": "@plurix/ecom-components",
3
+ "author": "Plurix",
4
+ "private": false,
5
+ "version": "1.0.0",
6
+ "type": "module",
7
+ "main": "dist/main.js",
8
+ "types": "dist/main.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/plurix-ecommerce/ecom-components"
15
+ },
16
+ "sideEffects": [
17
+ "**/*.css"
18
+ ],
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "build": "tsc --p ./tsconfig-build.json && vite build",
22
+ "format": "prettier --write .",
23
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
24
+ "prepare": "husky install",
25
+ "preview": "vite preview",
26
+ "test": "jest"
27
+ },
28
+ "peerDependencies": {
29
+ "react": "^18.2.0",
30
+ "react-dom": "^18.2.0"
31
+ },
32
+ "devDependencies": {
33
+ "@babel/preset-env": "^7.24.5",
34
+ "@babel/preset-react": "^7.24.1",
35
+ "@commitlint/cli": "^17.4.2",
36
+ "@commitlint/config-conventional": "^17.4.2",
37
+ "@jest/globals": "^29.7.0",
38
+ "@testing-library/jest-dom": "^6.4.5",
39
+ "@testing-library/react": "^15.0.7",
40
+ "@types/jest": "^29.5.12",
41
+ "@types/node": "^20.11.30",
42
+ "@types/react": "^18.2.71",
43
+ "@types/react-dom": "^18.2.22",
44
+ "@types/react-outside-click-handler": "^1.3.3",
45
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
46
+ "@typescript-eslint/parser": "^6.21.0",
47
+ "@vitejs/plugin-react": "^4.2.1",
48
+ "eslint": "^8.57.0",
49
+ "eslint-plugin-react-hooks": "^4.6.0",
50
+ "eslint-plugin-react-refresh": "^0.4.6",
51
+ "glob": "^10.3.10",
52
+ "husky": "^9.0.11",
53
+ "identity-obj-proxy": "^3.0.0",
54
+ "jest": "^29.7.0",
55
+ "jest-environment-jsdom": "^29.7.0",
56
+ "jest-svg-transformer": "^1.0.0",
57
+ "prettier": "^2.2.1",
58
+ "react": "^18.2.0",
59
+ "react-dom": "^18.2.0",
60
+ "rollup-plugin-delete": "^2.0.0",
61
+ "ts-jest": "^29.1.2",
62
+ "typescript": "^5.4.3",
63
+ "vite": "^4.5.3",
64
+ "vite-plugin-dts": "^3.7.3",
65
+ "vite-plugin-lib-inject-css": "^2.0.1"
66
+ },
67
+ "dependencies": {
68
+ "@acctglobal/skeleton": "^1.0.0",
69
+ "axios": "^1.5.1",
70
+ "react-outside-click-handler": "^1.3.0"
71
+ }
72
+ }
@@ -1,80 +0,0 @@
1
- import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
- import { render as i } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
- import { Carousel as t } from "../Carousel.js";
5
- const d = {
6
- width: "226px",
7
- height: "400px"
8
- };
9
- describe("Carousel", () => {
10
- it("Should render Component", () => {
11
- const { queryByTestId: r } = i(
12
- /* @__PURE__ */ l(t, { qtyItems: 5, children: [
13
- /* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 1" }) }),
14
- ",",
15
- /* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 2" }) }),
16
- ",",
17
- /* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 3" }) }),
18
- ",",
19
- /* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 4" }) }),
20
- ",",
21
- /* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 5" }) }),
22
- ",",
23
- /* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 6" }) }),
24
- ",",
25
- /* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 7" }) }),
26
- ",",
27
- /* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 8" }) }),
28
- ",",
29
- /* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 9" }) })
30
- ] })
31
- );
32
- expect(r("Carousel")).toBeInTheDocument();
33
- }), it("Should render elements in carousel ", () => {
34
- const { queryByTestId: r } = i(
35
- /* @__PURE__ */ l(t, { qtyItems: 5, children: [
36
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 1", children: /* @__PURE__ */ e("p", { children: "Carousel 1" }) }),
37
- ",",
38
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 2", children: /* @__PURE__ */ e("p", { children: "Carousel 2" }) }),
39
- ",",
40
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 3", children: /* @__PURE__ */ e("p", { children: "Carousel 3" }) }),
41
- ",",
42
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 4", children: /* @__PURE__ */ e("p", { children: "Carousel 4" }) }),
43
- ",",
44
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 5", children: /* @__PURE__ */ e("p", { children: "Carousel 5" }) }),
45
- ",",
46
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 6", children: /* @__PURE__ */ e("p", { children: "Carousel 6" }) }),
47
- ",",
48
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 7", children: /* @__PURE__ */ e("p", { children: "Carousel 7" }) }),
49
- ",",
50
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 8", children: /* @__PURE__ */ e("p", { children: "Carousel 8" }) }),
51
- ",",
52
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 9", children: /* @__PURE__ */ e("p", { children: "Carousel 9" }) })
53
- ] })
54
- );
55
- expect(r("Carousel 5")).toBeInTheDocument(), expect(r("Carousel 10")).not.toBeInTheDocument();
56
- }), it("Should render elements in carousel with label ", () => {
57
- const { getAllByText: r } = i(
58
- /* @__PURE__ */ l(t, { qtyItems: 5, children: [
59
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 1", children: /* @__PURE__ */ e("p", { children: "Carousel 1" }) }),
60
- ",",
61
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 2", children: /* @__PURE__ */ e("p", { children: "Carousel 2" }) }),
62
- ",",
63
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 3", children: /* @__PURE__ */ e("p", { children: "Carousel 3" }) }),
64
- ",",
65
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 4", children: /* @__PURE__ */ e("p", { children: "Carousel 4" }) }),
66
- ",",
67
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 5", children: /* @__PURE__ */ e("p", { children: "Carousel 5" }) }),
68
- ",",
69
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 6", children: /* @__PURE__ */ e("p", { children: "Carousel 6" }) }),
70
- ",",
71
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 7", children: /* @__PURE__ */ e("p", { children: "Carousel 7" }) }),
72
- ",",
73
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 8", children: /* @__PURE__ */ e("p", { children: "Carousel 8" }) }),
74
- ",",
75
- /* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 9", children: /* @__PURE__ */ e("p", { children: "Carousel 9" }) })
76
- ] })
77
- );
78
- expect(r("Carousel 9").length).toBe(1);
79
- });
80
- });
@@ -1,18 +0,0 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { render as r } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
- import { Alert as s } from "../components/Alert.js";
5
- describe("Alert component tests", () => {
6
- it('renders success alert when type is "success"', () => {
7
- const { getByTestId: e, getByText: t } = r(/* @__PURE__ */ o(s, { type: "success" }));
8
- expect(e("success-icon")).toBeInTheDocument(), expect(t("Cupom aplicado com sucesso")).toBeInTheDocument();
9
- }), it('renders removed alert when type is "removed"', () => {
10
- const { getByText: e, getByTestId: t } = r(/* @__PURE__ */ o(s, { type: "removed" }));
11
- expect(t("success-icon")).toBeInTheDocument(), expect(e("Cupom removido com sucesso")).toBeInTheDocument();
12
- }), it('renders error alert when type is "error"', () => {
13
- const { getByTestId: e, getByText: t } = r(/* @__PURE__ */ o(s, { type: "error" }));
14
- expect(e("error-icon")).toBeInTheDocument(), expect(
15
- t("Não foi possível aplicar o cupom. Tente aplicar mais tarde.")
16
- ).toBeInTheDocument();
17
- });
18
- });
@@ -1,41 +0,0 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { render as n, fireEvent as i } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
- import { Breadcrumb as l } from "../components/Breadcrumb.js";
5
- const c = "Test Title", e = jest.fn();
6
- describe("Breadcrumb component tests", () => {
7
- it("should render correctly", () => {
8
- const { getByTestId: t, getByText: u } = n(
9
- /* @__PURE__ */ o(
10
- l,
11
- {
12
- title: c,
13
- cancelButtonAction: e
14
- }
15
- )
16
- );
17
- expect(t("back-to-coupons-button")).toBeInTheDocument(), expect(u(c)).toBeInTheDocument(), expect(t("back-button")).toBeInTheDocument();
18
- }), it("should call cancelButtonAction when the button is clicked", () => {
19
- const { getByTestId: t } = n(
20
- /* @__PURE__ */ o(
21
- l,
22
- {
23
- title: c,
24
- cancelButtonAction: e
25
- }
26
- )
27
- );
28
- i.click(t("back-to-coupons-button")), expect(e).toHaveBeenCalled();
29
- }), it("should call cancelButtonAction when the back button is clicked", () => {
30
- const { getByTestId: t } = n(
31
- /* @__PURE__ */ o(
32
- l,
33
- {
34
- title: c,
35
- cancelButtonAction: e
36
- }
37
- )
38
- );
39
- i.click(t("back-button")), expect(e).toHaveBeenCalled();
40
- });
41
- });
@@ -1,32 +0,0 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { render as o, fireEvent as l } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
- import { ModalFooter as n } from "../components/ModalFooter.js";
5
- const a = jest.fn(), i = "Cancel", r = jest.fn(), s = "Confirm", h = !0, c = {
6
- cancelButtonAction: a,
7
- cancelButtonText: i,
8
- confirmButtonAction: r,
9
- confirmButtonText: s,
10
- isFloating: h
11
- };
12
- describe("ModalFooter component tests", () => {
13
- it("should render the cancel button with the correct text", () => {
14
- const { getByText: t } = o(/* @__PURE__ */ e(n, { ...c }));
15
- expect(t(i)).toBeInTheDocument();
16
- }), it("should call the cancel button action when clicked", () => {
17
- const { getByText: t } = o(/* @__PURE__ */ e(n, { ...c }));
18
- l.click(t(i)), expect(a).toHaveBeenCalled();
19
- }), it("should render the confirm button with the correct text", () => {
20
- const { getByText: t } = o(/* @__PURE__ */ e(n, { ...c }));
21
- expect(t(s)).toBeInTheDocument();
22
- }), it("should call the confirm button action when clicked", () => {
23
- const { getByText: t } = o(/* @__PURE__ */ e(n, { ...c }));
24
- l.click(t(s)), expect(r).toHaveBeenCalled();
25
- }), it('should add the "floating" class to the container when isFloating is true', () => {
26
- const { container: t } = o(/* @__PURE__ */ e(n, { ...c }));
27
- expect(t.firstChild).toHaveClass("floating");
28
- }), it('should not add the "floating" class to the container when isFloating is false', () => {
29
- const { container: t } = o(/* @__PURE__ */ e(n, { ...c, isFloating: !1 }));
30
- expect(t.firstChild).not.toHaveClass("floating");
31
- });
32
- });
@@ -1,23 +0,0 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { render as o, fireEvent as l } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
- import { ModalHeader as c } from "../components/ModalHeader.js";
5
- const s = jest.fn(), d = "Test Modal", i = jest.fn(), n = {
6
- closeModal: s,
7
- title: d,
8
- genericTaggingEvent: i
9
- };
10
- describe("ModalHeader component tests", () => {
11
- it("should render the modal header with the correct title", () => {
12
- const { getByText: e } = o(/* @__PURE__ */ t(c, { ...n }));
13
- expect(e("Test Modal")).toBeInTheDocument();
14
- }), it("should call the closeModal function when the close button is clicked", () => {
15
- const { getByTestId: e } = o(/* @__PURE__ */ t(c, { ...n }));
16
- l.click(e("close-button")), expect(s).toHaveBeenCalled();
17
- }), it("should call the genericTaggingEvent function when the close button is clicked", () => {
18
- const { getByTestId: e } = o(/* @__PURE__ */ t(c, { ...n }));
19
- l.click(e("close-button")), expect(i).toHaveBeenCalledWith("discount_coupon", {
20
- name: "Modal fechado no X"
21
- });
22
- });
23
- });
@@ -1,17 +0,0 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { render as t } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
- import { NoCoupons as n } from "../components/NoCoupons.js";
5
- describe("NoCoupons component tests", () => {
6
- it("renders the correct text", () => {
7
- const { getByText: o } = t(/* @__PURE__ */ e(n, {}));
8
- expect(
9
- o("Não há cupons disponíveis no momento")
10
- ).toBeInTheDocument(), expect(
11
- o("Aqui você verá todos os cupons disponíveis para aplicar")
12
- ).toBeInTheDocument();
13
- }), it("renders the NoCouponsIcon component", () => {
14
- const { getByTestId: o } = t(/* @__PURE__ */ e(n, {}));
15
- expect(o("no-coupons-icon")).toBeInTheDocument();
16
- });
17
- });
@@ -1,68 +0,0 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { render as n, fireEvent as c } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
- import { TooltipFooter as r } from "../components/TooltipFooter.js";
5
- describe("TooltipFooter", () => {
6
- const t = jest.fn(), s = jest.fn(), o = jest.fn();
7
- it("should render the previous close button when it is the first step", () => {
8
- const { getByText: e } = n(
9
- /* @__PURE__ */ i(
10
- r,
11
- {
12
- stepNumber: 1,
13
- isFirstStep: !0,
14
- isLastStep: !1,
15
- onClose: t,
16
- onPrevious: s,
17
- onNext: o
18
- }
19
- )
20
- );
21
- expect(e("Fechar Explicação")).toBeInTheDocument();
22
- }), it("should call onClose with specific text when previous close button is clicked", () => {
23
- const { getByText: e } = n(
24
- /* @__PURE__ */ i(
25
- r,
26
- {
27
- stepNumber: 1,
28
- isFirstStep: !0,
29
- isLastStep: !1,
30
- onClose: t,
31
- onPrevious: s,
32
- onNext: o
33
- }
34
- )
35
- );
36
- c.click(e("Fechar Explicação")), expect(t).toHaveBeenCalledWith("Fechar Explicação");
37
- }), it("should render the next button when it is not the last step", () => {
38
- const { getByText: e } = n(
39
- /* @__PURE__ */ i(
40
- r,
41
- {
42
- stepNumber: 2,
43
- isFirstStep: !1,
44
- isLastStep: !1,
45
- onClose: t,
46
- onPrevious: s,
47
- onNext: o
48
- }
49
- )
50
- );
51
- expect(e("Próximo >")).toBeInTheDocument();
52
- }), it("should call onNext when next button is clicked", () => {
53
- const { getByText: e } = n(
54
- /* @__PURE__ */ i(
55
- r,
56
- {
57
- stepNumber: 2,
58
- isFirstStep: !1,
59
- isLastStep: !1,
60
- onClose: t,
61
- onPrevious: s,
62
- onNext: o
63
- }
64
- )
65
- );
66
- c.click(e("Próximo >")), expect(o).toHaveBeenCalled();
67
- });
68
- });
@@ -1,18 +0,0 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { render as r, fireEvent as l } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
- import { TooltipHeader as s } from "../components/TooltipHeader.js";
5
- describe("TooltipHeader", () => {
6
- const e = jest.fn();
7
- it("should render the step number and total steps correctly", () => {
8
- const { getByText: t } = r(
9
- /* @__PURE__ */ o(s, { stepNumber: 2, totalSteps: 5, onClose: e })
10
- );
11
- expect(t("2 de 5")).toBeInTheDocument();
12
- }), it("should call onClose when close button is clicked", () => {
13
- const { getByRole: t } = r(
14
- /* @__PURE__ */ o(s, { stepNumber: 2, totalSteps: 5, onClose: e })
15
- );
16
- l.click(t("button")), expect(e).toHaveBeenCalledWith("Botão Fechar");
17
- });
18
- });
@@ -1,45 +0,0 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import l from "react";
3
- import { render as i, fireEvent as a } from "@testing-library/react";
4
- import "@testing-library/jest-dom";
5
- import { Tour as s } from "../Tour.js";
6
- jest.mock("../components/TourTooltip", () => ({ TourTooltip: l.forwardRef(
7
- (e, o) => /* @__PURE__ */ r("div", { ref: o, "data-testid": "tour-tooltip" })
8
- ) }));
9
- jest.mock("../components/TourOverlay", () => ({
10
- TourOverlay: ({ onClick: t }) => /* @__PURE__ */ r("div", { onClick: t, "data-testid": "tour-overlay" })
11
- }));
12
- describe("Tour", () => {
13
- const t = [
14
- { selector: ".step-1", content: "Step 1 Content" },
15
- { selector: ".step-2", content: "Step 2 Content" },
16
- { selector: ".step-3", content: "Step 3 Content" }
17
- ], e = jest.fn(), o = jest.fn(), c = jest.fn();
18
- it("should render correctly with initial step", () => {
19
- const { getByTestId: n } = i(
20
- /* @__PURE__ */ r(
21
- s,
22
- {
23
- steps: t,
24
- handleCloseAction: e,
25
- handleFinishAction: o,
26
- genericTaggingEvent: c
27
- }
28
- )
29
- );
30
- expect(n("tour-tooltip")).toBeInTheDocument(), expect(n("tour-overlay")).toBeInTheDocument();
31
- }), it("should call handleCloseAction when TourOverlay is clicked", () => {
32
- const { getByTestId: n } = i(
33
- /* @__PURE__ */ r(
34
- s,
35
- {
36
- steps: t,
37
- handleCloseAction: e,
38
- handleFinishAction: o,
39
- genericTaggingEvent: c
40
- }
41
- )
42
- );
43
- a.click(n("tour-overlay")), expect(e).toHaveBeenCalled();
44
- });
45
- });
@@ -1,18 +0,0 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { render as r, fireEvent as c } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
- import { TourOverlay as l } from "../components/TourOverlay.js";
5
- describe("TourOverlay", () => {
6
- const e = jest.fn();
7
- it("should render the tour overlay", () => {
8
- const { getByTestId: o } = r(
9
- /* @__PURE__ */ t(l, { stepNumber: 1, onClick: e })
10
- );
11
- expect(o("tour-overlay")).toBeInTheDocument();
12
- }), it("should call onClick when the overlay is clicked", () => {
13
- const { getByTestId: o } = r(
14
- /* @__PURE__ */ t(l, { stepNumber: 1, onClick: e })
15
- );
16
- c.click(o("tour-overlay")), expect(e).toHaveBeenCalledWith("Clique no overlay");
17
- });
18
- });
@@ -1,40 +0,0 @@
1
- import { jsx as p } from "react/jsx-runtime";
2
- import { render as r } from "@testing-library/react";
3
- import "@testing-library/jest-dom";
4
- import { TourTooltip as c } from "../components/TourTooltip.js";
5
- describe("TourTooltip", () => {
6
- const t = jest.fn(), e = jest.fn(), n = jest.fn(), s = { content: "Step Content" };
7
- it("should render correctly with provided props", () => {
8
- const { getByText: o } = r(
9
- /* @__PURE__ */ p(
10
- c,
11
- {
12
- step: s,
13
- position: { top: 100 },
14
- onClose: t,
15
- onPrevious: e,
16
- onNext: n,
17
- totalSteps: 3,
18
- stepNumber: 2
19
- }
20
- )
21
- );
22
- expect(o("Step Content")).toBeInTheDocument(), expect(o("2 de 3")).toBeInTheDocument();
23
- }), it("should have correct style for position", () => {
24
- const { getByTestId: o } = r(
25
- /* @__PURE__ */ p(
26
- c,
27
- {
28
- step: s,
29
- position: { top: 100 },
30
- onClose: t,
31
- onPrevious: e,
32
- onNext: n,
33
- totalSteps: 3,
34
- stepNumber: 2
35
- }
36
- )
37
- ), i = o("tour-tooltip");
38
- expect(i.style.top).toBe("100px");
39
- });
40
- });