@faststore/ui 2.0.2-alpha.0 → 2.0.4-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/assets/ShoppingCart.d.ts +2 -2
- package/dist/assets/ShoppingCart.js.map +1 -1
- package/dist/assets/X.d.ts +2 -2
- package/dist/assets/X.js.map +1 -1
- package/package.json +30 -37
- package/src/assets/ShoppingCart.tsx +50 -0
- package/src/assets/X.tsx +38 -0
- package/src/base/layout.scss +78 -0
- package/src/base/tokens.scss +274 -0
- package/src/base/typography.scss +64 -0
- package/src/components/atoms/Badge/Badge.stories.mdx +156 -0
- package/src/components/atoms/Badge/styles.scss +209 -0
- package/src/components/atoms/Button/Button.stories.mdx +110 -0
- package/src/components/atoms/Button/styles.scss +316 -0
- package/src/components/atoms/Checkbox/styles.scss +155 -0
- package/src/{atoms → components/atoms}/Incentive/Incentive.tsx +0 -0
- package/src/{atoms → components/atoms}/Incentive/index.tsx +0 -0
- package/src/{atoms → components/atoms}/Incentive/stories/Incentive.mdx +0 -0
- package/src/{atoms → components/atoms}/Incentive/stories/Incentive.stories.tsx +0 -0
- package/src/{atoms → components/atoms}/Incentive/stories/assets/Icons.tsx +0 -0
- package/src/{atoms → components/atoms}/Input/Input.tsx +0 -0
- package/src/{atoms → components/atoms}/Input/index.ts +0 -0
- package/src/{atoms → components/atoms}/Input/stories/Input.mdx +0 -0
- package/src/{atoms → components/atoms}/Input/stories/Input.stories.tsx +1 -1
- package/src/components/atoms/Label/Label.stories.mdx +65 -0
- package/src/{atoms → components/atoms}/Link/Link.tsx +1 -1
- package/src/{atoms → components/atoms}/Link/index.tsx +0 -0
- package/src/{atoms → components/atoms}/Link/stories/Link.mdx +0 -0
- package/src/{atoms → components/atoms}/Link/stories/Link.stories.tsx +0 -0
- package/src/{atoms → components/atoms}/List/List.tsx +0 -0
- package/src/{atoms → components/atoms}/List/index.ts +0 -0
- package/src/{atoms → components/atoms}/List/stories/List.mdx +0 -0
- package/src/{atoms → components/atoms}/List/stories/List.stories.tsx +1 -1
- package/src/{atoms → components/atoms}/Overlay/Overlay.tsx +0 -0
- package/src/{atoms → components/atoms}/Overlay/index.ts +0 -0
- package/src/{atoms → components/atoms}/Overlay/stories/Overlay.mdx +0 -0
- package/src/{atoms → components/atoms}/Overlay/stories/Overlay.stories.tsx +1 -1
- package/src/{atoms → components/atoms}/Popover/Popover.tsx +0 -0
- package/src/{atoms → components/atoms}/Popover/index.ts +0 -0
- package/src/{atoms → components/atoms}/Popover/stories/Popover.mdx +0 -0
- package/src/{atoms → components/atoms}/Popover/stories/Popover.stories.tsx +1 -1
- package/src/{atoms → components/atoms}/Price/Price.tsx +0 -0
- package/src/{atoms → components/atoms}/Price/index.ts +0 -0
- package/src/{atoms → components/atoms}/Price/stories/Price.mdx +0 -0
- package/src/{atoms → components/atoms}/Price/stories/Price.stories.tsx +1 -1
- package/src/components/atoms/Radio/Radio.stories.mdx +101 -0
- package/src/components/atoms/Radio/styles.scss +108 -0
- package/src/{atoms → components/atoms}/Select/Select.tsx +0 -0
- package/src/{atoms → components/atoms}/Select/index.ts +0 -0
- package/src/{atoms → components/atoms}/Select/stories/Select.mdx +0 -0
- package/src/{atoms → components/atoms}/Select/stories/Select.stories.tsx +1 -1
- package/src/{atoms → components/atoms}/Skeleton/Skeleton.tsx +0 -0
- package/src/{atoms → components/atoms}/Skeleton/index.ts +0 -0
- package/src/{atoms → components/atoms}/Skeleton/stories/Skeleton.mdx +0 -0
- package/src/{atoms → components/atoms}/Skeleton/stories/Skeleton.stories.tsx +0 -0
- package/src/{atoms → components/atoms}/Slider/Slider.tsx +0 -0
- package/src/{atoms → components/atoms}/Slider/index.ts +0 -0
- package/src/{atoms → components/atoms}/Slider/stories/Slider.mdx +0 -0
- package/src/{atoms → components/atoms}/Slider/stories/Slider.stories.tsx +1 -1
- package/src/{atoms → components/atoms}/Spinner/Spinner.tsx +0 -0
- package/src/{atoms → components/atoms}/Spinner/index.tsx +0 -0
- package/src/{atoms → components/atoms}/Spinner/stories/Spinner.mdx +0 -0
- package/src/{atoms → components/atoms}/Spinner/stories/Spinner.stories.tsx +0 -0
- package/src/{atoms → components/atoms}/TextArea/TextArea.tsx +0 -0
- package/src/{atoms → components/atoms}/TextArea/index.ts +0 -0
- package/src/{atoms → components/atoms}/TextArea/stories/TextArea.mdx +0 -0
- package/src/{atoms → components/atoms}/TextArea/stories/TextArea.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/Accordion/Accordion.tsx +0 -0
- package/src/{molecules → components/molecules}/Accordion/AccordionButton.tsx +4 -4
- package/src/{molecules → components/molecules}/Accordion/AccordionItem.tsx +1 -1
- package/src/{molecules → components/molecules}/Accordion/AccordionPanel.tsx +0 -0
- package/src/{molecules → components/molecules}/Accordion/index.ts +0 -0
- package/src/{molecules → components/molecules}/Accordion/stories/Accordion.mdx +0 -0
- package/src/{molecules → components/molecules}/Accordion/stories/Accordion.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/AggregateRating/AggregateRating.tsx +0 -0
- package/src/{molecules → components/molecules}/AggregateRating/index.ts +0 -0
- package/src/{molecules → components/molecules}/AggregateRating/stories/AggregateRating.mdx +0 -0
- package/src/{molecules → components/molecules}/AggregateRating/stories/AggregateRating.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/Alert/Alert.tsx +0 -0
- package/src/{molecules → components/molecules}/Alert/index.ts +0 -0
- package/src/{molecules → components/molecules}/Alert/stories/Alert.mdx +0 -0
- package/src/{molecules → components/molecules}/Alert/stories/Alert.stories.tsx +3 -3
- package/src/{molecules → components/molecules}/Banner/Banner.tsx +0 -0
- package/src/{molecules → components/molecules}/Banner/BannerContent.tsx +0 -0
- package/src/{molecules → components/molecules}/Banner/BannerImage.tsx +0 -0
- package/src/{molecules → components/molecules}/Banner/BannerLink.tsx +0 -0
- package/src/{molecules → components/molecules}/Banner/index.ts +0 -0
- package/src/{molecules → components/molecules}/Banner/stories/Banner.mdx +0 -0
- package/src/{molecules → components/molecules}/Banner/stories/Banner.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/Breadcrumb/Breadcrumb.tsx +0 -0
- package/src/{molecules → components/molecules}/Breadcrumb/index.ts +0 -0
- package/src/{molecules → components/molecules}/Breadcrumb/stories/Breadcrumb.mdx +0 -0
- package/src/{molecules → components/molecules}/Breadcrumb/stories/Breadcrumb.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/Bullets/Bullets.tsx +1 -1
- package/src/{molecules → components/molecules}/Bullets/index.ts +0 -0
- package/src/{molecules → components/molecules}/Bullets/stories/Bullets.mdx +0 -0
- package/src/{molecules → components/molecules}/Bullets/stories/Bullets.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/Card/Card.tsx +0 -0
- package/src/{molecules → components/molecules}/Card/CardActions.tsx +0 -0
- package/src/{molecules → components/molecules}/Card/CardContent.tsx +0 -0
- package/src/{molecules → components/molecules}/Card/CardImage.tsx +0 -0
- package/src/{molecules → components/molecules}/Card/index.tsx +0 -0
- package/src/{molecules → components/molecules}/Card/stories/Card.mdx +0 -0
- package/src/{molecules → components/molecules}/Card/stories/Card.stories.tsx +5 -5
- package/src/{molecules → components/molecules}/Carousel/Arrows.tsx +0 -0
- package/src/{molecules → components/molecules}/Carousel/Carousel.tsx +2 -2
- package/src/{molecules → components/molecules}/Carousel/CarouselItem.tsx +1 -1
- package/src/{molecules → components/molecules}/Carousel/hooks/useSlideVisibility.ts +0 -0
- package/src/{molecules → components/molecules}/Carousel/index.ts +0 -0
- package/src/{molecules → components/molecules}/Carousel/stories/Carousel.mdx +0 -0
- package/src/{molecules → components/molecules}/Carousel/stories/Carousel.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/CartItem/CartItem.tsx +0 -0
- package/src/{molecules → components/molecules}/CartItem/CartItemActions.tsx +0 -0
- package/src/{molecules → components/molecules}/CartItem/CartItemContent.tsx +0 -0
- package/src/{molecules → components/molecules}/CartItem/CartItemImage.tsx +0 -0
- package/src/{molecules → components/molecules}/CartItem/CartItemPrices.tsx +0 -0
- package/src/{molecules → components/molecules}/CartItem/CartItemSummary.tsx +0 -0
- package/src/{molecules → components/molecules}/CartItem/CartItemTitle.tsx +0 -0
- package/src/{molecules → components/molecules}/CartItem/index.tsx +0 -0
- package/src/{molecules → components/molecules}/CartItem/stories/CartItem.mdx +0 -0
- package/src/{molecules → components/molecules}/CartItem/stories/CartItem.stories.tsx +1 -1
- package/src/components/molecules/CheckboxField/CheckboxField.stories.mdx +38 -0
- package/src/components/molecules/CheckboxField/styles.scss +12 -0
- package/src/{molecules → components/molecules}/Dropdown/Dropdown.tsx +0 -0
- package/src/{molecules → components/molecules}/Dropdown/DropdownButton.tsx +0 -0
- package/src/{molecules → components/molecules}/Dropdown/DropdownItem.tsx +0 -0
- package/src/{molecules → components/molecules}/Dropdown/DropdownMenu.tsx +0 -0
- package/src/{molecules → components/molecules}/Dropdown/contexts/DropdownContext.ts +0 -0
- package/src/{molecules → components/molecules}/Dropdown/hooks/useDropdown.ts +0 -0
- package/src/{molecules → components/molecules}/Dropdown/hooks/useDropdownPosition.ts +0 -0
- package/src/{molecules → components/molecules}/Dropdown/index.ts +0 -0
- package/src/{molecules → components/molecules}/Dropdown/stories/Dropdown.mdx +0 -0
- package/src/{molecules → components/molecules}/Dropdown/stories/Dropdown.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/Dropdown/stories/assets/Caret.tsx +0 -0
- package/src/{molecules → components/molecules}/Form/Form.tsx +0 -0
- package/src/{molecules → components/molecules}/Form/index.ts +0 -0
- package/src/{molecules → components/molecules}/Form/stories/Form.mdx +0 -0
- package/src/{molecules → components/molecules}/Form/stories/Form.stories.tsx +2 -1
- package/src/{molecules → components/molecules}/Gift/Gift.tsx +2 -3
- package/src/{molecules → components/molecules}/Gift/GiftContent.tsx +0 -0
- package/src/{molecules → components/molecules}/Gift/GiftImage.tsx +0 -0
- package/src/{molecules → components/molecules}/Gift/index.tsx +0 -0
- package/src/{molecules → components/molecules}/Gift/stories/Gift.mdx +0 -0
- package/src/{molecules → components/molecules}/Gift/stories/Gift.stories.tsx +1 -1
- package/src/components/molecules/IconButton/IconButton.stories.mdx +47 -0
- package/src/{molecules → components/molecules}/LoadingButton/LoadingButton.tsx +3 -8
- package/src/{molecules → components/molecules}/LoadingButton/index.tsx +0 -0
- package/src/{molecules → components/molecules}/LoadingButton/stories/LoadingButton.mdx +0 -0
- package/src/{molecules → components/molecules}/LoadingButton/stories/LoadingButton.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/Modal/Modal.tsx +0 -0
- package/src/{molecules → components/molecules}/Modal/ModalContent.tsx +0 -0
- package/src/{molecules → components/molecules}/Modal/index.tsx +0 -0
- package/src/{molecules → components/molecules}/Modal/stories/Modal.mdx +0 -0
- package/src/{molecules → components/molecules}/Modal/stories/Modal.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/Modal/useTrapFocus.ts +0 -0
- package/src/{molecules → components/molecules}/OrderSummary/OrderSummary.tsx +0 -0
- package/src/{molecules → components/molecules}/OrderSummary/index.tsx +0 -0
- package/src/{molecules → components/molecules}/OrderSummary/stories/OrderSummary.mdx +0 -0
- package/src/{molecules → components/molecules}/OrderSummary/stories/OrderSummary.stories.tsx +0 -0
- package/src/{molecules → components/molecules}/PaymentMethods/PaymentMethods.tsx +0 -0
- package/src/{molecules → components/molecules}/PaymentMethods/index.tsx +0 -0
- package/src/{molecules → components/molecules}/PaymentMethods/stories/PaymentMethods.mdx +0 -0
- package/src/{molecules → components/molecules}/PaymentMethods/stories/PaymentMethods.stories.tsx +0 -0
- package/src/{molecules → components/molecules}/PaymentMethods/stories/assets/Icons.tsx +0 -0
- package/src/{molecules → components/molecules}/PriceRange/PriceRange.tsx +0 -0
- package/src/{molecules → components/molecules}/PriceRange/index.ts +0 -0
- package/src/{molecules → components/molecules}/PriceRange/stories/PriceRange.mdx +0 -0
- package/src/{molecules → components/molecules}/PriceRange/stories/PriceRange.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/ProductCard/ProductCard.tsx +0 -0
- package/src/{molecules → components/molecules}/ProductCard/ProductCardActions.tsx +0 -0
- package/src/{molecules → components/molecules}/ProductCard/ProductCardContent.tsx +0 -0
- package/src/{molecules → components/molecules}/ProductCard/ProductCardImage.tsx +0 -0
- package/src/{molecules → components/molecules}/ProductCard/index.tsx +0 -0
- package/src/{molecules → components/molecules}/ProductCard/stories/ProductCard.mdx +0 -0
- package/src/{molecules → components/molecules}/ProductCard/stories/ProductCard.stories.tsx +1 -2
- package/src/{molecules → components/molecules}/ProductTitle/ProductTitle.tsx +0 -0
- package/src/{molecules → components/molecules}/ProductTitle/index.tsx +0 -0
- package/src/{molecules → components/molecules}/ProductTitle/stories/ProductTitle.mdx +0 -0
- package/src/{molecules → components/molecules}/ProductTitle/stories/ProductTitle.stories.tsx +3 -3
- package/src/{molecules → components/molecules}/QuantitySelector/QuantitySelector.tsx +2 -2
- package/src/{molecules → components/molecules}/QuantitySelector/index.ts +0 -0
- package/src/{molecules → components/molecules}/QuantitySelector/stories/QuantitySelector.mdx +0 -0
- package/src/{molecules → components/molecules}/QuantitySelector/stories/QuantitySelector.stories.tsx +0 -0
- package/src/{molecules → components/molecules}/QuantitySelector/stories/assets/Icons.tsx +0 -0
- package/src/components/molecules/RadioField/RadioField.stories.mdx +38 -0
- package/src/components/molecules/RadioField/styles.scss +12 -0
- package/src/{molecules → components/molecules}/RadioGroup/RadioGroup.tsx +0 -0
- package/src/{molecules → components/molecules}/RadioGroup/RadioOption.tsx +1 -1
- package/src/{molecules → components/molecules}/RadioGroup/index.tsx +0 -0
- package/src/{molecules → components/molecules}/RadioGroup/stories/RadioGroup.mdx +0 -0
- package/src/{molecules → components/molecules}/RadioGroup/stories/RadioGroup.stories.tsx +0 -0
- package/src/{molecules → components/molecules}/RadioGroup/useRadioGroup.ts +0 -0
- package/src/{molecules → components/molecules}/SearchInput/SearchInput.tsx +2 -3
- package/src/{molecules → components/molecules}/SearchInput/index.ts +0 -0
- package/src/{molecules → components/molecules}/SearchInput/stories/SearchInput.mdx +0 -0
- package/src/{molecules → components/molecules}/SearchInput/stories/SearchInput.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/SearchInput/stories/assets/CustomIcon.tsx +0 -0
- package/src/{molecules → components/molecules}/SkuSelector/SkuSelector.tsx +3 -2
- package/src/{molecules → components/molecules}/SkuSelector/index.tsx +0 -0
- package/src/{molecules → components/molecules}/SkuSelector/stories/SkuSelector.mdx +0 -0
- package/src/{molecules → components/molecules}/SkuSelector/stories/SkuSelector.stories.tsx +1 -1
- package/src/{molecules → components/molecules}/Table/Table.tsx +0 -0
- package/src/{molecules → components/molecules}/Table/TableBody.tsx +0 -0
- package/src/{molecules → components/molecules}/Table/TableCell.tsx +0 -0
- package/src/{molecules → components/molecules}/Table/TableFooter.tsx +0 -0
- package/src/{molecules → components/molecules}/Table/TableHead.tsx +0 -0
- package/src/{molecules → components/molecules}/Table/TableRow.tsx +0 -0
- package/src/{molecules → components/molecules}/Table/index.ts +0 -0
- package/src/{molecules → components/molecules}/Table/stories/Table.mdx +0 -0
- package/src/{molecules → components/molecules}/Table/stories/Table.stories.tsx +0 -0
- package/src/components/molecules/Tag/Tag.stories.mdx +31 -0
- package/src/components/molecules/Tag/styles.scss +99 -0
- package/src/{organisms → components/organisms}/Hero/Hero.tsx +0 -0
- package/src/{organisms → components/organisms}/Hero/HeroHeading.tsx +0 -0
- package/src/{organisms → components/organisms}/Hero/HeroImage.tsx +0 -0
- package/src/{organisms → components/organisms}/Hero/index.tsx +0 -0
- package/src/{organisms → components/organisms}/Hero/stories/Hero.mdx +0 -0
- package/src/{organisms → components/organisms}/Hero/stories/Hero.stories.tsx +1 -1
- package/src/{organisms → components/organisms}/OutOfStock/OutOfStock.tsx +0 -0
- package/src/{organisms → components/organisms}/OutOfStock/OutOfStockMessage.tsx +0 -0
- package/src/{organisms → components/organisms}/OutOfStock/OutOfStockTitle.tsx +0 -0
- package/src/{organisms → components/organisms}/OutOfStock/index.tsx +0 -0
- package/src/{organisms → components/organisms}/OutOfStock/stories/OutOfStock.mdx +0 -0
- package/src/{organisms → components/organisms}/OutOfStock/stories/OutOfStock.stories.tsx +1 -1
- package/src/{organisms → components/organisms}/Tiles/Tile.tsx +0 -0
- package/src/{organisms → components/organisms}/Tiles/Tiles.tsx +0 -0
- package/src/{organisms → components/organisms}/Tiles/index.ts +0 -0
- package/src/{organisms → components/organisms}/Tiles/stories/Tiles.mdx +0 -0
- package/src/{organisms → components/organisms}/Tiles/stories/Tiles.stories.tsx +0 -0
- package/src/index.ts +97 -99
- package/src/styles/base.scss +3 -0
- package/src/styles/components.scss +10 -0
- package/src/styles/global.scss +4 -0
- package/src/styles/reset.scss +54 -0
- package/src/styles/utilities.scss +75 -0
- package/src/typings/utils.d.ts +2 -2
- package/dist/assets/index.d.ts +0 -2
- package/dist/assets/index.js +0 -3
- package/dist/assets/index.js.map +0 -1
- package/src/atoms/Badge/Badge.test.tsx +0 -23
- package/src/atoms/Badge/Badge.tsx +0 -23
- package/src/atoms/Badge/index.ts +0 -2
- package/src/atoms/Badge/stories/Badge.mdx +0 -18
- package/src/atoms/Badge/stories/Badge.stories.tsx +0 -37
- package/src/atoms/Button/Button.test.tsx +0 -12
- package/src/atoms/Button/Button.tsx +0 -23
- package/src/atoms/Button/index.ts +0 -2
- package/src/atoms/Button/stories/Button.mdx +0 -18
- package/src/atoms/Button/stories/Button.stories.tsx +0 -36
- package/src/atoms/Checkbox/Checkbox.test.tsx +0 -65
- package/src/atoms/Checkbox/Checkbox.tsx +0 -27
- package/src/atoms/Checkbox/index.ts +0 -2
- package/src/atoms/Checkbox/stories/Checkbox.mdx +0 -18
- package/src/atoms/Checkbox/stories/Checkbox.stories.tsx +0 -65
- package/src/atoms/Icon/Icon.test.tsx +0 -43
- package/src/atoms/Icon/Icon.tsx +0 -26
- package/src/atoms/Icon/index.ts +0 -2
- package/src/atoms/Icon/stories/Icon.mdx +0 -18
- package/src/atoms/Icon/stories/Icon.stories.tsx +0 -40
- package/src/atoms/Icon/stories/assets/ShoppingCart.tsx +0 -23
- package/src/atoms/Incentive/Incentive.test.tsx +0 -36
- package/src/atoms/Input/Input.test.tsx +0 -73
- package/src/atoms/Label/Label.test.tsx +0 -71
- package/src/atoms/Label/Label.tsx +0 -22
- package/src/atoms/Label/index.ts +0 -2
- package/src/atoms/Label/stories/Label.mdx +0 -18
- package/src/atoms/Label/stories/Label.stories.tsx +0 -30
- package/src/atoms/Link/Link.test.tsx +0 -53
- package/src/atoms/List/List.test.tsx +0 -195
- package/src/atoms/Overlay/Overlay.test.tsx +0 -23
- package/src/atoms/Popover/Popover.test.tsx +0 -39
- package/src/atoms/Price/Price.test.tsx +0 -63
- package/src/atoms/Radio/Radio.test.tsx +0 -59
- package/src/atoms/Radio/Radio.tsx +0 -24
- package/src/atoms/Radio/index.ts +0 -2
- package/src/atoms/Radio/stories/Radio.mdx +0 -18
- package/src/atoms/Radio/stories/Radio.stories.tsx +0 -41
- package/src/atoms/Select/Select.test.tsx +0 -71
- package/src/atoms/Skeleton/Skeleton.test.tsx +0 -13
- package/src/atoms/Slider/Slider.test.tsx +0 -32
- package/src/atoms/Spinner/Spinner.test.tsx +0 -12
- package/src/atoms/TextArea/TextArea.test.tsx +0 -77
- package/src/hooks/useSlider/useSlider.test.ts +0 -176
- package/src/molecules/Accordion/Accordion.test.tsx +0 -226
- package/src/molecules/AggregateRating/AggregateRating.test.tsx +0 -87
- package/src/molecules/Alert/Alert.test.tsx +0 -23
- package/src/molecules/Banner/Banner.test.tsx +0 -67
- package/src/molecules/Breadcrumb/Breadcrumb.test.tsx +0 -124
- package/src/molecules/Bullets/Bullets.test.tsx +0 -128
- package/src/molecules/Card/Card.test.tsx +0 -68
- package/src/molecules/Carousel/Carousel.test.tsx +0 -587
- package/src/molecules/Carousel/hooks/hooks.test.ts +0 -109
- package/src/molecules/CartItem/CartItem.test.tsx +0 -79
- package/src/molecules/Dropdown/Dropdown.test.tsx +0 -275
- package/src/molecules/Form/Form.test.tsx +0 -61
- package/src/molecules/Gift/Gift.test.tsx +0 -53
- package/src/molecules/IconButton/IconButton.test.tsx +0 -31
- package/src/molecules/IconButton/IconButton.tsx +0 -35
- package/src/molecules/IconButton/index.tsx +0 -2
- package/src/molecules/IconButton/stories/IconButton.mdx +0 -27
- package/src/molecules/IconButton/stories/IconButton.stories.tsx +0 -35
- package/src/molecules/LoadingButton/LoadingButton.test.tsx +0 -14
- package/src/molecules/Modal/Modal.test.tsx +0 -241
- package/src/molecules/OrderSummary/OrderSummary.test.tsx +0 -103
- package/src/molecules/PaymentMethods/PaymentMethods.test.tsx +0 -37
- package/src/molecules/PriceRange/PriceRange.test.tsx +0 -70
- package/src/molecules/ProductCard/ProductCard.test.tsx +0 -75
- package/src/molecules/QuantitySelector/QuantitySelector.test.tsx +0 -93
- package/src/molecules/RadioGroup/RadioGroup.test.tsx +0 -107
- package/src/molecules/SearchInput/SearchInput.test.tsx +0 -34
- package/src/molecules/SkuSelector/SkuSelector.test.tsx +0 -42
- package/src/molecules/Table/Table.test.tsx +0 -233
- package/src/organisms/Hero/Hero.test.tsx +0 -60
- package/src/organisms/OutOfStock/OutOfStock.test.tsx +0 -122
- package/src/setupTests.ts +0 -7
- package/src/utils/toHaveNoIncomplete.ts +0 -76
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react'
|
|
2
|
-
import { axe } from 'jest-axe'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
import type { LinkProps } from '.'
|
|
6
|
-
import LinkComponent from '.'
|
|
7
|
-
|
|
8
|
-
const TestLink = ({ href = '/', testId }: LinkProps<'a'>) => {
|
|
9
|
-
return (
|
|
10
|
-
<LinkComponent testId={testId} href={href}>
|
|
11
|
-
Link
|
|
12
|
-
</LinkComponent>
|
|
13
|
-
)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
describe('Link', () => {
|
|
17
|
-
it('should receive a custom component', () => {
|
|
18
|
-
const { getByTestId } = render(
|
|
19
|
-
<LinkComponent
|
|
20
|
-
href="/"
|
|
21
|
-
as={(props: { href: string }) => {
|
|
22
|
-
return (
|
|
23
|
-
<div {...props}>
|
|
24
|
-
<a data-testid="custom-anchor" href={props.href}>
|
|
25
|
-
Link
|
|
26
|
-
</a>
|
|
27
|
-
</div>
|
|
28
|
-
)
|
|
29
|
-
}}
|
|
30
|
-
/>
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
expect(getByTestId('custom-anchor')).toHaveAttribute('href', '/')
|
|
34
|
-
expect(getByTestId('store-link')).toHaveAttribute('data-fs-link')
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
describe('Data Attributes', () => {
|
|
38
|
-
it('should have `data-fs-link` attribute', () => {
|
|
39
|
-
const { getByTestId } = render(<TestLink />)
|
|
40
|
-
|
|
41
|
-
expect(getByTestId('store-link')).toHaveAttribute('data-fs-link')
|
|
42
|
-
})
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
describe('Accessibility', () => {
|
|
46
|
-
it('should have no violations', async () => {
|
|
47
|
-
const { getByTestId } = render(<TestLink />)
|
|
48
|
-
|
|
49
|
-
expect(await axe(getByTestId('store-link'))).toHaveNoViolations()
|
|
50
|
-
expect(await axe(getByTestId('store-link'))).toHaveNoIncompletes()
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
})
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react'
|
|
2
|
-
import { axe } from 'jest-axe'
|
|
3
|
-
import React, { Fragment } from 'react'
|
|
4
|
-
|
|
5
|
-
import List from './List'
|
|
6
|
-
|
|
7
|
-
const optionsArray = ['Great', 'Ok', 'Bad']
|
|
8
|
-
|
|
9
|
-
describe('List', () => {
|
|
10
|
-
it('should have `data-fs-list` attribute', () => {
|
|
11
|
-
const { getByTestId } = render(
|
|
12
|
-
<List>
|
|
13
|
-
{optionsArray.map((value) => {
|
|
14
|
-
return <li key={value}>{value}</li>
|
|
15
|
-
})}
|
|
16
|
-
</List>
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
expect(getByTestId('store-list')).toHaveAttribute('data-fs-list')
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
it('should be empty if no children are provided', () => {
|
|
23
|
-
const { getByTestId } = render(<List />)
|
|
24
|
-
|
|
25
|
-
expect(getByTestId('store-list')).toBeEmptyDOMElement()
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('should have expected data attributes for each variation', () => {
|
|
29
|
-
const { getByTestId, rerender } = render(
|
|
30
|
-
<List variant="ordered">
|
|
31
|
-
{optionsArray.map((value) => {
|
|
32
|
-
return <li key={value}>{value}</li>
|
|
33
|
-
})}
|
|
34
|
-
</List>
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
expect(getByTestId('store-list')).toHaveAttribute(
|
|
38
|
-
'data-fs-list',
|
|
39
|
-
'ordered'
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
rerender(
|
|
43
|
-
<List variant="unordered">
|
|
44
|
-
{optionsArray.map((value) => {
|
|
45
|
-
return <li key={value}>{value}</li>
|
|
46
|
-
})}
|
|
47
|
-
</List>
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
expect(getByTestId('store-list')).toHaveAttribute(
|
|
51
|
-
'data-fs-list',
|
|
52
|
-
'unordered'
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
rerender(
|
|
56
|
-
<List variant="description">
|
|
57
|
-
{optionsArray.map((value) => {
|
|
58
|
-
return <li key={value}>{value}</li>
|
|
59
|
-
})}
|
|
60
|
-
</List>
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
expect(getByTestId('store-list')).toHaveAttribute(
|
|
64
|
-
'data-fs-list',
|
|
65
|
-
'description'
|
|
66
|
-
)
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
it('should render the expected HTML tag for each variant', () => {
|
|
70
|
-
const { getByTestId, rerender } = render(
|
|
71
|
-
<List variant="unordered">
|
|
72
|
-
{optionsArray.map((value) => {
|
|
73
|
-
return <li key={value}>{value}</li>
|
|
74
|
-
})}
|
|
75
|
-
</List>
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
expect(getByTestId('store-list')).toBeInstanceOf(HTMLUListElement)
|
|
79
|
-
|
|
80
|
-
rerender(
|
|
81
|
-
<List variant="ordered">
|
|
82
|
-
{optionsArray.map((value) => {
|
|
83
|
-
return <li key={value}>{value}</li>
|
|
84
|
-
})}
|
|
85
|
-
</List>
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
expect(getByTestId('store-list')).toBeInstanceOf(HTMLOListElement)
|
|
89
|
-
|
|
90
|
-
rerender(
|
|
91
|
-
<List variant="description">
|
|
92
|
-
{optionsArray.map((value, index) => {
|
|
93
|
-
return (
|
|
94
|
-
<Fragment key={index}>
|
|
95
|
-
<dt key={`${index}--term`}>{value}</dt>
|
|
96
|
-
<dd key={`${index}--details`}>option</dd>
|
|
97
|
-
</Fragment>
|
|
98
|
-
)
|
|
99
|
-
})}
|
|
100
|
-
</List>
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
expect(getByTestId('store-list')).toBeInstanceOf(HTMLDListElement)
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
it('should respect the HTML tag passed as "as" prop', () => {
|
|
107
|
-
const { getByTestId, rerender } = render(
|
|
108
|
-
<List variant="unordered" as="div">
|
|
109
|
-
{optionsArray.map((value) => {
|
|
110
|
-
return <li key={value}>{value}</li>
|
|
111
|
-
})}
|
|
112
|
-
</List>
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
expect(getByTestId('store-list')).toBeInstanceOf(HTMLDivElement)
|
|
116
|
-
|
|
117
|
-
rerender(
|
|
118
|
-
<List variant="ordered" as="div">
|
|
119
|
-
{optionsArray.map((value) => {
|
|
120
|
-
return <li key={value}>{value}</li>
|
|
121
|
-
})}
|
|
122
|
-
</List>
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
expect(getByTestId('store-list')).toBeInstanceOf(HTMLDivElement)
|
|
126
|
-
|
|
127
|
-
rerender(
|
|
128
|
-
<List variant="description" as="div">
|
|
129
|
-
{optionsArray.map((value, index) => {
|
|
130
|
-
return (
|
|
131
|
-
<Fragment key={index}>
|
|
132
|
-
<dt key={`${index}--term`}>{value}</dt>
|
|
133
|
-
<dd key={`${index}--details`}>option</dd>
|
|
134
|
-
</Fragment>
|
|
135
|
-
)
|
|
136
|
-
})}
|
|
137
|
-
</List>
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
expect(getByTestId('store-list')).toBeInstanceOf(HTMLDivElement)
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
describe('Accessibility', () => {
|
|
144
|
-
it('should have no violations when rendering the default variant', async () => {
|
|
145
|
-
const { getByTestId } = render(
|
|
146
|
-
<List>
|
|
147
|
-
{optionsArray.map((option, index) => (
|
|
148
|
-
<li key={index}>{option}</li>
|
|
149
|
-
))}
|
|
150
|
-
</List>
|
|
151
|
-
)
|
|
152
|
-
|
|
153
|
-
expect(await axe(getByTestId('store-list'))).toHaveNoViolations()
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
it('should have no violations when rendering the unordered variant', async () => {
|
|
157
|
-
const { getByTestId } = render(
|
|
158
|
-
<List variant="unordered">
|
|
159
|
-
{optionsArray.map((option, index) => (
|
|
160
|
-
<li key={index}>{option}</li>
|
|
161
|
-
))}
|
|
162
|
-
</List>
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
expect(await axe(getByTestId('store-list'))).toHaveNoViolations()
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
it('should have no violations when rendering the ordered variant', async () => {
|
|
169
|
-
const { getByTestId } = render(
|
|
170
|
-
<List variant="ordered">
|
|
171
|
-
{optionsArray.map((option, index) => (
|
|
172
|
-
<li key={index}>{option}</li>
|
|
173
|
-
))}
|
|
174
|
-
</List>
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
expect(await axe(getByTestId('store-list'))).toHaveNoViolations()
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
it('should have no violations when rendering the description variant', async () => {
|
|
181
|
-
const { getByTestId } = render(
|
|
182
|
-
<List variant="description">
|
|
183
|
-
{optionsArray.map((option, index) => (
|
|
184
|
-
<Fragment key={index}>
|
|
185
|
-
<dt key={`${index}--term`}>{option}</dt>
|
|
186
|
-
<dd key={`${index}--details`}>option</dd>
|
|
187
|
-
</Fragment>
|
|
188
|
-
))}
|
|
189
|
-
</List>
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
expect(await axe(getByTestId('store-list'))).toHaveNoViolations()
|
|
193
|
-
})
|
|
194
|
-
})
|
|
195
|
-
})
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react'
|
|
3
|
-
import { axe } from 'jest-axe'
|
|
4
|
-
|
|
5
|
-
import Overlay from './Overlay'
|
|
6
|
-
|
|
7
|
-
describe('Overlay', () => {
|
|
8
|
-
const testId = 'store-overlay'
|
|
9
|
-
|
|
10
|
-
it('data-fs-overlay is present', () => {
|
|
11
|
-
const { getByTestId } = render(<Overlay testId={testId} />)
|
|
12
|
-
|
|
13
|
-
expect(getByTestId(testId)).toHaveAttribute('data-fs-overlay')
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
describe('Accessibility', () => {
|
|
17
|
-
it('should have no violations', async () => {
|
|
18
|
-
const { getByTestId } = render(<Overlay testId={testId} />)
|
|
19
|
-
|
|
20
|
-
expect(await axe(getByTestId(testId))).toHaveNoViolations()
|
|
21
|
-
})
|
|
22
|
-
})
|
|
23
|
-
})
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react'
|
|
2
|
-
import { axe } from 'jest-axe'
|
|
3
|
-
import React, { useRef } from 'react'
|
|
4
|
-
import { act } from 'react-dom/test-utils'
|
|
5
|
-
|
|
6
|
-
import Popover from './Popover'
|
|
7
|
-
|
|
8
|
-
const PopoverTemplate = (props: any) => {
|
|
9
|
-
const ref = useRef<any>(null)
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<>
|
|
13
|
-
<div ref={ref} />
|
|
14
|
-
<Popover {...props} targetRef={ref}>
|
|
15
|
-
<div>
|
|
16
|
-
<p>Whoa! Look at me!</p>
|
|
17
|
-
</div>
|
|
18
|
-
</Popover>
|
|
19
|
-
</>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
describe('Popover', () => {
|
|
24
|
-
it('`data-fs-popover` is present', () => {
|
|
25
|
-
const { getByTestId } = render(<PopoverTemplate />)
|
|
26
|
-
|
|
27
|
-
expect(getByTestId('store-popover')).toHaveAttribute('data-fs-popover')
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
describe('Accessibility', () => {
|
|
31
|
-
it('should have no violations', async () => {
|
|
32
|
-
const { getByTestId } = render(<PopoverTemplate />)
|
|
33
|
-
|
|
34
|
-
await act(async () => {
|
|
35
|
-
expect(await axe(getByTestId('store-popover'))).toHaveNoViolations()
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
})
|
|
39
|
-
})
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react'
|
|
2
|
-
import { axe } from 'jest-axe'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
import Price from './Price'
|
|
6
|
-
|
|
7
|
-
describe('Price', () => {
|
|
8
|
-
it('`data-fs-price` is present', () => {
|
|
9
|
-
const { getByTestId } = render(<Price value={32.5} />)
|
|
10
|
-
|
|
11
|
-
expect(getByTestId('store-price')).toHaveAttribute('data-fs-price')
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('`data-variant` is equal to `selling` if no variant is defined', () => {
|
|
15
|
-
const { getByTestId } = render(<Price value={32.5} />)
|
|
16
|
-
|
|
17
|
-
expect(getByTestId('store-price')).toHaveAttribute(
|
|
18
|
-
'data-variant',
|
|
19
|
-
'selling'
|
|
20
|
-
)
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
it('`data-variant` is equal to `listing` if variant is listing', () => {
|
|
24
|
-
const { getByTestId } = render(<Price value={32.5} variant="listing" />)
|
|
25
|
-
|
|
26
|
-
expect(getByTestId('store-price')).toHaveAttribute(
|
|
27
|
-
'data-variant',
|
|
28
|
-
'listing'
|
|
29
|
-
)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
it('returns unaltered value if no formatter is provided', () => {
|
|
33
|
-
const { getByTestId } = render(<Price value={32.5} />)
|
|
34
|
-
|
|
35
|
-
expect(getByTestId('store-price')).toHaveTextContent('32.5')
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
it('returns empty content if formatter returns null', () => {
|
|
39
|
-
const { getByTestId } = render(
|
|
40
|
-
<Price value={32.5} formatter={() => null} />
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
expect(getByTestId('store-price')).toBeEmptyDOMElement()
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
it('returns formatter result as content', () => {
|
|
47
|
-
const formatterResult = 'Formatter result'
|
|
48
|
-
|
|
49
|
-
const { getByTestId } = render(
|
|
50
|
-
<Price value={32.5} formatter={() => formatterResult} />
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
expect(getByTestId('store-price')).toHaveTextContent(formatterResult)
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
describe('Accessibility', () => {
|
|
57
|
-
it('should have no violations', async () => {
|
|
58
|
-
const { getByTestId } = render(<Price value={32.2} />)
|
|
59
|
-
|
|
60
|
-
expect(await axe(getByTestId('store-price'))).toHaveNoViolations()
|
|
61
|
-
})
|
|
62
|
-
})
|
|
63
|
-
})
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react'
|
|
3
|
-
import { axe } from 'jest-axe'
|
|
4
|
-
|
|
5
|
-
import Radio from './Radio'
|
|
6
|
-
|
|
7
|
-
describe('Radio', () => {
|
|
8
|
-
it('data-fs-radio is present', () => {
|
|
9
|
-
const { getByTestId } = render(<Radio testId="store-radio" />)
|
|
10
|
-
|
|
11
|
-
expect(getByTestId('store-radio')).toHaveAttribute('data-fs-radio')
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('type radio is present', () => {
|
|
15
|
-
const { getByTestId } = render(<Radio testId="store-radio" />)
|
|
16
|
-
|
|
17
|
-
expect(getByTestId('store-radio')).toHaveAttribute('type', 'radio')
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
describe('Accessibility', () => {
|
|
21
|
-
it('should have no violations using aria-label', async () => {
|
|
22
|
-
const { container } = render(
|
|
23
|
-
<Radio aria-label="label radio for test" testId="store-radio" />
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
expect(await axe(container)).toHaveNoViolations()
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('should have no violations using aria-labelledby', async () => {
|
|
30
|
-
const { container } = render(
|
|
31
|
-
<>
|
|
32
|
-
<span id="label">My test label</span>
|
|
33
|
-
<Radio aria-labelledby="label" testId="store-radio" />
|
|
34
|
-
</>
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
expect(await axe(container)).toHaveNoViolations()
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('should have no violations using placeholder', async () => {
|
|
41
|
-
const { container } = render(
|
|
42
|
-
<Radio placeholder="Accessibility placeholder" testId="store-radio" />
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
expect(await axe(container)).toHaveNoViolations()
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
it('should have no violations using id with explicit label', async () => {
|
|
49
|
-
const { container } = render(
|
|
50
|
-
<>
|
|
51
|
-
<label htmlFor="radio">My test label</label>
|
|
52
|
-
<Radio id="radio" testId="store-radio" />
|
|
53
|
-
</>
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
expect(await axe(container)).toHaveNoViolations()
|
|
57
|
-
})
|
|
58
|
-
})
|
|
59
|
-
})
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react'
|
|
2
|
-
import type { InputHTMLAttributes } from 'react'
|
|
3
|
-
|
|
4
|
-
export interface RadioProps
|
|
5
|
-
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
6
|
-
testId?: string
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(
|
|
10
|
-
{ testId = 'store-radio', ...otherProps }: RadioProps,
|
|
11
|
-
ref
|
|
12
|
-
) {
|
|
13
|
-
return (
|
|
14
|
-
<input
|
|
15
|
-
ref={ref}
|
|
16
|
-
data-fs-radio
|
|
17
|
-
data-testid={testId}
|
|
18
|
-
type="radio"
|
|
19
|
-
{...otherProps}
|
|
20
|
-
/>
|
|
21
|
-
)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
export default Radio
|
package/src/atoms/Radio/index.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
import Radio from '../Radio'
|
|
3
|
-
|
|
4
|
-
# Radio
|
|
5
|
-
|
|
6
|
-
<Canvas>
|
|
7
|
-
<Story id="atoms-radio--radio" />
|
|
8
|
-
</Canvas>
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
<ArgsTable of={Radio} />
|
|
13
|
-
|
|
14
|
-
## CSS Selectors
|
|
15
|
-
|
|
16
|
-
```css
|
|
17
|
-
[data-fs-radio] {}
|
|
18
|
-
```
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Story, Meta } from '@storybook/react'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import type { ComponentArgTypes } from '../../../typings/utils'
|
|
5
|
-
import type { RadioProps } from '../Radio'
|
|
6
|
-
import Component from '../Radio'
|
|
7
|
-
import mdx from './Radio.mdx'
|
|
8
|
-
|
|
9
|
-
const RadioTemplate: Story<RadioProps> = (props) => (
|
|
10
|
-
<>
|
|
11
|
-
<Component {...props} id="radio" />
|
|
12
|
-
<label htmlFor="radio">Radio</label>
|
|
13
|
-
</>
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
export const Radio = RadioTemplate.bind({})
|
|
17
|
-
|
|
18
|
-
const controls: ComponentArgTypes<RadioProps> = {
|
|
19
|
-
checked: {
|
|
20
|
-
control: {
|
|
21
|
-
type: 'boolean',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const actions: ComponentArgTypes<RadioProps> = {
|
|
27
|
-
onClick: { action: 'clicked', table: { disable: true } },
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default {
|
|
31
|
-
title: 'Atoms/Radio',
|
|
32
|
-
argTypes: {
|
|
33
|
-
...controls,
|
|
34
|
-
...actions,
|
|
35
|
-
},
|
|
36
|
-
parameters: {
|
|
37
|
-
docs: {
|
|
38
|
-
page: mdx,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
} as Meta
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react'
|
|
2
|
-
import { axe } from 'jest-axe'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
import Select from './Select'
|
|
6
|
-
|
|
7
|
-
const optionsArray = [
|
|
8
|
-
['great', 'Great'],
|
|
9
|
-
['ok', 'Ok'],
|
|
10
|
-
['bad', 'Bad'],
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
const mapPairToOption = (value: string, label: string) => {
|
|
14
|
-
return (
|
|
15
|
-
<option key={value} value={value}>
|
|
16
|
-
{label}
|
|
17
|
-
</option>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
describe('Select', () => {
|
|
22
|
-
it('`data-fs-select` is present', () => {
|
|
23
|
-
const { getByTestId } = render(
|
|
24
|
-
<Select testId="store-select">
|
|
25
|
-
{optionsArray.map(([value, label]) => {
|
|
26
|
-
return mapPairToOption(value, label)
|
|
27
|
-
})}
|
|
28
|
-
</Select>
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
expect(getByTestId('store-select')).toHaveAttribute('data-fs-select')
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('select is empty when no options are given', () => {
|
|
35
|
-
const { getByTestId } = render(<Select testId="store-select" />)
|
|
36
|
-
|
|
37
|
-
expect(getByTestId('store-select')).toBeEmptyDOMElement()
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
describe('Accessibility', () => {
|
|
41
|
-
it('should have no violations using aria-label', async () => {
|
|
42
|
-
const { container } = render(
|
|
43
|
-
<Select aria-label="label select for test" testId="store-select" />
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
expect(await axe(container)).toHaveNoViolations()
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
it('should have no violations using aria-labelledby', async () => {
|
|
50
|
-
const { container } = render(
|
|
51
|
-
<>
|
|
52
|
-
<span id="label">My test label</span>
|
|
53
|
-
<Select aria-labelledby="label" testId="store-select" />
|
|
54
|
-
</>
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
expect(await axe(container)).toHaveNoViolations()
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
it('should have no violations using id with explicit label', async () => {
|
|
61
|
-
const { container } = render(
|
|
62
|
-
<>
|
|
63
|
-
<label htmlFor="select">My test label</label>
|
|
64
|
-
<Select id="select" testId="store-select" />
|
|
65
|
-
</>
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
expect(await axe(container)).toHaveNoViolations()
|
|
69
|
-
})
|
|
70
|
-
})
|
|
71
|
-
})
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import Skeleton from './Skeleton'
|
|
5
|
-
|
|
6
|
-
describe('Skeleton', () => {
|
|
7
|
-
it('`data-fs-skeleton` is present', () => {
|
|
8
|
-
const { getByTestId } = render(<Skeleton testId="store-skeleton" />)
|
|
9
|
-
const skeleton = getByTestId('store-skeleton')
|
|
10
|
-
|
|
11
|
-
expect(skeleton).toHaveAttribute('data-fs-skeleton')
|
|
12
|
-
})
|
|
13
|
-
})
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react'
|
|
2
|
-
import { axe } from 'jest-axe'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
import Slider from './Slider'
|
|
6
|
-
|
|
7
|
-
const props = {
|
|
8
|
-
min: {
|
|
9
|
-
absolute: 0,
|
|
10
|
-
selected: 0,
|
|
11
|
-
},
|
|
12
|
-
max: {
|
|
13
|
-
absolute: 100,
|
|
14
|
-
selected: 100,
|
|
15
|
-
},
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
describe('Slider', () => {
|
|
19
|
-
it('`data-fs-slider` is present', () => {
|
|
20
|
-
const { getByTestId } = render(<Slider {...props} />)
|
|
21
|
-
|
|
22
|
-
expect(getByTestId('store-slider')).toHaveAttribute('data-fs-slider')
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
describe('Accessibility', () => {
|
|
26
|
-
it('should have no violations', async () => {
|
|
27
|
-
const { getByTestId } = render(<Slider {...props} />)
|
|
28
|
-
|
|
29
|
-
expect(await axe(getByTestId('store-slider'))).toHaveNoViolations()
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
})
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import Spinner from './Spinner'
|
|
5
|
-
|
|
6
|
-
describe('Spinner', () => {
|
|
7
|
-
it('`data-fs-spinner` is present', () => {
|
|
8
|
-
const { getByTestId } = render(<Spinner />)
|
|
9
|
-
|
|
10
|
-
expect(getByTestId('store-spinner')).toHaveAttribute('data-fs-spinner')
|
|
11
|
-
})
|
|
12
|
-
})
|