@orangesk/orange-design-system 2.0.0-beta.34 → 2.0.0-beta.35
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 +3 -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/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 +3 -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 +13 -12
- 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/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/tests/{Carousel.conformance.test.js → Carousel.conformance.test.jsx} +1 -1
- package/src/components/Carousel/tests/{Carousel.static.test.js → Carousel.static.test.jsx} +49 -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/MegamenuSearchContent.tsx +22 -14
- package/src/components/Megamenu/constants.ts +3 -0
- package/src/components/Megamenu/styles/mixins.scss +33 -2
- package/src/components/Megamenu/styles/style.scss +4 -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);
|
|
@@ -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
|
|
|
@@ -1,37 +1,40 @@
|
|
|
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
|
+
return {
|
|
12
|
+
slideNext: vi.fn(),
|
|
13
|
+
slidePrev: vi.fn(),
|
|
14
|
+
destroy: vi.fn(),
|
|
15
|
+
update: vi.fn(),
|
|
16
|
+
on: vi.fn(),
|
|
17
|
+
enable: vi.fn(),
|
|
18
|
+
disable: vi.fn(),
|
|
19
|
+
activeIndex: 0,
|
|
20
|
+
isBeginning: true,
|
|
21
|
+
isEnd: false,
|
|
22
|
+
slides: [{}, {}, {}],
|
|
23
|
+
params: {
|
|
24
|
+
slidesPerView: 1,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}),
|
|
26
28
|
}));
|
|
27
29
|
|
|
28
30
|
// Mock Swiper modules
|
|
29
|
-
|
|
31
|
+
vi.mock("swiper/modules", () => ({
|
|
30
32
|
Navigation: {},
|
|
31
33
|
Pagination: {},
|
|
32
34
|
Scrollbar: {},
|
|
33
35
|
A11y: {},
|
|
34
36
|
Keyboard: {},
|
|
37
|
+
Mousewheel: {},
|
|
35
38
|
}));
|
|
36
39
|
|
|
37
40
|
describe("Carousel Static - External Controls", () => {
|
|
@@ -41,17 +44,17 @@ describe("Carousel Static - External Controls", () => {
|
|
|
41
44
|
|
|
42
45
|
beforeEach(() => {
|
|
43
46
|
// Clear all mocks
|
|
44
|
-
|
|
47
|
+
vi.clearAllMocks();
|
|
45
48
|
|
|
46
49
|
// Create mock Swiper instance
|
|
47
50
|
mockSwiperInstance = {
|
|
48
|
-
slideNext:
|
|
49
|
-
slidePrev:
|
|
50
|
-
destroy:
|
|
51
|
-
update:
|
|
52
|
-
on:
|
|
53
|
-
enable:
|
|
54
|
-
disable:
|
|
51
|
+
slideNext: vi.fn(),
|
|
52
|
+
slidePrev: vi.fn(),
|
|
53
|
+
destroy: vi.fn(),
|
|
54
|
+
update: vi.fn(),
|
|
55
|
+
on: vi.fn(),
|
|
56
|
+
enable: vi.fn(),
|
|
57
|
+
disable: vi.fn(),
|
|
55
58
|
activeIndex: 0,
|
|
56
59
|
isBeginning: true,
|
|
57
60
|
isEnd: false,
|
|
@@ -61,7 +64,9 @@ describe("Carousel Static - External Controls", () => {
|
|
|
61
64
|
},
|
|
62
65
|
};
|
|
63
66
|
|
|
64
|
-
Swiper.mockImplementation(()
|
|
67
|
+
Swiper.mockImplementation(function () {
|
|
68
|
+
return mockSwiperInstance;
|
|
69
|
+
});
|
|
65
70
|
|
|
66
71
|
// Set up DOM
|
|
67
72
|
document.body.innerHTML = `
|
|
@@ -82,7 +87,7 @@ describe("Carousel Static - External Controls", () => {
|
|
|
82
87
|
carouselElement = document.querySelector(".carousel");
|
|
83
88
|
|
|
84
89
|
// Mock requestAnimationFrame to execute synchronously
|
|
85
|
-
global.requestAnimationFrame =
|
|
90
|
+
global.requestAnimationFrame = vi.fn((cb) => cb());
|
|
86
91
|
|
|
87
92
|
carouselInstance = new Carousel(carouselElement);
|
|
88
93
|
});
|
|
@@ -164,7 +169,7 @@ describe("Carousel Static - External Controls", () => {
|
|
|
164
169
|
it("should prevent default behavior on button click", () => {
|
|
165
170
|
const nextButton = document.getElementById("next-btn");
|
|
166
171
|
const mockEvent = new Event("click");
|
|
167
|
-
mockEvent.preventDefault =
|
|
172
|
+
mockEvent.preventDefault = vi.fn();
|
|
168
173
|
|
|
169
174
|
nextButton.dispatchEvent(mockEvent);
|
|
170
175
|
|
|
@@ -231,7 +236,7 @@ describe("Carousel Static - External Controls", () => {
|
|
|
231
236
|
});
|
|
232
237
|
|
|
233
238
|
it("should update controls state on slide change transition end", () => {
|
|
234
|
-
const updateStatesSpy =
|
|
239
|
+
const updateStatesSpy = vi.spyOn(
|
|
235
240
|
carouselInstance,
|
|
236
241
|
"updateExternalControlsState",
|
|
237
242
|
);
|
|
@@ -269,7 +274,7 @@ describe("Carousel Static - External Controls", () => {
|
|
|
269
274
|
carouselElement = document.querySelector(".carousel");
|
|
270
275
|
|
|
271
276
|
// Mock requestAnimationFrame to execute synchronously
|
|
272
|
-
global.requestAnimationFrame =
|
|
277
|
+
global.requestAnimationFrame = vi.fn((cb) => cb());
|
|
273
278
|
|
|
274
279
|
carouselInstance = new Carousel(carouselElement);
|
|
275
280
|
});
|
|
@@ -421,17 +426,17 @@ describe("Carousel Static - Auto-Disable Feature", () => {
|
|
|
421
426
|
let mockSwiperInstance;
|
|
422
427
|
|
|
423
428
|
beforeEach(() => {
|
|
424
|
-
|
|
429
|
+
vi.clearAllMocks();
|
|
425
430
|
|
|
426
431
|
// Create mock Swiper instance with slides array
|
|
427
432
|
mockSwiperInstance = {
|
|
428
|
-
slideNext:
|
|
429
|
-
slidePrev:
|
|
430
|
-
destroy:
|
|
431
|
-
update:
|
|
432
|
-
on:
|
|
433
|
-
enable:
|
|
434
|
-
disable:
|
|
433
|
+
slideNext: vi.fn(),
|
|
434
|
+
slidePrev: vi.fn(),
|
|
435
|
+
destroy: vi.fn(),
|
|
436
|
+
update: vi.fn(),
|
|
437
|
+
on: vi.fn(),
|
|
438
|
+
enable: vi.fn(),
|
|
439
|
+
disable: vi.fn(),
|
|
435
440
|
activeIndex: 0,
|
|
436
441
|
isBeginning: true,
|
|
437
442
|
isEnd: false,
|
|
@@ -441,7 +446,9 @@ describe("Carousel Static - Auto-Disable Feature", () => {
|
|
|
441
446
|
},
|
|
442
447
|
};
|
|
443
448
|
|
|
444
|
-
Swiper.mockImplementation(()
|
|
449
|
+
Swiper.mockImplementation(function () {
|
|
450
|
+
return mockSwiperInstance;
|
|
451
|
+
});
|
|
445
452
|
|
|
446
453
|
document.body.innerHTML = `
|
|
447
454
|
<div class="carousel" data-carousel-id="test-carousel" id="test-carousel">
|
|
@@ -457,7 +464,7 @@ describe("Carousel Static - Auto-Disable Feature", () => {
|
|
|
457
464
|
`;
|
|
458
465
|
|
|
459
466
|
carouselElement = document.querySelector(".carousel");
|
|
460
|
-
global.requestAnimationFrame =
|
|
467
|
+
global.requestAnimationFrame = vi.fn((cb) => cb());
|
|
461
468
|
});
|
|
462
469
|
|
|
463
470
|
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
|
});
|
|
@@ -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 { CarouselPromotions } from "..";
|
|
5
5
|
import { CarouselPromotionsItem } from "..";
|
|
@@ -21,10 +21,19 @@ const example = (
|
|
|
21
21
|
|
|
22
22
|
it("is valid html", () => {
|
|
23
23
|
const { container } = render(example);
|
|
24
|
-
expect(container).toHTMLValidate({
|
|
24
|
+
expect(container).toHTMLValidate({
|
|
25
|
+
rules: {
|
|
26
|
+
"no-inline-style": "off",
|
|
27
|
+
"aria-label-misuse": "off",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
25
30
|
});
|
|
26
31
|
|
|
27
32
|
it("is accessible", async () => {
|
|
28
33
|
const { container } = render(example);
|
|
29
|
-
expect(
|
|
34
|
+
expect(
|
|
35
|
+
await axe(container, {
|
|
36
|
+
rules: { "aria-required-children": { enabled: false } },
|
|
37
|
+
}),
|
|
38
|
+
).toHaveNoViolations();
|
|
30
39
|
});
|
|
@@ -178,15 +178,14 @@ describe("rendering CarouselPromotions", () => {
|
|
|
178
178
|
expect(pagination).toHaveAttribute("role", "tablist");
|
|
179
179
|
});
|
|
180
180
|
|
|
181
|
-
it("pagination container
|
|
181
|
+
it("pagination container includes rendered buttons", () => {
|
|
182
182
|
const { container } = render(
|
|
183
183
|
<CarouselPromotions>{items}</CarouselPromotions>,
|
|
184
184
|
);
|
|
185
|
-
// Pagination buttons are dynamically created by Swiper.js after initialization
|
|
186
185
|
const pagination = container.querySelector(
|
|
187
186
|
".carousel-promotions__pagination",
|
|
188
187
|
);
|
|
189
|
-
expect(pagination.children.length).
|
|
188
|
+
expect(pagination.children.length).toBeGreaterThan(0);
|
|
190
189
|
});
|
|
191
190
|
});
|
|
192
191
|
|
|
@@ -24,14 +24,10 @@
|
|
|
24
24
|
* - Verifies all standard HTML div props are properly forwarded
|
|
25
25
|
*/
|
|
26
26
|
import { render } from "@testing-library/react";
|
|
27
|
-
import { axe
|
|
28
|
-
import "jest-axe/extend-expect";
|
|
27
|
+
import { axe } from "vitest-axe";
|
|
29
28
|
|
|
30
29
|
import { Container } from "../";
|
|
31
30
|
|
|
32
|
-
// Extension of expect for axe
|
|
33
|
-
expect.extend(toHaveNoViolations);
|
|
34
|
-
|
|
35
31
|
describe("Container Conformance Tests", () => {
|
|
36
32
|
describe("HTML Validity", () => {
|
|
37
33
|
it("should render valid HTML structure", () => {
|
|
@@ -203,7 +199,7 @@ describe("Container Conformance Tests", () => {
|
|
|
203
199
|
});
|
|
204
200
|
|
|
205
201
|
it("should handle event handlers correctly", () => {
|
|
206
|
-
const handleClick =
|
|
202
|
+
const handleClick = vi.fn();
|
|
207
203
|
const { container } = render(<Container onClick={handleClick} />);
|
|
208
204
|
const containerElement = container.firstChild;
|
|
209
205
|
|
|
@@ -151,8 +151,8 @@ describe("Container Component", () => {
|
|
|
151
151
|
|
|
152
152
|
it("should forward event handlers", async () => {
|
|
153
153
|
const user = userEvent.setup();
|
|
154
|
-
const handleClick =
|
|
155
|
-
const handleMouseEnter =
|
|
154
|
+
const handleClick = vi.fn();
|
|
155
|
+
const handleMouseEnter = vi.fn();
|
|
156
156
|
|
|
157
157
|
render(
|
|
158
158
|
<Container
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render, screen, fireEvent } from "@testing-library/react";
|
|
3
3
|
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import "@testing-library/jest-dom";
|
|
4
|
+
import "@testing-library/jest-dom/vitest";
|
|
5
5
|
import { Controls } from "../Controls";
|
|
6
6
|
|
|
7
7
|
describe("Controls Component", () => {
|
|
@@ -97,7 +97,7 @@ describe("Controls Component", () => {
|
|
|
97
97
|
describe("Button Functionality", () => {
|
|
98
98
|
it("should be clickable and trigger onClick handler", () => {
|
|
99
99
|
// Test that the button can be clicked and triggers the onClick handler
|
|
100
|
-
const handleClick =
|
|
100
|
+
const handleClick = vi.fn();
|
|
101
101
|
render(<Controls icon="close" onClick={handleClick} />);
|
|
102
102
|
|
|
103
103
|
const button = screen.getByRole("button");
|
|
@@ -119,7 +119,7 @@ describe("Controls Component", () => {
|
|
|
119
119
|
it("should be keyboard accessible", async () => {
|
|
120
120
|
// Test that the button responds to keyboard events
|
|
121
121
|
const user = userEvent.setup();
|
|
122
|
-
const handleClick =
|
|
122
|
+
const handleClick = vi.fn();
|
|
123
123
|
render(<Controls icon="search" onClick={handleClick} />);
|
|
124
124
|
|
|
125
125
|
const button = screen.getByRole("button");
|
|
@@ -131,7 +131,7 @@ describe("Controls Component", () => {
|
|
|
131
131
|
it("should support Enter key press", async () => {
|
|
132
132
|
// Test that Enter key triggers the onClick handler
|
|
133
133
|
const user = userEvent.setup();
|
|
134
|
-
const handleClick =
|
|
134
|
+
const handleClick = vi.fn();
|
|
135
135
|
render(<Controls icon="close" onClick={handleClick} />);
|
|
136
136
|
|
|
137
137
|
const button = screen.getByRole("button");
|
|
@@ -144,7 +144,7 @@ describe("Controls Component", () => {
|
|
|
144
144
|
it("should support Space key press", async () => {
|
|
145
145
|
// Test that Space key triggers the onClick handler
|
|
146
146
|
const user = userEvent.setup();
|
|
147
|
-
const handleClick =
|
|
147
|
+
const handleClick = vi.fn();
|
|
148
148
|
render(<Controls icon="menu" onClick={handleClick} />);
|
|
149
149
|
|
|
150
150
|
const button = screen.getByRole("button");
|
|
@@ -175,7 +175,7 @@ describe("Controls Component", () => {
|
|
|
175
175
|
|
|
176
176
|
it("should not trigger onClick when disabled", () => {
|
|
177
177
|
// Test that onClick is not triggered when button is disabled
|
|
178
|
-
const handleClick =
|
|
178
|
+
const handleClick = vi.fn();
|
|
179
179
|
render(<Controls icon="search" isDisabled onClick={handleClick} />);
|
|
180
180
|
|
|
181
181
|
const button = screen.getByRole("button");
|
|
@@ -299,7 +299,7 @@ describe("Controls Component", () => {
|
|
|
299
299
|
describe("Form Integration", () => {
|
|
300
300
|
it("should work within a form context", () => {
|
|
301
301
|
// Test that the button works properly within a form
|
|
302
|
-
const handleSubmit =
|
|
302
|
+
const handleSubmit = vi.fn((e) => e.preventDefault());
|
|
303
303
|
|
|
304
304
|
render(
|
|
305
305
|
<form onSubmit={handleSubmit}>
|
|
@@ -326,7 +326,7 @@ describe("Controls Component", () => {
|
|
|
326
326
|
describe("Event Handling", () => {
|
|
327
327
|
it("should handle onFocus event", () => {
|
|
328
328
|
// Test that the button handles onFocus event
|
|
329
|
-
const handleFocus =
|
|
329
|
+
const handleFocus = vi.fn();
|
|
330
330
|
render(<Controls icon="close" onFocus={handleFocus} />);
|
|
331
331
|
|
|
332
332
|
const button = screen.getByRole("button");
|
|
@@ -337,7 +337,7 @@ describe("Controls Component", () => {
|
|
|
337
337
|
|
|
338
338
|
it("should handle onBlur event", () => {
|
|
339
339
|
// Test that the button handles onBlur event
|
|
340
|
-
const handleBlur =
|
|
340
|
+
const handleBlur = vi.fn();
|
|
341
341
|
render(<Controls icon="menu" onBlur={handleBlur} />);
|
|
342
342
|
|
|
343
343
|
const button = screen.getByRole("button");
|
|
@@ -348,7 +348,7 @@ describe("Controls Component", () => {
|
|
|
348
348
|
|
|
349
349
|
it("should handle onMouseEnter event", () => {
|
|
350
350
|
// Test that the button handles onMouseEnter event
|
|
351
|
-
const handleMouseEnter =
|
|
351
|
+
const handleMouseEnter = vi.fn();
|
|
352
352
|
render(<Controls icon="search" onMouseEnter={handleMouseEnter} />);
|
|
353
353
|
|
|
354
354
|
const button = screen.getByRole("button");
|
|
@@ -359,7 +359,7 @@ describe("Controls Component", () => {
|
|
|
359
359
|
|
|
360
360
|
it("should handle onMouseLeave event", () => {
|
|
361
361
|
// Test that the button handles onMouseLeave event
|
|
362
|
-
const handleMouseLeave =
|
|
362
|
+
const handleMouseLeave = vi.fn();
|
|
363
363
|
render(<Controls icon="close" onMouseLeave={handleMouseLeave} />);
|
|
364
364
|
|
|
365
365
|
const button = screen.getByRole("button");
|
|
@@ -370,7 +370,7 @@ describe("Controls Component", () => {
|
|
|
370
370
|
|
|
371
371
|
it("should handle onKeyDown event", () => {
|
|
372
372
|
// Test that the button handles onKeyDown event
|
|
373
|
-
const handleKeyDown =
|
|
373
|
+
const handleKeyDown = vi.fn();
|
|
374
374
|
render(<Controls icon="menu" onKeyDown={handleKeyDown} />);
|
|
375
375
|
|
|
376
376
|
const button = screen.getByRole("button");
|