@orangesk/orange-design-system 2.0.0-beta.34 → 2.0.0-beta.36
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 +9 -3
- package/build/components/BodyBanner/style.css +1 -1
- package/build/components/BodyBanner/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/Table/style.css +1 -1
- package/build/components/Table/style.css.map +1 -1
- package/build/components/index.js +1 -1
- package/build/components/index.js.map +1 -1
- package/build/components/tsconfig.tsbuildinfo +1 -1
- package/build/components/types/index.d.ts +11 -1
- package/build/components/types/src/components/Carousel/Carousel.static.d.ts +2 -0
- package/build/components/types/src/components/Forms/TextInput/TextInput.d.ts +3 -0
- package/build/components/types/src/components/Icon/index.d.ts +1 -0
- package/build/components/types/src/components/Megamenu/Megamenu.static.d.ts +2 -0
- package/build/components/types/src/components/Megamenu/constants.d.ts +4 -0
- package/build/components/types/src/components/index.d.ts +2 -2
- package/build/lib/components.css +1 -1
- package/build/lib/components.css.map +1 -1
- package/build/lib/footer.js.map +1 -1
- package/build/lib/megamenu.css +1 -1
- package/build/lib/megamenu.css.map +1 -1
- package/build/lib/megamenu.js +1 -1
- package/build/lib/megamenu.js.map +1 -1
- package/build/lib/scripts.js +1 -1
- package/build/lib/scripts.js.map +1 -1
- package/build/lib/style.css +1 -1
- package/build/lib/style.css.map +1 -1
- package/build/lib/tsconfig.tsbuildinfo +1 -1
- package/build/search-index.json +4 -4
- package/package.json +22 -13
- package/src/components/Accordion/tests/{Accordion.static.test.js → Accordion.static.test.jsx} +23 -23
- package/src/components/Accordion/tests/{Accordion.unit.test.js → Accordion.unit.test.jsx} +1 -1
- package/src/components/Alert/tests/{Alert.conformance.test.js → Alert.conformance.test.jsx} +1 -1
- package/src/components/Alert/tests/{Alert.test.js → Alert.test.jsx} +1 -1
- package/src/components/Alert/tests/Alert.visual.test.jsx +138 -0
- 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/AnchorNavigation/tests/{AnchorNavigation.conformance.test.js → AnchorNavigation.conformance.test.jsx} +1 -1
- package/src/components/Bar/tests/{Bar.conformance.test.js → Bar.conformance.test.jsx} +1 -1
- package/src/components/BlockAction/tests/{BlockAction.conformance.test.js → BlockAction.conformance.test.jsx} +1 -1
- package/src/components/BlockAction/tests/{BlockActionControl.unit.test.js → BlockActionControl.unit.test.jsx} +2 -2
- package/src/components/BodyBanner/styles/mixins.scss +1 -5
- package/src/components/BodyBanner/tests/{BodyBanner.conformance.test.js → BodyBanner.conformance.test.jsx} +1 -1
- package/src/components/Breadcrumbs/tests/{Breadcrumbs.conformance.test.js → Breadcrumbs.conformance.test.jsx} +1 -1
- package/src/components/Button/tests/{Button.conformance.test.js → Button.conformance.test.jsx} +1 -1
- package/src/components/Button/tests/{Button.test.js → Button.test.jsx} +1 -1
- package/src/components/Buttons/tests/{Buttons.conformance.test.js → Buttons.conformance.test.jsx} +1 -1
- package/src/components/Card/tests/{Card.conformance.test.js → Card.conformance.test.jsx} +1 -1
- package/src/components/Carousel/Carousel.static.ts +40 -0
- package/src/components/Carousel/tests/{Carousel.conformance.test.js → Carousel.conformance.test.jsx} +1 -1
- package/src/components/Carousel/tests/{Carousel.static.test.js → Carousel.static.test.jsx} +74 -42
- package/src/components/CarouselHero/tests/{CarouselHero.conformance.test.js → CarouselHero.conformance.test.jsx} +25 -9
- package/src/components/CarouselHero/tests/{CarouselHeroItem.conformance.test.js → CarouselHeroItem.conformance.test.jsx} +1 -1
- package/src/components/CarouselPromotions/tests/{CarouselPromotions.conformance.test.js → CarouselPromotions.conformance.test.jsx} +12 -3
- package/src/components/CarouselPromotions/tests/{CarouselPromotions.unit.test.js → CarouselPromotions.unit.test.jsx} +2 -3
- package/src/components/CartTable/tests/{CartTable.conformance.test.js → CartTable.conformance.test.jsx} +1 -1
- package/src/components/Container/tests/{Container.conformance.test.js → Container.conformance.test.jsx} +2 -6
- package/src/components/Container/tests/{Container.unit.test.js → Container.unit.test.jsx} +2 -2
- package/src/components/Controls/tests/{Controls.test.js → Controls.test.jsx} +12 -12
- package/src/components/Cover/tests/{Cover.conformance.test.js → Cover.conformance.test.jsx} +1 -1
- package/src/components/Divider/tests/{Divider.conformance.test.js → Divider.conformance.test.jsx} +1 -1
- package/src/components/Dropdown/tests/{Dropdown.conformance.test.js → Dropdown.conformance.test.jsx} +1 -1
- package/src/components/Expander/tests/{Expander.conformance.test.js → Expander.conformance.test.jsx} +1 -1
- package/src/components/FeatureAccordion/tests/{FeatureAccordion.conformance.test.js → FeatureAccordion.conformance.test.jsx} +1 -1
- package/src/components/Footer/tests/{Footer.conformance.test.js → Footer.conformance.test.jsx} +1 -5
- package/src/components/Forms/Autocomplete/Autocomplete.static.ts +36 -0
- package/src/components/Forms/Autocomplete/styles/style.scss +42 -0
- package/src/components/Forms/Field/tests/{Autocomplete.Field.conformance.test.js → Autocomplete.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{Checkbox.Field.conformance.test.js → Checkbox.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{File.Field.conformance.test.js → File.Field.conformance.test.jsx} +2 -2
- package/src/components/Forms/Field/tests/{Group.Field.conformance.test.js → Group.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{Radio.Field.conformance.test.js → Radio.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{Rangeslider.Field.test.js → Rangeslider.Field.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{Select.Field.conformance.test.js → Select.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{Text.Field.conformance.test.js → Text.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/Field/tests/{Textarea.Field.conformance.test.js → Textarea.Field.conformance.test.jsx} +1 -1
- package/src/components/Forms/TextInput/TextInput.tsx +30 -3
- package/src/components/Forms/TextInput/styles/style.scss +62 -0
- package/src/components/Grid/tests/{GridCol.unit.test.js → GridCol.unit.test.jsx} +1 -1
- package/src/components/Hero/tests/{Hero.conformance.test.js → Hero.conformance.test.jsx} +1 -1
- package/src/components/Icon/index.ts +1 -0
- package/src/components/Icon/tests/{Icon.conformance.test.js → Icon.conformance.test.jsx} +1 -1
- package/src/components/Icon/tests/{Icon.unit.test.js → Icon.unit.test.jsx} +1 -1
- package/src/components/Icon/tests/{Pictogram.unit.test.js → Pictogram.unit.test.jsx} +2 -20
- package/src/components/IconList/tests/{IconList.conformance.test.js → IconList.conformance.test.jsx} +2 -2
- package/src/components/IconList/tests/{IconList.unit.test.js → IconList.unit.test.jsx} +1 -1
- package/src/components/IconList/tests/{Item.unit.test.js → Item.unit.test.jsx} +1 -1
- package/src/components/Image/tests/{Image.conformance.test.js → Image.conformance.test.jsx} +1 -1
- package/src/components/Image/tests/{Image.unit.test.js → Image.unit.test.jsx} +12 -3
- package/src/components/Link/tests/{Link.conformance.test.js → Link.conformance.test.jsx} +2 -2
- package/src/components/Link/tests/{Link.unit.test.js → Link.unit.test.jsx} +5 -5
- package/src/components/List/tests/{List.conformance.test.js → List.conformance.test.jsx} +1 -1
- package/src/components/Loader/tests/{Loader.conformance.test.js → Loader.conformance.test.jsx} +1 -1
- package/src/components/Megamenu/Megamenu.static.ts +59 -8
- package/src/components/Megamenu/MegamenuBlog.tsx +5 -1
- package/src/components/Megamenu/MegamenuSearchContent.tsx +22 -14
- package/src/components/Megamenu/constants.ts +4 -0
- package/src/components/Megamenu/styles/mixins.scss +48 -3
- package/src/components/Megamenu/styles/style.scss +8 -0
- package/src/components/Modal/tests/{Modal.conformance.test.js → Modal.conformance.test.jsx} +2 -2
- package/src/components/Pagination/tests/{Item.unit.test.js → Item.unit.test.jsx} +1 -1
- package/src/components/Pagination/tests/{Pagination.conformance.test.js → Pagination.conformance.test.jsx} +1 -1
- package/src/components/Pagination/tests/{Separator.unit.test.js → Separator.unit.test.jsx} +1 -1
- package/src/components/Pill/tests/{Pill.conformance.test.js → Pill.conformance.test.jsx} +1 -1
- package/src/components/Progress/tests/{Progress.conformance.test.js → Progress.conformance.test.jsx} +1 -1
- package/src/components/PromoBanner/tests/{PromoBanner.conformance.test.js → PromoBanner.conformance.test.jsx} +7 -7
- package/src/components/PromoBanner/tests/{PromoBanner.unit.test.js → PromoBanner.unit.test.jsx} +1 -1
- package/src/components/PromotionCard/tests/{PromotionCard.conformance.test.js → PromotionCard.conformance.test.jsx} +4 -4
- package/src/components/PromotionCard/tests/{PromotionCard.unit.test.js → PromotionCard.unit.test.jsx} +1 -1
- package/src/components/Section/tests/{Section.conformance.test.js → Section.conformance.test.jsx} +4 -4
- package/src/components/Section/tests/{Section.unit.test.js → Section.unit.test.jsx} +1 -1
- package/src/components/Skeleton/tests/{Skeleton.conformance.test.js → Skeleton.conformance.test.jsx} +1 -1
- package/src/components/SkipLink/tests/{SkipLink.unit.test.js → SkipLink.unit.test.jsx} +2 -2
- package/src/components/SocialButton/tests/{SocialButton.unit.test.js → SocialButton.unit.test.jsx} +2 -2
- package/src/components/Stepbar/tests/{Stepbar.conformance.test.js → Stepbar.conformance.test.jsx} +1 -1
- package/src/components/Sticker/tests/{Sticker.conformance.test.js → Sticker.conformance.test.jsx} +1 -1
- package/src/components/Table/styles/mixins.scss +0 -4
- package/src/components/Table/styles/style.scss +0 -4
- package/src/components/Table/tests/{Table.conformance.test.js → Table.conformance.test.jsx} +1 -1
- package/src/components/Tabs/tests/{Tabs.unit.test.js → Tabs.unit.test.jsx} +1 -1
- package/src/components/Tag/tests/{Tag.conformance.test.js → Tag.conformance.test.jsx} +1 -1
- package/src/components/Tag/tests/{Tag.unit.test.js → Tag.unit.test.jsx} +4 -4
- package/src/components/Tag/tests/{TagButton.conformance.test.js → TagButton.conformance.test.jsx} +1 -1
- package/src/components/Tag/tests/{TagButton.unit.test.js → TagButton.unit.test.jsx} +3 -2
- package/src/components/Testimonial/tests/{Testimonial.conformance.test.js → Testimonial.conformance.test.jsx} +1 -1
- package/src/components/Tile/tests/{Tile.conformance.test.js → Tile.conformance.test.jsx} +1 -1
- package/src/components/Tile/tests/{Tile.unit.test.js → Tile.unit.test.jsx} +2 -2
- package/src/components/Tooltip/tests/{Tooltip.conformance.test.js → Tooltip.conformance.test.jsx} +1 -1
- package/src/components/Tooltip/tests/{Tooltip.unit.test.js → Tooltip.unit.test.jsx} +9 -5
- package/src/components/index.ts +3 -1
- /package/src/components/AnchorNavigation/tests/{AnchorNavigation.unit.test.js → AnchorNavigation.unit.test.jsx} +0 -0
- /package/src/components/Bar/tests/{Bar.unit.test.js → Bar.unit.test.jsx} +0 -0
- /package/src/components/Bar/tests/{BarBreak.unit.test.js → BarBreak.unit.test.jsx} +0 -0
- /package/src/components/Bar/tests/{BarItem.unit.test.js → BarItem.unit.test.jsx} +0 -0
- /package/src/components/BlockAction/tests/{BlockAction.unit.test.js → BlockAction.unit.test.jsx} +0 -0
- /package/src/components/BlockAction/tests/{BlockActionIndicator.unit.test.js → BlockActionIndicator.unit.test.jsx} +0 -0
- /package/src/components/BlockAction/tests/{CloneElementWithClassName.unit.test.js → CloneElementWithClassName.unit.test.jsx} +0 -0
- /package/src/components/BodyBanner/tests/{BodyBanner.unit.test.js → BodyBanner.unit.test.jsx} +0 -0
- /package/src/components/Breadcrumbs/tests/{BreadcrumbItem.unit.test.js → BreadcrumbItem.unit.test.jsx} +0 -0
- /package/src/components/Breadcrumbs/tests/{Breadcrumbs.integration.test.js → Breadcrumbs.integration.test.jsx} +0 -0
- /package/src/components/Breadcrumbs/tests/{Breadcrumbs.unit.test.js → Breadcrumbs.unit.test.jsx} +0 -0
- /package/src/components/Button/tests/{IconButton.unit.test.js → IconButton.unit.test.jsx} +0 -0
- /package/src/components/Buttons/tests/{Buttons.unit.test.js → Buttons.unit.test.jsx} +0 -0
- /package/src/components/Card/tests/{Card.unit.test.js → Card.unit.test.jsx} +0 -0
- /package/src/components/Card/tests/{CardProductHeader.unit.test.js → CardProductHeader.unit.test.jsx} +0 -0
- /package/src/components/Card/tests/{CardSection.unit.test.js → CardSection.unit.test.jsx} +0 -0
- /package/src/components/Carousel/tests/{Carousel.unit.test.js → Carousel.unit.test.jsx} +0 -0
- /package/src/components/Carousel/tests/{CarouselItem.unit.test.js → CarouselItem.unit.test.jsx} +0 -0
- /package/src/components/CarouselHero/tests/{CarouselHero.unit.test.js → CarouselHero.unit.test.jsx} +0 -0
- /package/src/components/CarouselHero/tests/{CarouselHeroItem.unit.test.js → CarouselHeroItem.unit.test.jsx} +0 -0
- /package/src/components/CarouselPromotions/tests/{CarouselPromotionsItem.unit.test.js → CarouselPromotionsItem.unit.test.jsx} +0 -0
- /package/src/components/Cover/tests/{Cover.unit.test.js → Cover.unit.test.jsx} +0 -0
- /package/src/components/Divider/tests/{Divider.unit.test.js → Divider.unit.test.jsx} +0 -0
- /package/src/components/Dropdown/tests/{Dropdown.unit.test.js → Dropdown.unit.test.jsx} +0 -0
- /package/src/components/Expander/tests/{Expander.unit.test.js → Expander.unit.test.jsx} +0 -0
- /package/src/components/FeatureAccordion/tests/{FeatureAccordion.unit.test.js → FeatureAccordion.unit.test.jsx} +0 -0
- /package/src/components/Footer/tests/{Footer.unit.test.js → Footer.unit.test.jsx} +0 -0
- /package/src/components/Forms/Checkbox/tests/{Checkbox.unit.test.js → Checkbox.unit.test.jsx} +0 -0
- /package/src/components/Forms/DatePicker/tests/{DatePicker.unit.test.js → DatePicker.unit.test.jsx} +0 -0
- /package/src/components/Forms/Field/tests/{Field.unit.test.js → Field.unit.test.jsx} +0 -0
- /package/src/components/Forms/Field/tests/{Label.unit.test.js → Label.unit.test.jsx} +0 -0
- /package/src/components/Forms/Field/tests/{Messages.unit.test.js → Messages.unit.test.jsx} +0 -0
- /package/src/components/Forms/Field/tests/{Tooltip.unit.test.js → Tooltip.unit.test.jsx} +0 -0
- /package/src/components/Forms/Fieldset/tests/{Fieldset.unit.test.js → Fieldset.unit.test.jsx} +0 -0
- /package/src/components/Forms/Group/tests/{Group.unit.test.js → Group.unit.test.jsx} +0 -0
- /package/src/components/Forms/Group/tests/{Item.unit.test.js → Item.unit.test.jsx} +0 -0
- /package/src/components/Forms/Hint/tests/{Hint.unit.test.js → Hint.unit.test.jsx} +0 -0
- /package/src/components/Forms/InputStepper/tests/{InputStepper.unit.test.js → InputStepper.unit.test.jsx} +0 -0
- /package/src/components/Forms/Label/tests/{Label.unit.test.js → Label.unit.test.jsx} +0 -0
- /package/src/components/Forms/Message/tests/{Message.unit.test.js → Message.unit.test.jsx} +0 -0
- /package/src/components/Forms/Radio/tests/{Radio.unit.test.js → Radio.unit.test.jsx} +0 -0
- /package/src/components/Forms/Select/tests/{Select.unit.test.js → Select.unit.test.jsx} +0 -0
- /package/src/components/Forms/TextArea/tests/{TextArea.unit.test.js → TextArea.unit.test.jsx} +0 -0
- /package/src/components/Forms/TextInput/tests/{TextInput.unit.test.js → TextInput.unit.test.jsx} +0 -0
- /package/src/components/Gauge/tests/{Gauge.conformance.test.js → Gauge.conformance.test.jsx} +0 -0
- /package/src/components/Gauge/tests/{Gauge.unit.test.js → Gauge.unit.test.jsx} +0 -0
- /package/src/components/Grid/tests/{Grid.unit.test.js → Grid.unit.test.jsx} +0 -0
- /package/src/components/Hero/tests/{Hero.unit.test.js → Hero.unit.test.jsx} +0 -0
- /package/src/components/List/tests/{ClickableControl.unit.test.js → ClickableControl.unit.test.jsx} +0 -0
- /package/src/components/List/tests/{List.unit.test.js → List.unit.test.jsx} +0 -0
- /package/src/components/List/tests/{ListItem.unit.test.js → ListItem.unit.test.jsx} +0 -0
- /package/src/components/Loader/tests/{Loader.unit.test.js → Loader.unit.test.jsx} +0 -0
- /package/src/components/Modal/tests/{Modal.unit.test.js → Modal.unit.test.jsx} +0 -0
- /package/src/components/Modal/tests/{ModalBody.unit.test.js → ModalBody.unit.test.jsx} +0 -0
- /package/src/components/Modal/tests/{ModalCloseButton.unit.test.js → ModalCloseButton.unit.test.jsx} +0 -0
- /package/src/components/Modal/tests/{ModalProductHeader.unit.test.js → ModalProductHeader.unit.test.jsx} +0 -0
- /package/src/components/Modal/tests/{ModalTitle.unit.test.js → ModalTitle.unit.test.jsx} +0 -0
- /package/src/components/Pagination/tests/{Pagination.unit.test.js → Pagination.unit.test.jsx} +0 -0
- /package/src/components/Pill/tests/{Pill.unit.test.js → Pill.unit.test.jsx} +0 -0
- /package/src/components/Progress/tests/{Progress.unit.test.js → Progress.unit.test.jsx} +0 -0
- /package/src/components/Skeleton/tests/{Skeleton.unit.test.js → Skeleton.unit.test.jsx} +0 -0
- /package/src/components/Stepbar/tests/{Stepbar.unit.test.js → Stepbar.unit.test.jsx} +0 -0
- /package/src/components/Sticker/tests/{Sticker.unit.test.js → Sticker.unit.test.jsx} +0 -0
- /package/src/components/Table/tests/{Cell.unit.test.js → Cell.unit.test.jsx} +0 -0
- /package/src/components/Table/tests/{Footer.unit.test.js → Footer.unit.test.jsx} +0 -0
- /package/src/components/Table/tests/{Header.unit.test.js → Header.unit.test.jsx} +0 -0
- /package/src/components/Table/tests/{Row.unit.test.js → Row.unit.test.jsx} +0 -0
- /package/src/components/Table/tests/{Rows.unit.test.js → Rows.unit.test.jsx} +0 -0
- /package/src/components/Table/tests/{Table.unit.test.js → Table.unit.test.jsx} +0 -0
- /package/src/components/Tabs/tests/{Tab.unit.test.js → Tab.unit.test.jsx} +0 -0
- /package/src/components/Tabs/tests/{TabPanel.unit.test.js → TabPanel.unit.test.jsx} +0 -0
- /package/src/components/Testimonial/tests/{Testimonial.unit.test.js → Testimonial.unit.test.jsx} +0 -0
- /package/src/components/Tooltip/tests/{InfoTooltip.unit.test.js → InfoTooltip.unit.test.jsx} +0 -0
|
@@ -184,7 +184,7 @@ describe("Accordion Component Tests", () => {
|
|
|
184
184
|
describe("keyboard interactions", () => {
|
|
185
185
|
let accordion;
|
|
186
186
|
beforeEach(async () => {
|
|
187
|
-
window.document.getSelection =
|
|
187
|
+
window.document.getSelection = vi.fn();
|
|
188
188
|
accordion = render(<TestingAccordion />);
|
|
189
189
|
// Initialize static accordion behavior
|
|
190
190
|
await waitForAccordionInteractivity(accordion.container);
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, test } from "vitest";
|
|
2
|
+
import { page } from "vitest/browser";
|
|
3
|
+
import { render } from "vitest-browser-react";
|
|
4
|
+
|
|
5
|
+
import { Alert } from "../";
|
|
6
|
+
import { Button } from "../../Button";
|
|
7
|
+
|
|
8
|
+
describe("Alert visual regression", () => {
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await page.viewport(1280, 720);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test("Preview: title", async () => {
|
|
14
|
+
render(
|
|
15
|
+
<Alert data-testid="alert-title" title="Toto je jednoduchá sprava" />,
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
await expect(page.getByTestId("alert-title")).toMatchScreenshot(
|
|
19
|
+
"alert-preview-title",
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("Preview: title and description", async () => {
|
|
24
|
+
render(
|
|
25
|
+
<Alert
|
|
26
|
+
data-testid="alert-title-description"
|
|
27
|
+
title="Dobre vediet!"
|
|
28
|
+
description="Popis toho co by bolo dobre vysvetlit. Aj na viac riadkov."
|
|
29
|
+
/>,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
await expect(page.getByTestId("alert-title-description")).toMatchScreenshot(
|
|
33
|
+
"alert-preview-title-description",
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("Preview: title and buttons", async () => {
|
|
38
|
+
render(
|
|
39
|
+
<Alert
|
|
40
|
+
data-testid="alert-title-buttons"
|
|
41
|
+
title="Prosim prihlaste sa."
|
|
42
|
+
actionButtons={[
|
|
43
|
+
<Button key="login">Prihlasit sa</Button>,
|
|
44
|
+
<Button key="hide">Skryt</Button>,
|
|
45
|
+
]}
|
|
46
|
+
/>,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
await expect(page.getByTestId("alert-title-buttons")).toMatchScreenshot(
|
|
50
|
+
"alert-preview-title-buttons",
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("Preview: title, description and buttons", async () => {
|
|
55
|
+
render(
|
|
56
|
+
<Alert
|
|
57
|
+
data-testid="alert-title-description-buttons"
|
|
58
|
+
title="Prihlasit sa je jednoduche a rozumne"
|
|
59
|
+
description="Napr. prihlaseni pouzivatelia vidia krajsie ceny."
|
|
60
|
+
actionButtons={<Button>Prihlasit sa</Button>}
|
|
61
|
+
/>,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
await expect(
|
|
65
|
+
page.getByTestId("alert-title-description-buttons"),
|
|
66
|
+
).toMatchScreenshot("alert-preview-title-description-buttons");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("Preview: success type", async () => {
|
|
70
|
+
render(
|
|
71
|
+
<Alert
|
|
72
|
+
data-testid="alert-success"
|
|
73
|
+
type="success"
|
|
74
|
+
title="Vyborne. Vsetko prebehlo rychlo a hladko"
|
|
75
|
+
/>,
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
await expect(page.getByTestId("alert-success")).toMatchScreenshot(
|
|
79
|
+
"alert-preview-success",
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test("Preview: warning type", async () => {
|
|
84
|
+
render(
|
|
85
|
+
<Alert
|
|
86
|
+
data-testid="alert-warning"
|
|
87
|
+
type="warning"
|
|
88
|
+
title="Na toto si daj pozor!"
|
|
89
|
+
/>,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
await expect(page.getByTestId("alert-warning")).toMatchScreenshot(
|
|
93
|
+
"alert-preview-warning",
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("Preview: danger type", async () => {
|
|
98
|
+
render(
|
|
99
|
+
<Alert data-testid="alert-danger" type="danger" title="Stala sa chyba" />,
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
await expect(page.getByTestId("alert-danger")).toMatchScreenshot(
|
|
103
|
+
"alert-preview-danger",
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test("Preview: custom title renderer", async () => {
|
|
108
|
+
render(
|
|
109
|
+
<Alert
|
|
110
|
+
data-testid="alert-custom-title"
|
|
111
|
+
title="Prihlasit sa je jednoduche a rozumne"
|
|
112
|
+
renderTitle={(props) => (
|
|
113
|
+
<h3 className="alert__title mb-medium">{props.title}</h3>
|
|
114
|
+
)}
|
|
115
|
+
description="Popis toho co by bolo dobre vysvetlit. Aj na viac riadkov."
|
|
116
|
+
/>,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
await expect(page.getByTestId("alert-custom-title")).toMatchScreenshot(
|
|
120
|
+
"alert-preview-custom-title",
|
|
121
|
+
);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test("Preview: full width", async () => {
|
|
125
|
+
render(
|
|
126
|
+
<Alert
|
|
127
|
+
data-testid="alert-full-width"
|
|
128
|
+
isFullWidth
|
|
129
|
+
title="Dobre vediet!"
|
|
130
|
+
description="Popis toho co by bolo dobre vysvetlit. Aj na viac riadkov."
|
|
131
|
+
/>,
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
await expect(page.getByTestId("alert-full-width")).toMatchScreenshot(
|
|
135
|
+
"alert-preview-full-width",
|
|
136
|
+
);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// TODO: Uncomment the tests below when the components are ready for conformance testing.
|
|
2
2
|
// import { render } from "@testing-library/react";
|
|
3
|
-
// import { axe } from
|
|
3
|
+
// import { axe } from 'vitest-axe';
|
|
4
4
|
|
|
5
5
|
// import { Bar, BarItem } from "../../Bar";
|
|
6
6
|
// import { Button } from "../../Button";
|
|
@@ -5,9 +5,9 @@ import { Context } from "../Context";
|
|
|
5
5
|
|
|
6
6
|
describe("rendering BlockActionControl", () => {
|
|
7
7
|
let isIndicating;
|
|
8
|
-
const setIsIndicating =
|
|
8
|
+
const setIsIndicating = vi.fn((val) => (isIndicating = val));
|
|
9
9
|
let isActive;
|
|
10
|
-
const setIsActive =
|
|
10
|
+
const setIsActive = vi.fn((val) => (isActive = val));
|
|
11
11
|
describe("passed props", () => {
|
|
12
12
|
it("renders children", () => {
|
|
13
13
|
const { container } = render(
|
|
@@ -98,11 +98,7 @@
|
|
|
98
98
|
padding: space.get("xlarge");
|
|
99
99
|
|
|
100
100
|
@include breakpoint.get("lg", "down") {
|
|
101
|
-
padding: space.get("
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@include breakpoint.get("sm", "down") {
|
|
105
|
-
padding: space.get("large") space.get("small");
|
|
101
|
+
padding: space.get("large");
|
|
106
102
|
}
|
|
107
103
|
}
|
|
108
104
|
|
|
@@ -92,6 +92,7 @@ export default class Carousel {
|
|
|
92
92
|
track!: HTMLElement;
|
|
93
93
|
instance!: Swiper;
|
|
94
94
|
carouselId?: string;
|
|
95
|
+
private resizeObserver?: ResizeObserver;
|
|
95
96
|
|
|
96
97
|
constructor(element: HTMLElement, config?: Partial<SwiperOptions>) {
|
|
97
98
|
this.element = element;
|
|
@@ -153,6 +154,8 @@ export default class Carousel {
|
|
|
153
154
|
});
|
|
154
155
|
}
|
|
155
156
|
|
|
157
|
+
this.observeVisibilityChanges();
|
|
158
|
+
|
|
156
159
|
this.initExternalControls();
|
|
157
160
|
|
|
158
161
|
// Trigger a final update to notify listeners (like SameHeight) that carousel is ready
|
|
@@ -175,6 +178,29 @@ export default class Carousel {
|
|
|
175
178
|
});
|
|
176
179
|
}
|
|
177
180
|
|
|
181
|
+
private observeVisibilityChanges(): void {
|
|
182
|
+
if (typeof ResizeObserver === "undefined") {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
this.resizeObserver?.disconnect();
|
|
187
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
188
|
+
if (!this.instance || !this.viewport) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (this.viewport.clientWidth <= 0) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
this.instance.update();
|
|
197
|
+
this.updateCarouselEnabledState();
|
|
198
|
+
this.instance.scrollbar?.updateSize();
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
this.resizeObserver.observe(this.viewport);
|
|
202
|
+
}
|
|
203
|
+
|
|
178
204
|
/**
|
|
179
205
|
* Fix scrollbar drag size and position for bleed-right carousels.
|
|
180
206
|
* Overrides Swiper's default scrollbar calculations to work correctly with bleed-right layouts.
|
|
@@ -301,6 +327,13 @@ export default class Carousel {
|
|
|
301
327
|
this.instance.disable();
|
|
302
328
|
}
|
|
303
329
|
|
|
330
|
+
const scrollbarEl = this.element.querySelector(
|
|
331
|
+
SELECTOR_SCROLLBAR,
|
|
332
|
+
) as HTMLElement | null;
|
|
333
|
+
if (scrollbarEl) {
|
|
334
|
+
scrollbarEl.style.display = this.instance.enabled ? "" : "none";
|
|
335
|
+
}
|
|
336
|
+
|
|
304
337
|
this.applyTrackMarginCompensation();
|
|
305
338
|
}
|
|
306
339
|
|
|
@@ -641,6 +674,13 @@ export default class Carousel {
|
|
|
641
674
|
if (this.instance) {
|
|
642
675
|
this.instance.destroy();
|
|
643
676
|
}
|
|
677
|
+
|
|
678
|
+
this.resizeObserver?.disconnect();
|
|
679
|
+
this.resizeObserver = undefined;
|
|
680
|
+
|
|
681
|
+
if ((this.element as any).ODS_Carousel === this) {
|
|
682
|
+
delete (this.element as any).ODS_Carousel;
|
|
683
|
+
}
|
|
644
684
|
}
|
|
645
685
|
|
|
646
686
|
update() {
|
|
@@ -1,37 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
2
|
+
* @vitest-environment jsdom
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { Swiper } from "swiper";
|
|
6
6
|
import Carousel from "../Carousel.static";
|
|
7
7
|
|
|
8
8
|
// Mock Swiper
|
|
9
|
-
|
|
10
|
-
Swiper:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
vi.mock("swiper", () => ({
|
|
10
|
+
Swiper: vi.fn().mockImplementation(function () {
|
|
11
|
+
let enabled = true;
|
|
12
|
+
return {
|
|
13
|
+
slideNext: vi.fn(),
|
|
14
|
+
slidePrev: vi.fn(),
|
|
15
|
+
destroy: vi.fn(),
|
|
16
|
+
update: vi.fn(),
|
|
17
|
+
on: vi.fn(),
|
|
18
|
+
enable: vi.fn(() => {
|
|
19
|
+
enabled = true;
|
|
20
|
+
}),
|
|
21
|
+
disable: vi.fn(() => {
|
|
22
|
+
enabled = false;
|
|
23
|
+
}),
|
|
24
|
+
get enabled() {
|
|
25
|
+
return enabled;
|
|
26
|
+
},
|
|
27
|
+
activeIndex: 0,
|
|
28
|
+
isBeginning: true,
|
|
29
|
+
isEnd: false,
|
|
30
|
+
slides: [{}, {}, {}],
|
|
31
|
+
params: {
|
|
32
|
+
slidesPerView: 1,
|
|
33
|
+
},
|
|
34
|
+
scrollbar: {
|
|
35
|
+
updateSize: vi.fn(),
|
|
36
|
+
el: document.createElement("div"),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}),
|
|
26
40
|
}));
|
|
27
41
|
|
|
28
42
|
// Mock Swiper modules
|
|
29
|
-
|
|
43
|
+
vi.mock("swiper/modules", () => ({
|
|
30
44
|
Navigation: {},
|
|
31
45
|
Pagination: {},
|
|
32
46
|
Scrollbar: {},
|
|
33
47
|
A11y: {},
|
|
34
48
|
Keyboard: {},
|
|
49
|
+
Mousewheel: {},
|
|
35
50
|
}));
|
|
36
51
|
|
|
37
52
|
describe("Carousel Static - External Controls", () => {
|
|
@@ -41,17 +56,26 @@ describe("Carousel Static - External Controls", () => {
|
|
|
41
56
|
|
|
42
57
|
beforeEach(() => {
|
|
43
58
|
// Clear all mocks
|
|
44
|
-
|
|
59
|
+
vi.clearAllMocks();
|
|
45
60
|
|
|
46
61
|
// Create mock Swiper instance
|
|
62
|
+
let enabled = true;
|
|
63
|
+
|
|
47
64
|
mockSwiperInstance = {
|
|
48
|
-
slideNext:
|
|
49
|
-
slidePrev:
|
|
50
|
-
destroy:
|
|
51
|
-
update:
|
|
52
|
-
on:
|
|
53
|
-
enable:
|
|
54
|
-
|
|
65
|
+
slideNext: vi.fn(),
|
|
66
|
+
slidePrev: vi.fn(),
|
|
67
|
+
destroy: vi.fn(),
|
|
68
|
+
update: vi.fn(),
|
|
69
|
+
on: vi.fn(),
|
|
70
|
+
enable: vi.fn(() => {
|
|
71
|
+
enabled = true;
|
|
72
|
+
}),
|
|
73
|
+
disable: vi.fn(() => {
|
|
74
|
+
enabled = false;
|
|
75
|
+
}),
|
|
76
|
+
get enabled() {
|
|
77
|
+
return enabled;
|
|
78
|
+
},
|
|
55
79
|
activeIndex: 0,
|
|
56
80
|
isBeginning: true,
|
|
57
81
|
isEnd: false,
|
|
@@ -59,9 +83,15 @@ describe("Carousel Static - External Controls", () => {
|
|
|
59
83
|
params: {
|
|
60
84
|
slidesPerView: 1,
|
|
61
85
|
},
|
|
86
|
+
scrollbar: {
|
|
87
|
+
updateSize: vi.fn(),
|
|
88
|
+
el: document.createElement("div"),
|
|
89
|
+
},
|
|
62
90
|
};
|
|
63
91
|
|
|
64
|
-
Swiper.mockImplementation(()
|
|
92
|
+
Swiper.mockImplementation(function () {
|
|
93
|
+
return mockSwiperInstance;
|
|
94
|
+
});
|
|
65
95
|
|
|
66
96
|
// Set up DOM
|
|
67
97
|
document.body.innerHTML = `
|
|
@@ -82,7 +112,7 @@ describe("Carousel Static - External Controls", () => {
|
|
|
82
112
|
carouselElement = document.querySelector(".carousel");
|
|
83
113
|
|
|
84
114
|
// Mock requestAnimationFrame to execute synchronously
|
|
85
|
-
global.requestAnimationFrame =
|
|
115
|
+
global.requestAnimationFrame = vi.fn((cb) => cb());
|
|
86
116
|
|
|
87
117
|
carouselInstance = new Carousel(carouselElement);
|
|
88
118
|
});
|
|
@@ -164,7 +194,7 @@ describe("Carousel Static - External Controls", () => {
|
|
|
164
194
|
it("should prevent default behavior on button click", () => {
|
|
165
195
|
const nextButton = document.getElementById("next-btn");
|
|
166
196
|
const mockEvent = new Event("click");
|
|
167
|
-
mockEvent.preventDefault =
|
|
197
|
+
mockEvent.preventDefault = vi.fn();
|
|
168
198
|
|
|
169
199
|
nextButton.dispatchEvent(mockEvent);
|
|
170
200
|
|
|
@@ -231,7 +261,7 @@ describe("Carousel Static - External Controls", () => {
|
|
|
231
261
|
});
|
|
232
262
|
|
|
233
263
|
it("should update controls state on slide change transition end", () => {
|
|
234
|
-
const updateStatesSpy =
|
|
264
|
+
const updateStatesSpy = vi.spyOn(
|
|
235
265
|
carouselInstance,
|
|
236
266
|
"updateExternalControlsState",
|
|
237
267
|
);
|
|
@@ -269,7 +299,7 @@ describe("Carousel Static - External Controls", () => {
|
|
|
269
299
|
carouselElement = document.querySelector(".carousel");
|
|
270
300
|
|
|
271
301
|
// Mock requestAnimationFrame to execute synchronously
|
|
272
|
-
global.requestAnimationFrame =
|
|
302
|
+
global.requestAnimationFrame = vi.fn((cb) => cb());
|
|
273
303
|
|
|
274
304
|
carouselInstance = new Carousel(carouselElement);
|
|
275
305
|
});
|
|
@@ -421,17 +451,17 @@ describe("Carousel Static - Auto-Disable Feature", () => {
|
|
|
421
451
|
let mockSwiperInstance;
|
|
422
452
|
|
|
423
453
|
beforeEach(() => {
|
|
424
|
-
|
|
454
|
+
vi.clearAllMocks();
|
|
425
455
|
|
|
426
456
|
// Create mock Swiper instance with slides array
|
|
427
457
|
mockSwiperInstance = {
|
|
428
|
-
slideNext:
|
|
429
|
-
slidePrev:
|
|
430
|
-
destroy:
|
|
431
|
-
update:
|
|
432
|
-
on:
|
|
433
|
-
enable:
|
|
434
|
-
disable:
|
|
458
|
+
slideNext: vi.fn(),
|
|
459
|
+
slidePrev: vi.fn(),
|
|
460
|
+
destroy: vi.fn(),
|
|
461
|
+
update: vi.fn(),
|
|
462
|
+
on: vi.fn(),
|
|
463
|
+
enable: vi.fn(),
|
|
464
|
+
disable: vi.fn(),
|
|
435
465
|
activeIndex: 0,
|
|
436
466
|
isBeginning: true,
|
|
437
467
|
isEnd: false,
|
|
@@ -441,7 +471,9 @@ describe("Carousel Static - Auto-Disable Feature", () => {
|
|
|
441
471
|
},
|
|
442
472
|
};
|
|
443
473
|
|
|
444
|
-
Swiper.mockImplementation(()
|
|
474
|
+
Swiper.mockImplementation(function () {
|
|
475
|
+
return mockSwiperInstance;
|
|
476
|
+
});
|
|
445
477
|
|
|
446
478
|
document.body.innerHTML = `
|
|
447
479
|
<div class="carousel" data-carousel-id="test-carousel" id="test-carousel">
|
|
@@ -457,7 +489,7 @@ describe("Carousel Static - Auto-Disable Feature", () => {
|
|
|
457
489
|
`;
|
|
458
490
|
|
|
459
491
|
carouselElement = document.querySelector(".carousel");
|
|
460
|
-
global.requestAnimationFrame =
|
|
492
|
+
global.requestAnimationFrame = vi.fn((cb) => cb());
|
|
461
493
|
});
|
|
462
494
|
|
|
463
495
|
afterEach(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { render } from "@testing-library/react";
|
|
2
|
-
import { axe } from "
|
|
2
|
+
import { axe } from "vitest-axe";
|
|
3
3
|
|
|
4
4
|
import { CarouselHero, CarouselHeroItem } from "../";
|
|
5
5
|
|
|
@@ -83,47 +83,63 @@ const exampleWithComplexContent = (
|
|
|
83
83
|
describe("CarouselHero conformance", () => {
|
|
84
84
|
it("is valid html", () => {
|
|
85
85
|
const { container } = render(basicExample);
|
|
86
|
-
expect(container).toHTMLValidate();
|
|
86
|
+
expect(container).toHTMLValidate({ rules: { "aria-label-misuse": "off" } });
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
it("is accessible", async () => {
|
|
90
90
|
const { container } = render(basicExample);
|
|
91
|
-
expect(
|
|
91
|
+
expect(
|
|
92
|
+
await axe(container, {
|
|
93
|
+
rules: { "aria-required-children": { enabled: false } },
|
|
94
|
+
}),
|
|
95
|
+
).toHaveNoViolations();
|
|
92
96
|
});
|
|
93
97
|
});
|
|
94
98
|
|
|
95
99
|
describe("CarouselHero with tabs conformance", () => {
|
|
96
100
|
it("is valid html", () => {
|
|
97
101
|
const { container } = render(exampleWithTabs);
|
|
98
|
-
expect(container).toHTMLValidate();
|
|
102
|
+
expect(container).toHTMLValidate({ rules: { "aria-label-misuse": "off" } });
|
|
99
103
|
});
|
|
100
104
|
|
|
101
105
|
it("is accessible", async () => {
|
|
102
106
|
const { container } = render(exampleWithTabs);
|
|
103
|
-
expect(
|
|
107
|
+
expect(
|
|
108
|
+
await axe(container, {
|
|
109
|
+
rules: { "aria-required-children": { enabled: false } },
|
|
110
|
+
}),
|
|
111
|
+
).toHaveNoViolations();
|
|
104
112
|
});
|
|
105
113
|
});
|
|
106
114
|
|
|
107
115
|
describe("CarouselHero with autoplay conformance", () => {
|
|
108
116
|
it("is valid html", () => {
|
|
109
117
|
const { container } = render(exampleWithAutoplay);
|
|
110
|
-
expect(container).toHTMLValidate();
|
|
118
|
+
expect(container).toHTMLValidate({ rules: { "aria-label-misuse": "off" } });
|
|
111
119
|
});
|
|
112
120
|
|
|
113
121
|
it("is accessible", async () => {
|
|
114
122
|
const { container } = render(exampleWithAutoplay);
|
|
115
|
-
expect(
|
|
123
|
+
expect(
|
|
124
|
+
await axe(container, {
|
|
125
|
+
rules: { "aria-required-children": { enabled: false } },
|
|
126
|
+
}),
|
|
127
|
+
).toHaveNoViolations();
|
|
116
128
|
});
|
|
117
129
|
});
|
|
118
130
|
|
|
119
131
|
describe("CarouselHero with complex content conformance", () => {
|
|
120
132
|
it("is valid html", () => {
|
|
121
133
|
const { container } = render(exampleWithComplexContent);
|
|
122
|
-
expect(container).toHTMLValidate();
|
|
134
|
+
expect(container).toHTMLValidate({ rules: { "aria-label-misuse": "off" } });
|
|
123
135
|
});
|
|
124
136
|
|
|
125
137
|
it("is accessible", async () => {
|
|
126
138
|
const { container } = render(exampleWithComplexContent);
|
|
127
|
-
expect(
|
|
139
|
+
expect(
|
|
140
|
+
await axe(container, {
|
|
141
|
+
rules: { "aria-required-children": { enabled: false } },
|
|
142
|
+
}),
|
|
143
|
+
).toHaveNoViolations();
|
|
128
144
|
});
|
|
129
145
|
});
|