@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
package/src/components/IconList/tests/{IconList.conformance.test.js → IconList.conformance.test.jsx}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render } from "@testing-library/react";
|
|
3
|
-
import { axe } from
|
|
3
|
+
import { axe } from 'vitest-axe';
|
|
4
4
|
|
|
5
5
|
// Mock Tooltip komponent
|
|
6
|
-
|
|
6
|
+
vi.mock("../../Tooltip", () => ({
|
|
7
7
|
InfoTooltip: ({ children, placement, ...props }) => (
|
|
8
8
|
<span className="tooltip" data-tooltip-placement={placement} {...props}>
|
|
9
9
|
<svg className="bold" />
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
// Mock Tooltip komponent
|
|
5
|
-
|
|
5
|
+
vi.mock('../../Tooltip', () => ({
|
|
6
6
|
InfoTooltip: ({ children, ...props }) => <div data-testid="info-tooltip" {...props}>{children}</div>,
|
|
7
7
|
}));
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { render } from "@testing-library/react";
|
|
2
2
|
|
|
3
3
|
// Mock Tooltip komponent
|
|
4
|
-
|
|
4
|
+
vi.mock("../../Tooltip", () => ({
|
|
5
5
|
InfoTooltip: ({ children, placement, className = "", ...props }) => (
|
|
6
6
|
<span
|
|
7
7
|
className={`tooltip ${className}`.trim()}
|
|
@@ -2,7 +2,16 @@ import React from "react";
|
|
|
2
2
|
import { render, screen } from "@testing-library/react";
|
|
3
3
|
|
|
4
4
|
// Mock breakpoints since SCSS modules don't work in tests
|
|
5
|
-
|
|
5
|
+
vi.mock("../../../styles/export/breakpoint", () => ({
|
|
6
|
+
default: {
|
|
7
|
+
xs: "0px",
|
|
8
|
+
sm: "480px",
|
|
9
|
+
md: "768px",
|
|
10
|
+
lg: "992px",
|
|
11
|
+
xl: "1240px",
|
|
12
|
+
xxl: "1380px",
|
|
13
|
+
xxxl: "1920px",
|
|
14
|
+
},
|
|
6
15
|
xs: "0px",
|
|
7
16
|
sm: "480px",
|
|
8
17
|
md: "768px",
|
|
@@ -105,8 +114,8 @@ describe("Image Component", () => {
|
|
|
105
114
|
|
|
106
115
|
it("renders with correct src attribute for string src", () => {
|
|
107
116
|
const { container } = render(<Image alt="test" src={singleSource} />);
|
|
108
|
-
expect(container.querySelector("img").src).toEqual(
|
|
109
|
-
|
|
117
|
+
expect(new URL(container.querySelector("img").src).pathname).toEqual(
|
|
118
|
+
singleSource,
|
|
110
119
|
);
|
|
111
120
|
});
|
|
112
121
|
|
|
@@ -19,8 +19,8 @@ Conformance tests for the Link component:
|
|
|
19
19
|
- Does not create unnecessary wrapper elements.
|
|
20
20
|
*/
|
|
21
21
|
import { render, screen } from "@testing-library/react";
|
|
22
|
-
import { axe } from
|
|
23
|
-
import "@testing-library/jest-dom";
|
|
22
|
+
import { axe } from 'vitest-axe';
|
|
23
|
+
import "@testing-library/jest-dom/vitest";
|
|
24
24
|
|
|
25
25
|
import { Link } from "../";
|
|
26
26
|
|
|
@@ -25,14 +25,14 @@ Unit tests for the Link component:
|
|
|
25
25
|
- Has correct display name 'Link'.
|
|
26
26
|
*/
|
|
27
27
|
import { render, screen, fireEvent } from "@testing-library/react";
|
|
28
|
-
import "@testing-library/jest-dom";
|
|
28
|
+
import "@testing-library/jest-dom/vitest";
|
|
29
29
|
|
|
30
30
|
import { Link } from "../";
|
|
31
31
|
|
|
32
32
|
// Mock console.warn to test warning messages
|
|
33
33
|
const originalWarn = console.warn;
|
|
34
34
|
beforeEach(() => {
|
|
35
|
-
console.warn =
|
|
35
|
+
console.warn = vi.fn();
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
afterEach(() => {
|
|
@@ -142,8 +142,8 @@ describe("Link Component", () => {
|
|
|
142
142
|
});
|
|
143
143
|
|
|
144
144
|
it("forwards event handlers", () => {
|
|
145
|
-
const handleClick =
|
|
146
|
-
const handleMouseEnter =
|
|
145
|
+
const handleClick = vi.fn();
|
|
146
|
+
const handleMouseEnter = vi.fn();
|
|
147
147
|
|
|
148
148
|
render(
|
|
149
149
|
<Link
|
|
@@ -242,7 +242,7 @@ describe("Link Component", () => {
|
|
|
242
242
|
});
|
|
243
243
|
|
|
244
244
|
it("supports keyboard navigation", () => {
|
|
245
|
-
const handleClick =
|
|
245
|
+
const handleClick = vi.fn();
|
|
246
246
|
|
|
247
247
|
render(
|
|
248
248
|
<Link href="/" onClick={handleClick} data-testid="link">
|
|
@@ -240,6 +240,40 @@ export default class Megamenu {
|
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
isInMobilePanel(element: HTMLElement | null) {
|
|
244
|
+
return Boolean(
|
|
245
|
+
element && this.mobilePanels.some((panel) => panel.contains(element)),
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
getFocusRestoreTarget() {
|
|
250
|
+
const lastFocused = this.lastFocusedElement;
|
|
251
|
+
if (
|
|
252
|
+
lastFocused &&
|
|
253
|
+
lastFocused.isConnected &&
|
|
254
|
+
!this.isInMobilePanel(lastFocused)
|
|
255
|
+
) {
|
|
256
|
+
return lastFocused;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const target = this.activeMobileTarget;
|
|
260
|
+
if (target) {
|
|
261
|
+
const matchingTrigger = this.mobileMenuButtons.find(
|
|
262
|
+
(button) =>
|
|
263
|
+
this.getTargetFromElement(button) === target &&
|
|
264
|
+
!this.isInMobilePanel(button),
|
|
265
|
+
);
|
|
266
|
+
if (matchingTrigger) {
|
|
267
|
+
return matchingTrigger;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return (
|
|
272
|
+
this.mobileMenuButtons.find((button) => !this.isInMobilePanel(button)) ||
|
|
273
|
+
null
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
243
277
|
setMobilePanelState(panel: HTMLElement, isOpen: boolean) {
|
|
244
278
|
panel.classList.toggle(this.config.activeClass, isOpen);
|
|
245
279
|
panel.setAttribute("aria-hidden", isOpen ? "false" : "true");
|
|
@@ -448,14 +482,26 @@ export default class Megamenu {
|
|
|
448
482
|
return;
|
|
449
483
|
}
|
|
450
484
|
|
|
485
|
+
// Store the element that opened the menu for focus restoration
|
|
486
|
+
// BEFORE changing panel states, so activeElement is captured correctly.
|
|
487
|
+
this.lastFocusedElement =
|
|
488
|
+
source || (document.activeElement as HTMLElement | null);
|
|
489
|
+
|
|
490
|
+
// Move focus out of any panel about to be hidden to prevent
|
|
491
|
+
// the browser from blocking aria-hidden on a focused descendant.
|
|
492
|
+
const focused = document.activeElement as HTMLElement | null;
|
|
493
|
+
if (
|
|
494
|
+
focused &&
|
|
495
|
+
focused !== panel &&
|
|
496
|
+
this.mobilePanels.some((p) => p !== panel && p.contains(focused))
|
|
497
|
+
) {
|
|
498
|
+
focused.blur();
|
|
499
|
+
}
|
|
500
|
+
|
|
451
501
|
// Keep one side panel active at a time.
|
|
452
502
|
this.mobilePanels.forEach((mobilePanel) => {
|
|
453
503
|
this.setMobilePanelState(mobilePanel, mobilePanel === panel);
|
|
454
504
|
});
|
|
455
|
-
|
|
456
|
-
// Store the element that opened the menu for focus restoration.
|
|
457
|
-
this.lastFocusedElement =
|
|
458
|
-
source || (document.activeElement as HTMLElement | null);
|
|
459
505
|
this.activeMobilePanel = panel;
|
|
460
506
|
this.activeMobileTarget = target;
|
|
461
507
|
this.syncMobileButtonState();
|
|
@@ -479,6 +525,15 @@ export default class Megamenu {
|
|
|
479
525
|
return;
|
|
480
526
|
}
|
|
481
527
|
|
|
528
|
+
// Move focus out of the panel BEFORE setting aria-hidden to prevent
|
|
529
|
+
// the browser from blocking aria-hidden on a focused descendant.
|
|
530
|
+
const restoreTarget = this.getFocusRestoreTarget();
|
|
531
|
+
if (restoreTarget) {
|
|
532
|
+
restoreTarget.focus();
|
|
533
|
+
} else {
|
|
534
|
+
(document.activeElement as HTMLElement | null)?.blur?.();
|
|
535
|
+
}
|
|
536
|
+
|
|
482
537
|
this.mobilePanels.forEach((panel) => {
|
|
483
538
|
this.setMobilePanelState(panel, false);
|
|
484
539
|
});
|
|
@@ -487,10 +542,6 @@ export default class Megamenu {
|
|
|
487
542
|
this.closeAllAccordions();
|
|
488
543
|
this.removeFocusTrap();
|
|
489
544
|
|
|
490
|
-
if (this.isKeyboardUser && this.lastFocusedElement) {
|
|
491
|
-
this.lastFocusedElement.focus();
|
|
492
|
-
}
|
|
493
|
-
|
|
494
545
|
this.activeMobilePanel = null;
|
|
495
546
|
this.activeMobileTarget = null;
|
|
496
547
|
this.lastFocusedElement = null;
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
CLASS_NAV_BUTTON,
|
|
14
14
|
CLASS_NAV_DROPDOWN,
|
|
15
15
|
CLASS_NAV_ICON,
|
|
16
|
+
CLASS_NAV_ICON_NO_GAP_MD_DOWN,
|
|
16
17
|
CLASS_NAV_ITEM,
|
|
17
18
|
CLASS_NAV_VERTICAL,
|
|
18
19
|
CLASS_NAV_ITEM_MAIN,
|
|
@@ -158,7 +159,10 @@ export const MegamenuBlog = ({
|
|
|
158
159
|
width={24}
|
|
159
160
|
height={24}
|
|
160
161
|
name="user"
|
|
161
|
-
className={
|
|
162
|
+
className={cx(
|
|
163
|
+
CLASS_NAV_ICON,
|
|
164
|
+
CLASS_NAV_ICON_NO_GAP_MD_DOWN,
|
|
165
|
+
)}
|
|
162
166
|
aria-hidden="true"
|
|
163
167
|
/>
|
|
164
168
|
<span className={CLASS_HIDE_MD_DOWN}>Môj Orange</span>
|
|
@@ -2,12 +2,14 @@ import cx from "classnames";
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
CLASS_INPUT,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
CLASS_INPUT_WRAPPER,
|
|
6
|
+
CLASS_INPUT_WRAPPER_SEARCH_RESPONSIVE,
|
|
7
|
+
CLASS_INPUT_WRAPPER_SEARCH_ICON_WITH_PLACEHOLDER,
|
|
7
8
|
CLASS_LIST_INLINE,
|
|
8
9
|
CLASS_SUBNAV,
|
|
9
10
|
CLASS_SUBNAV_ITEM,
|
|
10
11
|
CLASS_TAG,
|
|
12
|
+
CLASS_CAPTION,
|
|
11
13
|
} from "./constants";
|
|
12
14
|
import { searchResultItems, searchTerms } from "./data";
|
|
13
15
|
|
|
@@ -34,22 +36,26 @@ export const MegamenuSearchContent = ({
|
|
|
34
36
|
{inputLabel}
|
|
35
37
|
</label>
|
|
36
38
|
|
|
37
|
-
<
|
|
39
|
+
<span
|
|
38
40
|
className={cx(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
CLASS_INPUT_WRAPPER,
|
|
42
|
+
CLASS_INPUT_WRAPPER_SEARCH_RESPONSIVE,
|
|
43
|
+
CLASS_INPUT_WRAPPER_SEARCH_ICON_WITH_PLACEHOLDER,
|
|
42
44
|
)}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
>
|
|
46
|
+
<input
|
|
47
|
+
className={CLASS_INPUT}
|
|
48
|
+
id={inputId}
|
|
49
|
+
type="text"
|
|
50
|
+
placeholder="Hľadať"
|
|
51
|
+
name="search"
|
|
52
|
+
defaultValue={searchValue}
|
|
53
|
+
/>
|
|
54
|
+
</span>
|
|
49
55
|
|
|
50
56
|
{hasSearchEmpty ? (
|
|
51
57
|
<>
|
|
52
|
-
<p>Najhľadanejši výrazy</p>
|
|
58
|
+
<p className={CLASS_CAPTION}>Najhľadanejši výrazy</p>
|
|
53
59
|
<ul className={CLASS_LIST_INLINE}>
|
|
54
60
|
{searchTerms.map((item) => (
|
|
55
61
|
<li key={item}>
|
|
@@ -64,7 +70,9 @@ export const MegamenuSearchContent = ({
|
|
|
64
70
|
<ul className={CLASS_SUBNAV}>
|
|
65
71
|
{searchResultItems.map((item) => (
|
|
66
72
|
<li key={item} className={CLASS_SUBNAV_ITEM}>
|
|
67
|
-
<a href="#">
|
|
73
|
+
<a href="#" className="no-underline">
|
|
74
|
+
{item}
|
|
75
|
+
</a>
|
|
68
76
|
</li>
|
|
69
77
|
))}
|
|
70
78
|
</ul>
|
|
@@ -19,6 +19,7 @@ export const CLASS_NAV_LINK_NO_LINE = `${CLASS_ROOT}__nav-link--no-line`;
|
|
|
19
19
|
export const CLASS_NAV_CART_ICON = `${CLASS_ROOT}__nav-cart-icon`;
|
|
20
20
|
export const CLASS_NAV_SPACER = `${CLASS_ROOT}__nav-spacer`;
|
|
21
21
|
export const CLASS_NAV_ICON = `${CLASS_ROOT}__nav-icon`;
|
|
22
|
+
export const CLASS_NAV_ICON_NO_GAP_MD_DOWN = `${CLASS_NAV_ICON}--no-gap-md-down`;
|
|
22
23
|
export const CLASS_NAV_LOGO = `${CLASS_ROOT}__nav-logo`;
|
|
23
24
|
export const CLASS_NAV_BUTTON = `${CLASS_ROOT}__nav-button`;
|
|
24
25
|
export const CLASS_NAV_BUTTON_INDICATOR = `${CLASS_ROOT}__nav-button--indicator`;
|
|
@@ -60,6 +61,9 @@ export const CLASS_ACCORDION_ICON = `${CLASS_ROOT}__accordion-icon`;
|
|
|
60
61
|
export const CLASS_ACCORDION_BODY = `${CLASS_ROOT}__accordion-body`;
|
|
61
62
|
|
|
62
63
|
export const CLASS_INPUT = `${CLASS_ROOT}__input`;
|
|
64
|
+
export const CLASS_INPUT_WRAPPER = `${CLASS_ROOT}__input-wrapper`;
|
|
65
|
+
export const CLASS_INPUT_WRAPPER_SEARCH_ICON_WITH_PLACEHOLDER = `${CLASS_ROOT}__input-wrapper--search-icon-with-placeholder`;
|
|
66
|
+
export const CLASS_INPUT_WRAPPER_SEARCH_RESPONSIVE = `${CLASS_ROOT}__input-wrapper--search-responsive`;
|
|
63
67
|
export const CLASS_INPUT_SEARCH_ICON_WITH_PLACEHOLDER = `${CLASS_ROOT}__input--search-icon-with-placeholder`;
|
|
64
68
|
export const CLASS_INPUT_SEARCH_RESPONSIVE = `${CLASS_ROOT}__input--search-responsive`;
|
|
65
69
|
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
margin-top: 0 !important;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
.no-underline {
|
|
40
|
+
text-decoration: none !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
ul {
|
|
40
44
|
@include typography.list-unstyled();
|
|
41
45
|
margin-bottom: convert.to-rem(30px);
|
|
@@ -441,6 +445,12 @@
|
|
|
441
445
|
margin-right: convert.to-rem(5px);
|
|
442
446
|
}
|
|
443
447
|
|
|
448
|
+
@mixin nav-icon-no-gap-md-down {
|
|
449
|
+
@include breakpoint.get("md", "down") {
|
|
450
|
+
margin-right: 0;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
444
454
|
@mixin nav-spacer {
|
|
445
455
|
display: flex;
|
|
446
456
|
flex: 1 0 1px;
|
|
@@ -458,7 +468,7 @@
|
|
|
458
468
|
@mixin subnav-item {
|
|
459
469
|
display: flex;
|
|
460
470
|
gap: convert.to-rem(10px);
|
|
461
|
-
margin-bottom: convert.to-rem(
|
|
471
|
+
margin-bottom: convert.to-rem(10px) !important;
|
|
462
472
|
|
|
463
473
|
&:last-child {
|
|
464
474
|
margin-bottom: 0 !important;
|
|
@@ -633,8 +643,16 @@
|
|
|
633
643
|
margin-bottom: convert.to-rem(40px);
|
|
634
644
|
text-decoration: none !important;
|
|
635
645
|
|
|
646
|
+
&:hover {
|
|
647
|
+
color: var(--color-text-inverse) !important;
|
|
648
|
+
background-color: var(--color-fill-contrast) !important;
|
|
649
|
+
border-color: transparent !important;
|
|
650
|
+
}
|
|
651
|
+
|
|
636
652
|
&:active {
|
|
637
|
-
color: color
|
|
653
|
+
color: var(--color-fill-contrast) !important;
|
|
654
|
+
background-color: transparent !important;
|
|
655
|
+
border-color: var(--color-border-contrast) !important;
|
|
638
656
|
}
|
|
639
657
|
}
|
|
640
658
|
|
|
@@ -876,9 +894,36 @@
|
|
|
876
894
|
@include input.width($width);
|
|
877
895
|
}
|
|
878
896
|
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
@mixin input-wrapper {
|
|
900
|
+
position: relative;
|
|
901
|
+
display: inline-block;
|
|
902
|
+
width: 100%;
|
|
903
|
+
margin-bottom: convert.to-rem(30px);
|
|
879
904
|
|
|
880
905
|
&--search-icon-with-placeholder {
|
|
881
|
-
|
|
906
|
+
isolation: isolate;
|
|
907
|
+
|
|
908
|
+
&::before {
|
|
909
|
+
content: "";
|
|
910
|
+
position: absolute;
|
|
911
|
+
top: 50%;
|
|
912
|
+
left: convert.to-rem(8px);
|
|
913
|
+
width: convert.to-rem(20px);
|
|
914
|
+
height: convert.to-rem(20px);
|
|
915
|
+
transform: translateY(-50%);
|
|
916
|
+
background-image: inputConfig.$background-image-search-icon;
|
|
917
|
+
background-repeat: no-repeat;
|
|
918
|
+
pointer-events: none;
|
|
919
|
+
z-index: 2;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
#{config.$class-root}__input {
|
|
923
|
+
background-image: none !important;
|
|
924
|
+
padding-left: convert.to-rem(40px);
|
|
925
|
+
margin-bottom: 0;
|
|
926
|
+
}
|
|
882
927
|
}
|
|
883
928
|
|
|
884
929
|
&--search-responsive {
|
|
@@ -86,6 +86,10 @@
|
|
|
86
86
|
|
|
87
87
|
&-icon {
|
|
88
88
|
@include mixins.nav-icon;
|
|
89
|
+
|
|
90
|
+
&--no-gap-md-down {
|
|
91
|
+
@include mixins.nav-icon-no-gap-md-down;
|
|
92
|
+
}
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
&-spacer {
|
|
@@ -241,6 +245,10 @@
|
|
|
241
245
|
@include mixins.input;
|
|
242
246
|
}
|
|
243
247
|
|
|
248
|
+
&__input-wrapper {
|
|
249
|
+
@include mixins.input-wrapper;
|
|
250
|
+
}
|
|
251
|
+
|
|
244
252
|
&__tag {
|
|
245
253
|
@include mixins.tag;
|
|
246
254
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render, fireEvent } from "@testing-library/react";
|
|
3
|
-
import { axe } from
|
|
3
|
+
import { axe } from 'vitest-axe';
|
|
4
4
|
|
|
5
5
|
import { Button } from "../../Button";
|
|
6
6
|
import { Modal, ModalProductHeader } from "../";
|
|
@@ -40,7 +40,7 @@ it("is valid html", () => {
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
it("is accessible", async () => {
|
|
43
|
-
window.scrollTo =
|
|
43
|
+
window.scrollTo = vi.fn();
|
|
44
44
|
const { container } = render(example);
|
|
45
45
|
|
|
46
46
|
fireEvent.click(container.querySelector('[data-test-id="open-button"]'));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render, screen } from "@testing-library/react";
|
|
3
|
-
import { axe } from
|
|
3
|
+
import { axe } from 'vitest-axe';
|
|
4
4
|
import userEvent from "@testing-library/user-event";
|
|
5
5
|
|
|
6
6
|
import { PromoBanner } from "../";
|
|
@@ -18,7 +18,7 @@ import { PromoBanner } from "../";
|
|
|
18
18
|
* - Image element validation
|
|
19
19
|
*
|
|
20
20
|
* ♿ ACCESSIBILITY (A11y)
|
|
21
|
-
* - WCAG 2.1 compliance
|
|
21
|
+
* - WCAG 2.1 compliance checks
|
|
22
22
|
* - Proper use of semantic HTML elements
|
|
23
23
|
* - Image alt attributes
|
|
24
24
|
* - Interactive elements (buttons, links)
|
|
@@ -621,7 +621,7 @@ describe("PromoBanner Component Conformance Tests", () => {
|
|
|
621
621
|
describe("Integration Tests", () => {
|
|
622
622
|
it("works with interactive elements", async () => {
|
|
623
623
|
const user = userEvent.setup();
|
|
624
|
-
const handleClick =
|
|
624
|
+
const handleClick = vi.fn();
|
|
625
625
|
|
|
626
626
|
render(
|
|
627
627
|
<PromoBanner>
|
|
@@ -639,7 +639,7 @@ describe("PromoBanner Component Conformance Tests", () => {
|
|
|
639
639
|
|
|
640
640
|
it("handles form submission within banner", async () => {
|
|
641
641
|
const user = userEvent.setup();
|
|
642
|
-
const handleSubmit =
|
|
642
|
+
const handleSubmit = vi.fn((e) => e.preventDefault());
|
|
643
643
|
|
|
644
644
|
render(
|
|
645
645
|
<PromoBanner>
|
|
@@ -688,7 +688,7 @@ describe("PromoBanner Component Conformance Tests", () => {
|
|
|
688
688
|
|
|
689
689
|
it("works with keyboard navigation", async () => {
|
|
690
690
|
const user = userEvent.setup();
|
|
691
|
-
const handleClick =
|
|
691
|
+
const handleClick = vi.fn();
|
|
692
692
|
|
|
693
693
|
render(
|
|
694
694
|
<PromoBanner>
|
|
@@ -725,8 +725,8 @@ describe("PromoBanner Component Conformance Tests", () => {
|
|
|
725
725
|
|
|
726
726
|
it("handles event propagation correctly", async () => {
|
|
727
727
|
const user = userEvent.setup();
|
|
728
|
-
const bannerClick =
|
|
729
|
-
const buttonClick =
|
|
728
|
+
const bannerClick = vi.fn();
|
|
729
|
+
const buttonClick = vi.fn((e) => e.stopPropagation());
|
|
730
730
|
|
|
731
731
|
render(
|
|
732
732
|
<PromoBanner onClick={bannerClick}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render, screen } from "@testing-library/react";
|
|
3
|
-
import { axe } from
|
|
3
|
+
import { axe } from 'vitest-axe';
|
|
4
4
|
import userEvent from "@testing-library/user-event";
|
|
5
5
|
|
|
6
6
|
import { PromotionCard } from "../";
|
|
@@ -17,7 +17,7 @@ import { PromotionCard } from "../";
|
|
|
17
17
|
* - Card wrapper structure
|
|
18
18
|
*
|
|
19
19
|
* ♿ ACCESSIBILITY (A11y)
|
|
20
|
-
* - WCAG 2.1 compliance
|
|
20
|
+
* - WCAG 2.1 compliance checks
|
|
21
21
|
* - Proper use of semantic HTML elements
|
|
22
22
|
* - ARIA attributes and their validity
|
|
23
23
|
* - Interactive elements (buttons, links)
|
|
@@ -455,7 +455,7 @@ describe("PromotionCard Component Conformance Tests", () => {
|
|
|
455
455
|
describe("Integration Tests", () => {
|
|
456
456
|
it("works with interactive elements", async () => {
|
|
457
457
|
const user = userEvent.setup();
|
|
458
|
-
const handleClick =
|
|
458
|
+
const handleClick = vi.fn();
|
|
459
459
|
|
|
460
460
|
render(
|
|
461
461
|
<PromotionCard>
|
|
@@ -518,7 +518,7 @@ describe("PromotionCard Component Conformance Tests", () => {
|
|
|
518
518
|
|
|
519
519
|
it("works with Card integration for complex interactions", async () => {
|
|
520
520
|
const user = userEvent.setup();
|
|
521
|
-
const handleSubmit =
|
|
521
|
+
const handleSubmit = vi.fn((e) => e.preventDefault());
|
|
522
522
|
|
|
523
523
|
render(
|
|
524
524
|
<PromotionCard color="background-contrast">
|
|
@@ -338,7 +338,7 @@ describe("PromotionCard Component Unit Tests", () => {
|
|
|
338
338
|
});
|
|
339
339
|
|
|
340
340
|
it("passes through event handlers", () => {
|
|
341
|
-
const handleClick =
|
|
341
|
+
const handleClick = vi.fn();
|
|
342
342
|
const { getByTestId } = render(
|
|
343
343
|
<PromotionCard
|
|
344
344
|
data-testid="test-promotion-card"
|
package/src/components/Section/tests/{Section.conformance.test.js → Section.conformance.test.jsx}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render, screen } from "@testing-library/react";
|
|
3
|
-
import { axe } from
|
|
3
|
+
import { axe } from 'vitest-axe';
|
|
4
4
|
import userEvent from "@testing-library/user-event";
|
|
5
5
|
|
|
6
6
|
import { Section } from "../";
|
|
@@ -17,7 +17,7 @@ import { Section } from "../";
|
|
|
17
17
|
* - Container wrapper structure
|
|
18
18
|
*
|
|
19
19
|
* ♿ ACCESSIBILITY (A11y)
|
|
20
|
-
* - WCAG 2.1 compliance
|
|
20
|
+
* - WCAG 2.1 compliance checks
|
|
21
21
|
* - Proper use of semantic HTML tags
|
|
22
22
|
* - ARIA attributes and their validity
|
|
23
23
|
* - Interactive elements (buttons, inputs, selects)
|
|
@@ -450,7 +450,7 @@ describe("Section Conformance Tests", () => {
|
|
|
450
450
|
|
|
451
451
|
it("works with interactive components", async () => {
|
|
452
452
|
const user = userEvent.setup();
|
|
453
|
-
const handleClick =
|
|
453
|
+
const handleClick = vi.fn();
|
|
454
454
|
|
|
455
455
|
render(
|
|
456
456
|
<Section>
|
|
@@ -487,7 +487,7 @@ describe("Section Conformance Tests", () => {
|
|
|
487
487
|
|
|
488
488
|
it("works with Container wrapper for complex interactions", async () => {
|
|
489
489
|
const user = userEvent.setup();
|
|
490
|
-
const handleSubmit =
|
|
490
|
+
const handleSubmit = vi.fn((e) => {
|
|
491
491
|
e.preventDefault();
|
|
492
492
|
});
|
|
493
493
|
|
|
@@ -618,7 +618,7 @@ describe("Section Component Unit Tests", () => {
|
|
|
618
618
|
});
|
|
619
619
|
|
|
620
620
|
it("passes through event handlers", () => {
|
|
621
|
-
const handleClick =
|
|
621
|
+
const handleClick = vi.fn();
|
|
622
622
|
const { getByTestId } = render(
|
|
623
623
|
<Section data-testid="test-section" onClick={handleClick} />,
|
|
624
624
|
);
|