@faststore/ui 1.6.22 → 1.6.23
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 +11 -0
- package/dist/ui.cjs.development.js +2 -3
- package/dist/ui.cjs.development.js.map +1 -1
- package/dist/ui.cjs.production.min.js +1 -1
- package/dist/ui.cjs.production.min.js.map +1 -1
- package/dist/ui.esm.js +2 -3
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/molecules/Breadcrumb/Breadcrumb.test.tsx +14 -0
- package/src/molecules/Breadcrumb/Breadcrumb.tsx +15 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/ui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.23",
|
|
4
4
|
"description": "A lightweight, framework agnostic component library for React",
|
|
5
5
|
"author": "emersonlaurentino",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@types/jest-axe": "^3.5.3",
|
|
77
77
|
"@types/tabbable": "^3.1.1",
|
|
78
78
|
"@types/testing-library__jest-dom": "^5.9.5",
|
|
79
|
-
"@vtex/theme-b2c-tailwind": "^1.6.
|
|
79
|
+
"@vtex/theme-b2c-tailwind": "^1.6.23",
|
|
80
80
|
"@vtex/tsconfig": "^0.5.0",
|
|
81
81
|
"chalk": "^5.0.0",
|
|
82
82
|
"jest-axe": "^5.0.1",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"tsdx": "^0.14.1",
|
|
90
90
|
"typescript": "^4.2.4"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "735dcedb0a0452381f25ce2ec1935ea751d17e6e"
|
|
93
93
|
}
|
|
@@ -95,6 +95,20 @@ describe('Breadcrumb', () => {
|
|
|
95
95
|
expect(dividers).toHaveLength(2)
|
|
96
96
|
})
|
|
97
97
|
|
|
98
|
+
it('Should not render null values', () => {
|
|
99
|
+
const { getAllByTestId } = render(
|
|
100
|
+
<Breadcrumb>
|
|
101
|
+
<a href="/office">Office</a>
|
|
102
|
+
<a href="/office/chairs">Chairs</a>
|
|
103
|
+
<a href="/office/chairs/tulip">Tulip</a>
|
|
104
|
+
{false && <a href="/office/chairs/tulip/red">Tulip Red</a>}
|
|
105
|
+
{null}
|
|
106
|
+
</Breadcrumb>
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
expect(getAllByTestId('store-breadcrumb-item')).toHaveLength(3)
|
|
110
|
+
})
|
|
111
|
+
|
|
98
112
|
it('AXE Test', async () => {
|
|
99
113
|
render(
|
|
100
114
|
<Breadcrumb aria-label="test modal" divider="/">
|
|
@@ -76,8 +76,6 @@ const Breadcrumb = forwardRef<HTMLDivElement, BreadcrumbProps>(
|
|
|
76
76
|
},
|
|
77
77
|
ref
|
|
78
78
|
) {
|
|
79
|
-
const lastIndex = React.Children.count(children)
|
|
80
|
-
|
|
81
79
|
return (
|
|
82
80
|
<nav
|
|
83
81
|
aria-label="Breadcrumb"
|
|
@@ -88,20 +86,22 @@ const Breadcrumb = forwardRef<HTMLDivElement, BreadcrumbProps>(
|
|
|
88
86
|
{...otherProps}
|
|
89
87
|
>
|
|
90
88
|
<List data-breadcrumb-list variant="ordered">
|
|
91
|
-
{React.Children.
|
|
92
|
-
|
|
89
|
+
{React.Children.toArray(children).map(
|
|
90
|
+
(child, index, childrenArray) => {
|
|
91
|
+
const isLastItem = index === childrenArray.length - 1
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
93
|
+
return (
|
|
94
|
+
<ListItem
|
|
95
|
+
isLastItem={isLastItem}
|
|
96
|
+
divider={rawDivider}
|
|
97
|
+
key={`breadcrumb-${index}`}
|
|
98
|
+
testId={testId}
|
|
99
|
+
>
|
|
100
|
+
{child}
|
|
101
|
+
</ListItem>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
)}
|
|
105
105
|
</List>
|
|
106
106
|
</nav>
|
|
107
107
|
)
|