@plurix/ecom-components 0.0.2-beta.9 → 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.
- package/README.md +76 -48
- package/dist/assets/svgs/ArrowIcon.d.ts +1 -1
- package/dist/assets/svgs/ArrowIcon.js +3 -2
- package/dist/assets/svgs/ErrorIcon.d.ts +1 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.js +4 -2
- package/dist/packages/Modal/Modal.d.ts +14 -0
- package/dist/packages/Modal/Modal.js +53 -0
- package/dist/packages/Onboarding/constants/tips.js +9 -9
- package/dist/packages/Onboarding/tips/Tip2.js +225 -236
- package/dist/packages/Onboarding/tips/Tip3.js +236 -225
- package/dist/packages/Regionalization/utils/localStorage.js +1 -1
- package/dist/styles/modal.global.css +1 -0
- package/package.json +72 -58
- package/dist/packages/Carousel/test/Carrousel.test.js +0 -80
- package/dist/packages/Coupons/test/Alert.test.js +0 -18
- package/dist/packages/Coupons/test/Breadcrumb.test.js +0 -41
- package/dist/packages/Coupons/test/ModalFooter.test.js +0 -32
- package/dist/packages/Coupons/test/ModalHeader.test.js +0 -23
- package/dist/packages/Coupons/test/NoCoupons.test.js +0 -17
- package/dist/packages/Onboarding/test/Bullets.test.js +0 -20
- package/dist/packages/Onboarding/test/Content.test.js +0 -52
- package/dist/packages/Onboarding/test/Footer.test.js +0 -60
- package/dist/packages/Onboarding/test/Header.test.js +0 -30
- package/dist/packages/Onboarding/test/Onboarding.test.js +0 -22
- package/dist/packages/Onboarding/test/SocialMedia.test.js +0 -39
- package/dist/packages/Tour/test/TooltipFooter.test.js +0 -68
- package/dist/packages/Tour/test/TooltipHeader.test.js +0 -18
- package/dist/packages/Tour/test/Tour.test.js +0 -45
- package/dist/packages/Tour/test/TourOverlay.test.js +0 -18
- package/dist/packages/Tour/test/TourTooltip.test.js +0 -40
- /package/dist/{packages/Regionalization/utils/constants.d.ts → constants/index.d.ts} +0 -0
- /package/dist/{packages/Regionalization/utils/constants.js → constants/index.js} +0 -0
|
@@ -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
|
|
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
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"react": "^
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
"
|
|
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,20 +0,0 @@
|
|
|
1
|
-
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { render as s } from "@testing-library/react";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import { Bullets as o } from "../components/Bullets.js";
|
|
5
|
-
jest.mock("../constants/tips", () => ({ TIPS_LENGTH: 3 }));
|
|
6
|
-
describe("Bullets component tests", () => {
|
|
7
|
-
it("renders correctly amount of bullets", () => {
|
|
8
|
-
const { container: t } = s(/* @__PURE__ */ l(o, { step: 1 })), e = t.querySelectorAll(".bullet");
|
|
9
|
-
expect(e.length).toBe(3);
|
|
10
|
-
}), it("should first bullet active if step is 1", () => {
|
|
11
|
-
const { container: t } = s(/* @__PURE__ */ l(o, { step: 1 })), e = t.querySelector(".bullet");
|
|
12
|
-
expect(e).toHaveClass("active");
|
|
13
|
-
}), it("should middle bullet active if step is greater than 1 and less than TIPS_LENGTH", () => {
|
|
14
|
-
const { container: t } = s(/* @__PURE__ */ l(o, { step: 2 })), e = t.querySelector(".bullet:nth-child(2)");
|
|
15
|
-
expect(e).toHaveClass("active");
|
|
16
|
-
}), it("should last bullet active if step is equal than TIPS_LENGTH", () => {
|
|
17
|
-
const { container: t } = s(/* @__PURE__ */ l(o, { step: 3 })), e = t.querySelector(".bullet:last-child");
|
|
18
|
-
expect(e).toHaveClass("active");
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { render as s } from "@testing-library/react";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import { Content as o } from "../components/Content.js";
|
|
5
|
-
jest.mock("../components/SocialMedia", () => ({
|
|
6
|
-
SocialMedia: () => /* @__PURE__ */ e("div", { "data-testid": "social media" })
|
|
7
|
-
}));
|
|
8
|
-
jest.mock("../constants/tips", () => ({
|
|
9
|
-
TIPS_LENGTH: 2,
|
|
10
|
-
TIPS: [
|
|
11
|
-
{
|
|
12
|
-
tip: "tip 1",
|
|
13
|
-
svg: () => /* @__PURE__ */ e("div", { "data-testid": "svg 1" }),
|
|
14
|
-
isIllustration: !1
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
tip: "tip 2",
|
|
18
|
-
svg: () => /* @__PURE__ */ e("div", { "data-testid": "svg 2" }),
|
|
19
|
-
isIllustration: !0
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}));
|
|
23
|
-
const n = jest.fn();
|
|
24
|
-
describe("Content component tests", () => {
|
|
25
|
-
it("should render nothing if step is invalid", () => {
|
|
26
|
-
const { container: t } = s(/* @__PURE__ */ e(o, { step: 0, sendEvent: n }));
|
|
27
|
-
expect(t.firstChild).toBeNull();
|
|
28
|
-
}), it("should render correctly texts", () => {
|
|
29
|
-
const { getByTestId: t, getByText: i } = s(
|
|
30
|
-
/* @__PURE__ */ e(o, { step: 1, sendEvent: n })
|
|
31
|
-
);
|
|
32
|
-
expect(t("svg 1")).toBeInTheDocument(), expect(i("1 de 2")).toBeInTheDocument(), expect(i("tip 1")).toBeInTheDocument();
|
|
33
|
-
}), it("should render correctly illustration message", () => {
|
|
34
|
-
const { getByText: t } = s(/* @__PURE__ */ e(o, { step: 2, sendEvent: n }));
|
|
35
|
-
expect(t("Imagem Ilustrativa")).toBeInTheDocument();
|
|
36
|
-
}), it("should render correctly social media section", () => {
|
|
37
|
-
const { getByTestId: t } = s(
|
|
38
|
-
/* @__PURE__ */ e(
|
|
39
|
-
o,
|
|
40
|
-
{
|
|
41
|
-
step: 2,
|
|
42
|
-
socialMediaLinks: {
|
|
43
|
-
facebook: "facebook_link",
|
|
44
|
-
instagram: "instagram_link"
|
|
45
|
-
},
|
|
46
|
-
sendEvent: n
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
expect(t("social media")).toBeInTheDocument();
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { render as c, fireEvent as a } from "@testing-library/react";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import { Footer as l } from "../components/Footer.js";
|
|
5
|
-
jest.mock("../constants/tips", () => ({ TIPS_LENGTH: 3 }));
|
|
6
|
-
jest.mock("../components/Bullets", () => ({
|
|
7
|
-
Bullets: () => /* @__PURE__ */ n("div", { "data-testid": "bullets" })
|
|
8
|
-
}));
|
|
9
|
-
const t = jest.fn(), o = jest.fn();
|
|
10
|
-
describe("Footer component tests", () => {
|
|
11
|
-
it("renders default UI", () => {
|
|
12
|
-
const { getByText: e } = c(
|
|
13
|
-
/* @__PURE__ */ n(
|
|
14
|
-
l,
|
|
15
|
-
{
|
|
16
|
-
step: 1,
|
|
17
|
-
handleBackStep: t,
|
|
18
|
-
handleNextStep: o
|
|
19
|
-
}
|
|
20
|
-
)
|
|
21
|
-
);
|
|
22
|
-
expect(e("Voltar")).toBeInTheDocument(), expect(e("Próximo")).toBeInTheDocument();
|
|
23
|
-
}), it("renders correctly button text if step is equal than TIPS_LENGTH", () => {
|
|
24
|
-
const { queryByText: e, getByText: s } = c(
|
|
25
|
-
/* @__PURE__ */ n(
|
|
26
|
-
l,
|
|
27
|
-
{
|
|
28
|
-
step: 3,
|
|
29
|
-
handleBackStep: t,
|
|
30
|
-
handleNextStep: o
|
|
31
|
-
}
|
|
32
|
-
)
|
|
33
|
-
);
|
|
34
|
-
expect(e("Próximo")).not.toBeInTheDocument(), expect(s("Legal, Entendi")).toBeInTheDocument();
|
|
35
|
-
}), it("should call handleBackStep on click back button", () => {
|
|
36
|
-
const { getByText: e } = c(
|
|
37
|
-
/* @__PURE__ */ n(
|
|
38
|
-
l,
|
|
39
|
-
{
|
|
40
|
-
step: 1,
|
|
41
|
-
handleBackStep: t,
|
|
42
|
-
handleNextStep: o
|
|
43
|
-
}
|
|
44
|
-
)
|
|
45
|
-
);
|
|
46
|
-
a.click(e("Voltar")), expect(t).toHaveBeenCalled();
|
|
47
|
-
}), it("should call handleNextStep on click confirm button", () => {
|
|
48
|
-
const { getByText: e } = c(
|
|
49
|
-
/* @__PURE__ */ n(
|
|
50
|
-
l,
|
|
51
|
-
{
|
|
52
|
-
step: 1,
|
|
53
|
-
handleBackStep: t,
|
|
54
|
-
handleNextStep: o
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
);
|
|
58
|
-
a.click(e("Próximo")), expect(o).toHaveBeenCalled();
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { render as c, fireEvent as d } from "@testing-library/react";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import { Header as s } from "../components/Header.js";
|
|
5
|
-
const t = jest.fn(), n = jest.fn();
|
|
6
|
-
describe("Header component tests", () => {
|
|
7
|
-
it("renders correctly UI", () => {
|
|
8
|
-
const { getByText: e, getByTestId: l } = c(
|
|
9
|
-
/* @__PURE__ */ o(
|
|
10
|
-
s,
|
|
11
|
-
{
|
|
12
|
-
sendEvent: t,
|
|
13
|
-
handleCloseAction: n
|
|
14
|
-
}
|
|
15
|
-
)
|
|
16
|
-
);
|
|
17
|
-
expect(e("Experiência Personalizada")).toBeInTheDocument(), expect(l("close-icon")).toBeInTheDocument();
|
|
18
|
-
}), it("should call sendEvent and handleCloseAction on click close button", () => {
|
|
19
|
-
const { getByTestId: e } = c(
|
|
20
|
-
/* @__PURE__ */ o(
|
|
21
|
-
s,
|
|
22
|
-
{
|
|
23
|
-
sendEvent: t,
|
|
24
|
-
handleCloseAction: n
|
|
25
|
-
}
|
|
26
|
-
)
|
|
27
|
-
);
|
|
28
|
-
d.click(e("close-icon")), expect(t).toHaveBeenCalled(), expect(n).toHaveBeenCalled();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { render as o } from "@testing-library/react";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import { Onboarding as n } from "../Onboarding.js";
|
|
5
|
-
jest.mock("../components/Header", () => ({
|
|
6
|
-
Header: () => /* @__PURE__ */ e("div", { "data-testid": "header" })
|
|
7
|
-
}));
|
|
8
|
-
jest.mock("../components/Content", () => ({
|
|
9
|
-
Content: () => /* @__PURE__ */ e("div", { "data-testid": "content" })
|
|
10
|
-
}));
|
|
11
|
-
jest.mock("../components/Footer", () => ({
|
|
12
|
-
Footer: () => /* @__PURE__ */ e("div", { "data-testid": "footer" })
|
|
13
|
-
}));
|
|
14
|
-
const c = jest.fn();
|
|
15
|
-
describe("Onboarding package tests", () => {
|
|
16
|
-
it("should render sections correctly", () => {
|
|
17
|
-
const { getByTestId: t } = o(
|
|
18
|
-
/* @__PURE__ */ e(n, { handleCloseAction: c })
|
|
19
|
-
);
|
|
20
|
-
expect(t("header")).toBeInTheDocument(), expect(t("content")).toBeInTheDocument(), expect(t("footer")).toBeInTheDocument();
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,39 +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 { SocialMedia as t } from "../components/SocialMedia.js";
|
|
5
|
-
const o = jest.fn();
|
|
6
|
-
describe("SocialMedia component tests", () => {
|
|
7
|
-
it("should render nothing if socialMediaLinks does not exist", () => {
|
|
8
|
-
const { container: e } = n(/* @__PURE__ */ i(t, { sendEvent: o }));
|
|
9
|
-
expect(e.firstChild).toBeNull();
|
|
10
|
-
}), it("should render media section if link exist", () => {
|
|
11
|
-
const { getByTestId: e } = n(
|
|
12
|
-
/* @__PURE__ */ i(
|
|
13
|
-
t,
|
|
14
|
-
{
|
|
15
|
-
socialMediaLinks: {
|
|
16
|
-
facebook: "facebook_link",
|
|
17
|
-
instagram: "instagram_link"
|
|
18
|
-
},
|
|
19
|
-
sendEvent: o
|
|
20
|
-
}
|
|
21
|
-
)
|
|
22
|
-
);
|
|
23
|
-
expect(e("facebook-icon")).toBeInTheDocument(), expect(e("instagram-icon")).toBeInTheDocument();
|
|
24
|
-
}), it("should call sendEvent on click social media link", () => {
|
|
25
|
-
const { getByTestId: e } = n(
|
|
26
|
-
/* @__PURE__ */ i(
|
|
27
|
-
t,
|
|
28
|
-
{
|
|
29
|
-
socialMediaLinks: {
|
|
30
|
-
facebook: "facebook_link",
|
|
31
|
-
instagram: "instagram_link"
|
|
32
|
-
},
|
|
33
|
-
sendEvent: o
|
|
34
|
-
}
|
|
35
|
-
)
|
|
36
|
-
);
|
|
37
|
-
c.click(e("facebook-icon")), expect(o).toHaveBeenCalledWith("facebook");
|
|
38
|
-
});
|
|
39
|
-
});
|