@orangesk/orange-design-system 3.8.0 → 3.9.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 +0 -6
- package/build/components/Footer/style.css +1 -1
- package/build/components/Footer/style.css.map +1 -1
- package/build/components/Megamenu/style.css +1 -1
- package/build/components/Megamenu/style.css.map +1 -1
- package/build/components/index.js +1 -1
- package/build/components/index.js.map +1 -1
- package/build/lib/base.css.map +1 -1
- package/build/lib/footer.css +1 -1
- package/build/lib/footer.css.map +1 -1
- package/build/lib/megamenu.css +1 -1
- package/build/lib/megamenu.css.map +1 -1
- package/build/lib/reset.css +2 -0
- package/build/lib/reset.css.map +1 -0
- package/build/lib/reset.js +3 -0
- package/build/lib/scripts.js +1 -1
- package/build/lib/scripts.js.map +1 -1
- package/build/lib/style.css.map +1 -1
- package/package.json +14 -20
- package/src/components/Footer/Footer.tsx +1 -4
- package/src/components/Footer/styles/mixins.scss +3 -1
- package/src/components/Footer/styles/style.scss +31 -0
- package/src/components/Footer/tests/Footer.styles.unit.test.jsx +62 -0
- package/src/components/Megamenu/styles/mixins.scss +9 -4
- package/src/components/Alert/tests/Alert.visual.test.jsx +0 -137
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-custom-title-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-danger-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-full-width-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-success-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-title-buttons-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-title-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-title-description-buttons-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-title-description-chromium-linux.png +0 -0
- package/src/components/Alert/tests/__screenshots__/Alert.visual.test.jsx/alert-preview-warning-chromium-linux.png +0 -0
- package/src/components/CarouselHero/tests/CarouselHero.visual.test.jsx +0 -90
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orangesk/orange-design-system",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.x"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@cloudfour/transition-hidden-element": "^2.0.2",
|
|
28
28
|
"@mdx-js/loader": "^3.1.1",
|
|
29
29
|
"@mdx-js/react": "^3.1.1",
|
|
30
|
-
"@next/mdx": "16.3.
|
|
30
|
+
"@next/mdx": "16.3.8",
|
|
31
31
|
"@orangesk/accessible-autocomplete": "3.2.2",
|
|
32
32
|
"@popperjs/core": "^2.11.8",
|
|
33
33
|
"@types/mdx": "^2.0.14",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"html-react-parser": "6.1.8",
|
|
40
40
|
"lorem-ipsum": "3.0.0",
|
|
41
41
|
"minisearch": "7.2.0",
|
|
42
|
-
"next": "16.3.
|
|
42
|
+
"next": "16.3.8",
|
|
43
43
|
"normalize.css": "^8.0.1",
|
|
44
44
|
"nouislider": "^15.8.1",
|
|
45
45
|
"prism-react-renderer": "^2.4.1",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"rehype-slug": "^6.0.0",
|
|
53
53
|
"remark-gemoji": "^8.0.0",
|
|
54
54
|
"remark-gfm": "^4.0.1",
|
|
55
|
-
"swiper": "14.
|
|
55
|
+
"swiper": "14.3.0",
|
|
56
56
|
"tabbable": "^6.5.0",
|
|
57
57
|
"unescape-html": "^1.1.0",
|
|
58
58
|
"wnumb": "^1.2.0"
|
|
@@ -71,40 +71,36 @@
|
|
|
71
71
|
"@rollup/plugin-terser": "1.0.0",
|
|
72
72
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
73
73
|
"@rollup/plugin-url": "^8.0.2",
|
|
74
|
-
"@rollup/rollup-darwin-arm64": "^4.63.
|
|
74
|
+
"@rollup/rollup-darwin-arm64": "^4.63.6",
|
|
75
75
|
"@testing-library/dom": "^10.4.2",
|
|
76
76
|
"@testing-library/jest-dom": "7.0.1",
|
|
77
77
|
"@testing-library/react": "^16.3.3",
|
|
78
78
|
"@testing-library/user-event": "^14.6.7",
|
|
79
|
-
"@types/node": "26.6.
|
|
79
|
+
"@types/node": "26.6.3",
|
|
80
80
|
"@types/react": "19.3.0",
|
|
81
81
|
"@types/react-dom": "19.3.0",
|
|
82
82
|
"@types/wnumb": "^1.2.3",
|
|
83
83
|
"@vitejs/plugin-react": "6.1.1",
|
|
84
|
-
"@vitest/
|
|
85
|
-
"@vitest/
|
|
86
|
-
"@vitest/coverage-v8": "5.0.1",
|
|
87
|
-
"@vitest/ui": "5.0.1",
|
|
84
|
+
"@vitest/coverage-v8": "5.0.3",
|
|
85
|
+
"@vitest/ui": "5.0.3",
|
|
88
86
|
"canvas": "^3.2.3",
|
|
89
87
|
"fs-extra": "^11.4.1",
|
|
90
88
|
"glob": "13.0.6",
|
|
91
|
-
"html-validate": "11.16.
|
|
89
|
+
"html-validate": "11.16.1",
|
|
92
90
|
"husky": "^9.1.7",
|
|
93
91
|
"identity-obj-proxy": "^3.0.0",
|
|
94
92
|
"jsdom": "30.1.1",
|
|
95
|
-
"lint-staged": "17.
|
|
96
|
-
"playwright": "^1.63.0",
|
|
93
|
+
"lint-staged": "17.6.0",
|
|
97
94
|
"prettier": "^3.9.9",
|
|
98
|
-
"rollup": "^4.63.
|
|
95
|
+
"rollup": "^4.63.6",
|
|
99
96
|
"rollup-plugin-copy": "^3.5.0",
|
|
100
97
|
"rollup-plugin-dts": "^6.5.1",
|
|
101
98
|
"rollup-plugin-postcss": "^4.0.2",
|
|
102
|
-
"sass": "^1.105.
|
|
99
|
+
"sass": "^1.105.1",
|
|
103
100
|
"svg-sprite": "^2.0.4",
|
|
104
101
|
"typescript": "6.0.3",
|
|
105
|
-
"vitest": "5.0.
|
|
106
|
-
"vitest-axe": "^0.1.0"
|
|
107
|
-
"vitest-browser-react": "^2.3.0"
|
|
102
|
+
"vitest": "5.0.3",
|
|
103
|
+
"vitest-axe": "^0.1.0"
|
|
108
104
|
},
|
|
109
105
|
"lint-staged": {
|
|
110
106
|
"*.{js,jsx,ts,tsx,json,css}": "biome check --write --no-errors-on-unmatched",
|
|
@@ -133,8 +129,6 @@
|
|
|
133
129
|
"format:biome": "biome format --write .",
|
|
134
130
|
"format:prettier": "prettier --write '**/*.{mdx,scss}'",
|
|
135
131
|
"test": "vitest",
|
|
136
|
-
"test:visual:docker": "docker run --rm --init --ipc=host -e CI=1 -v \"$PWD\":/work -w /work mcr.microsoft.com/playwright:v1.58.2-noble bash -lc \"corepack enable && pnpm install --frozen-lockfile --ignore-scripts && pnpm run test:visual\"",
|
|
137
|
-
"test:visual:docker:update": "docker run --rm --init --ipc=host -e CI=1 -v \"$PWD\":/work -w /work mcr.microsoft.com/playwright:v1.58.2-noble bash -lc \"corepack enable && pnpm install --frozen-lockfile --ignore-scripts && pnpm run test:visual:update\"",
|
|
138
132
|
"test:ui": "vitest --ui",
|
|
139
133
|
"coverage": "vitest run --coverage",
|
|
140
134
|
"sprite": "svg-sprite --symbol --symbol-dest public --symbol-sprite sprite.svg src/assets/icons/*.svg"
|
|
@@ -140,10 +140,7 @@ const Footer: React.FC<FooterProps> = ({ className, data = footerData }) => {
|
|
|
140
140
|
id={`${accordionIdPrefix}-footer-section-panel-${index}`}
|
|
141
141
|
>
|
|
142
142
|
{column.links.map((link, linkIndex) => (
|
|
143
|
-
<li
|
|
144
|
-
className="mb-small"
|
|
145
|
-
key={`footer-link-${index}-${linkIndex}`}
|
|
146
|
-
>
|
|
143
|
+
<li key={`footer-link-${index}-${linkIndex}`}>
|
|
147
144
|
<a href={link.url}>{link.label}</a>
|
|
148
145
|
</li>
|
|
149
146
|
))}
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
@use "../../../styles/tools/convert";
|
|
4
4
|
@use "../../../styles/tokens/breakpoint";
|
|
5
5
|
@use "../../Megamenu/styles/mixins" as megamenuMixins;
|
|
6
|
+
@use "../../SocialButton/styles/config" as socialButtonConfig;
|
|
7
|
+
@use "../../SocialButton/styles/mixins" as socialButtonMixins;
|
|
8
|
+
@use "../../Icon/styles/mixins" as iconMixins;
|
|
6
9
|
|
|
7
10
|
#{config.$class-root} {
|
|
8
11
|
@include mixins.globals;
|
|
@@ -112,4 +115,32 @@
|
|
|
112
115
|
margin-bottom: convert.to-rem(30px);
|
|
113
116
|
}
|
|
114
117
|
}
|
|
118
|
+
|
|
119
|
+
// Keep shared component styles local so the standalone bundle works on legacy pages.
|
|
120
|
+
.social-button {
|
|
121
|
+
@include socialButtonMixins.base;
|
|
122
|
+
@include socialButtonMixins.size;
|
|
123
|
+
|
|
124
|
+
&:hover,
|
|
125
|
+
&:focus,
|
|
126
|
+
&:active {
|
|
127
|
+
text-decoration: none;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@each $name, $props in socialButtonConfig.$social-colors {
|
|
132
|
+
.social-button--#{$name} {
|
|
133
|
+
@include socialButtonMixins.color($name);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.icon {
|
|
138
|
+
@include iconMixins.base;
|
|
139
|
+
@include iconMixins.sizes;
|
|
140
|
+
@include iconMixins.colors;
|
|
141
|
+
|
|
142
|
+
use {
|
|
143
|
+
pointer-events: none;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
115
146
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as sass from "sass";
|
|
2
|
+
|
|
3
|
+
describe("Footer standalone styles", () => {
|
|
4
|
+
let stylesheet;
|
|
5
|
+
let rules;
|
|
6
|
+
|
|
7
|
+
beforeAll(() => {
|
|
8
|
+
stylesheet = document.createElement("style");
|
|
9
|
+
stylesheet.textContent = sass.compile(
|
|
10
|
+
"src/components/Footer/styles/style.scss",
|
|
11
|
+
).css;
|
|
12
|
+
document.head.append(stylesheet);
|
|
13
|
+
|
|
14
|
+
const flattenRules = (cssRules) =>
|
|
15
|
+
Array.from(cssRules).flatMap((rule) =>
|
|
16
|
+
rule.selectorText ? [rule] : flattenRules(rule.cssRules || []),
|
|
17
|
+
);
|
|
18
|
+
rules = flattenRules(stylesheet.sheet.cssRules);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
afterAll(() => stylesheet.remove());
|
|
22
|
+
|
|
23
|
+
const styleFor = (selector) =>
|
|
24
|
+
rules.find((rule) => rule.selectorText === selector)?.style;
|
|
25
|
+
|
|
26
|
+
it("sizes social buttons and icons without global ODS styles", () => {
|
|
27
|
+
expect(styleFor(".footer .social-button")?.display).toBe("inline-flex");
|
|
28
|
+
expect(styleFor(".footer .social-button")?.width).toBe("2.5rem");
|
|
29
|
+
expect(styleFor(".footer .icon")?.getPropertyValue("fill")).toBe(
|
|
30
|
+
"currentcolor",
|
|
31
|
+
);
|
|
32
|
+
expect(styleFor(".footer .icon")?.width).toBe("var(--icon-size)");
|
|
33
|
+
expect(styleFor(".footer .icon")?.height).toBe("var(--icon-size)");
|
|
34
|
+
expect(
|
|
35
|
+
styleFor(".footer .icon--medium")?.getPropertyValue("--icon-size"),
|
|
36
|
+
).toBe("1.5rem");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it.each(["facebook-2", "x", "linkedin-2", "youtube", "instagram"])(
|
|
40
|
+
"includes theme and interaction colors for %s",
|
|
41
|
+
(name) => {
|
|
42
|
+
const selector = `.footer .social-button--${name}`;
|
|
43
|
+
expect(styleFor(selector)?.color).toBe("var(--color-text-default)");
|
|
44
|
+
expect(styleFor(`${selector}:hover`)?.color).toBe("rgb(255, 255, 255)");
|
|
45
|
+
expect(styleFor(`${selector}:active, ${selector}.is-active`)?.color).toBe(
|
|
46
|
+
"var(--color-text-inverse)",
|
|
47
|
+
);
|
|
48
|
+
},
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
it("keeps reused component styles inside the footer", () => {
|
|
52
|
+
const componentRules = rules.filter((rule) =>
|
|
53
|
+
/\.(social-button|icon)\b/.test(rule.selectorText),
|
|
54
|
+
);
|
|
55
|
+
expect(componentRules.length).toBeGreaterThan(0);
|
|
56
|
+
for (const rule of componentRules) {
|
|
57
|
+
for (const selector of rule.selectorText.split(",")) {
|
|
58
|
+
expect(selector.trim()).toMatch(/^\.footer /);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -102,11 +102,16 @@
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
* {
|
|
105
|
-
box-sizing: border-box;
|
|
106
105
|
letter-spacing: convert.to-rem(-0.1px);
|
|
107
106
|
line-height: convert.to-rem(18px);
|
|
108
107
|
}
|
|
109
108
|
|
|
109
|
+
*,
|
|
110
|
+
*::before,
|
|
111
|
+
*::after {
|
|
112
|
+
box-sizing: border-box;
|
|
113
|
+
}
|
|
114
|
+
|
|
110
115
|
::selection {
|
|
111
116
|
background-color: base.$selection-background;
|
|
112
117
|
color: base.$text-color;
|
|
@@ -263,7 +268,7 @@
|
|
|
263
268
|
}
|
|
264
269
|
|
|
265
270
|
@mixin nav-item-lead {
|
|
266
|
-
margin-right:
|
|
271
|
+
margin-right: 0;
|
|
267
272
|
}
|
|
268
273
|
|
|
269
274
|
@mixin nav-item-push {
|
|
@@ -418,7 +423,7 @@
|
|
|
418
423
|
}
|
|
419
424
|
|
|
420
425
|
&.is-active {
|
|
421
|
-
color: var(--color-border-accent);
|
|
426
|
+
color: var(--color-border-accent) !important;
|
|
422
427
|
}
|
|
423
428
|
}
|
|
424
429
|
|
|
@@ -637,7 +642,7 @@
|
|
|
637
642
|
min-width: 0;
|
|
638
643
|
}
|
|
639
644
|
|
|
640
|
-
> #{config.$class-root}__nav:last-child {
|
|
645
|
+
> #{config.$class-root}__nav:last-child:not(:first-child) {
|
|
641
646
|
flex: 0 0 auto;
|
|
642
647
|
width: auto;
|
|
643
648
|
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, test } from "vitest";
|
|
2
|
-
import { page } from "vitest/browser";
|
|
3
|
-
import { render } from "vitest-browser-react";
|
|
4
|
-
import { Button } from "../../Button";
|
|
5
|
-
import { Alert } from "../";
|
|
6
|
-
|
|
7
|
-
describe("Alert visual regression", () => {
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
await page.viewport(1280, 720);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test("Preview: title", async () => {
|
|
13
|
-
render(
|
|
14
|
-
<Alert data-testid="alert-title" title="Toto je jednoduchá sprava" />,
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
await expect(page.getByTestId("alert-title")).toMatchScreenshot(
|
|
18
|
-
"alert-preview-title",
|
|
19
|
-
);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
test("Preview: title and description", async () => {
|
|
23
|
-
render(
|
|
24
|
-
<Alert
|
|
25
|
-
data-testid="alert-title-description"
|
|
26
|
-
title="Dobre vediet!"
|
|
27
|
-
description="Popis toho co by bolo dobre vysvetlit. Aj na viac riadkov."
|
|
28
|
-
/>,
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
await expect(page.getByTestId("alert-title-description")).toMatchScreenshot(
|
|
32
|
-
"alert-preview-title-description",
|
|
33
|
-
);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test("Preview: title and buttons", async () => {
|
|
37
|
-
render(
|
|
38
|
-
<Alert
|
|
39
|
-
data-testid="alert-title-buttons"
|
|
40
|
-
title="Prosim prihlaste sa."
|
|
41
|
-
actionButtons={[
|
|
42
|
-
<Button key="login">Prihlasit sa</Button>,
|
|
43
|
-
<Button key="hide">Skryt</Button>,
|
|
44
|
-
]}
|
|
45
|
-
/>,
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
await expect(page.getByTestId("alert-title-buttons")).toMatchScreenshot(
|
|
49
|
-
"alert-preview-title-buttons",
|
|
50
|
-
);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test("Preview: title, description and buttons", async () => {
|
|
54
|
-
render(
|
|
55
|
-
<Alert
|
|
56
|
-
data-testid="alert-title-description-buttons"
|
|
57
|
-
title="Prihlasit sa je jednoduche a rozumne"
|
|
58
|
-
description="Napr. prihlaseni pouzivatelia vidia krajsie ceny."
|
|
59
|
-
actionButtons={<Button>Prihlasit sa</Button>}
|
|
60
|
-
/>,
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
await expect(
|
|
64
|
-
page.getByTestId("alert-title-description-buttons"),
|
|
65
|
-
).toMatchScreenshot("alert-preview-title-description-buttons");
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test("Preview: success type", async () => {
|
|
69
|
-
render(
|
|
70
|
-
<Alert
|
|
71
|
-
data-testid="alert-success"
|
|
72
|
-
type="success"
|
|
73
|
-
title="Vyborne. Vsetko prebehlo rychlo a hladko"
|
|
74
|
-
/>,
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
await expect(page.getByTestId("alert-success")).toMatchScreenshot(
|
|
78
|
-
"alert-preview-success",
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test("Preview: warning type", async () => {
|
|
83
|
-
render(
|
|
84
|
-
<Alert
|
|
85
|
-
data-testid="alert-warning"
|
|
86
|
-
type="warning"
|
|
87
|
-
title="Na toto si daj pozor!"
|
|
88
|
-
/>,
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
await expect(page.getByTestId("alert-warning")).toMatchScreenshot(
|
|
92
|
-
"alert-preview-warning",
|
|
93
|
-
);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test("Preview: danger type", async () => {
|
|
97
|
-
render(
|
|
98
|
-
<Alert data-testid="alert-danger" type="danger" title="Stala sa chyba" />,
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
await expect(page.getByTestId("alert-danger")).toMatchScreenshot(
|
|
102
|
-
"alert-preview-danger",
|
|
103
|
-
);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
test("Preview: custom title renderer", async () => {
|
|
107
|
-
render(
|
|
108
|
-
<Alert
|
|
109
|
-
data-testid="alert-custom-title"
|
|
110
|
-
title="Prihlasit sa je jednoduche a rozumne"
|
|
111
|
-
renderTitle={(props) => (
|
|
112
|
-
<h3 className="alert__title mb-medium">{props.title}</h3>
|
|
113
|
-
)}
|
|
114
|
-
description="Popis toho co by bolo dobre vysvetlit. Aj na viac riadkov."
|
|
115
|
-
/>,
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
await expect(page.getByTestId("alert-custom-title")).toMatchScreenshot(
|
|
119
|
-
"alert-preview-custom-title",
|
|
120
|
-
);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
test("Preview: full width", async () => {
|
|
124
|
-
render(
|
|
125
|
-
<Alert
|
|
126
|
-
data-testid="alert-full-width"
|
|
127
|
-
isFullWidth
|
|
128
|
-
title="Dobre vediet!"
|
|
129
|
-
description="Popis toho co by bolo dobre vysvetlit. Aj na viac riadkov."
|
|
130
|
-
/>,
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
await expect(page.getByTestId("alert-full-width")).toMatchScreenshot(
|
|
134
|
-
"alert-preview-full-width",
|
|
135
|
-
);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, test } from "vitest";
|
|
2
|
-
import { page } from "vitest/browser";
|
|
3
|
-
import { render } from "vitest-browser-react";
|
|
4
|
-
|
|
5
|
-
import { CarouselHero, CarouselHeroItem } from "../";
|
|
6
|
-
|
|
7
|
-
const slides = (
|
|
8
|
-
<>
|
|
9
|
-
<CarouselHeroItem image="https://placehold.co/720x560?text=Slide+1">
|
|
10
|
-
<h2>Slide 1</h2>
|
|
11
|
-
<p>First slide content</p>
|
|
12
|
-
</CarouselHeroItem>
|
|
13
|
-
<CarouselHeroItem image="https://placehold.co/720x560?text=Slide+2">
|
|
14
|
-
<h2>Slide 2</h2>
|
|
15
|
-
<p>Second slide content</p>
|
|
16
|
-
</CarouselHeroItem>
|
|
17
|
-
<CarouselHeroItem image="https://placehold.co/720x560?text=Slide+3">
|
|
18
|
-
<h2>Slide 3</h2>
|
|
19
|
-
<p>Third slide content</p>
|
|
20
|
-
</CarouselHeroItem>
|
|
21
|
-
<CarouselHeroItem image="https://placehold.co/720x560?text=Slide+4">
|
|
22
|
-
<h2>Slide 4</h2>
|
|
23
|
-
<p>Fourth slide content</p>
|
|
24
|
-
</CarouselHeroItem>
|
|
25
|
-
<CarouselHeroItem image="https://placehold.co/720x560?text=Slide+5">
|
|
26
|
-
<h2>Slide 5</h2>
|
|
27
|
-
<p>Fifth slide content</p>
|
|
28
|
-
</CarouselHeroItem>
|
|
29
|
-
</>
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const tabs = [
|
|
33
|
-
{ label: "Motorola Edge 50 Fusion" },
|
|
34
|
-
{ label: "3 mesiace zadarmo" },
|
|
35
|
-
{ label: "Nekonečné dáta" },
|
|
36
|
-
{ label: "iPhone16 Pro" },
|
|
37
|
-
{ label: "HONOR 200" },
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
async function getCarouselState() {
|
|
41
|
-
return page.evaluate(() => {
|
|
42
|
-
const element = document.getElementById("carousel-hero-regression");
|
|
43
|
-
const instance = element?.ODS_CarouselHero?.instance;
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
activeIndex: instance?.activeIndex,
|
|
47
|
-
realIndex: instance?.realIndex,
|
|
48
|
-
transform: instance?.wrapperEl?.style.transform ?? "",
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
describe("CarouselHero visual flow", () => {
|
|
54
|
-
beforeEach(async () => {
|
|
55
|
-
await page.viewport(1280, 720);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test("wraps and keeps adjacent tab navigation short", async () => {
|
|
59
|
-
render(
|
|
60
|
-
<CarouselHero id="carousel-hero-regression" tabs={tabs}>
|
|
61
|
-
{slides}
|
|
62
|
-
</CarouselHero>,
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
await expect(page.getByRole("tab", { name: "HONOR 200" })).toBeVisible();
|
|
66
|
-
|
|
67
|
-
await page.getByRole("tab", { name: "HONOR 200" }).click();
|
|
68
|
-
await page.waitForTimeout(500);
|
|
69
|
-
|
|
70
|
-
let state = await getCarouselState();
|
|
71
|
-
expect(state.realIndex).toBe(4);
|
|
72
|
-
expect(state.activeIndex).toBe(4);
|
|
73
|
-
|
|
74
|
-
await page.getByRole("button", { name: "Nasledujúci snímok" }).click();
|
|
75
|
-
await page.waitForTimeout(500);
|
|
76
|
-
|
|
77
|
-
state = await getCarouselState();
|
|
78
|
-
expect(state.realIndex).toBe(0);
|
|
79
|
-
expect(state.activeIndex).toBe(0);
|
|
80
|
-
|
|
81
|
-
await page.getByRole("tab", { name: "3 mesiace zadarmo" }).click();
|
|
82
|
-
await page.waitForTimeout(500);
|
|
83
|
-
|
|
84
|
-
state = await getCarouselState();
|
|
85
|
-
expect(state.realIndex).toBe(1);
|
|
86
|
-
expect(state.activeIndex).toBe(1);
|
|
87
|
-
expect(state.transform).toContain("translate3d");
|
|
88
|
-
expect(state.transform).toContain("-");
|
|
89
|
-
});
|
|
90
|
-
});
|