File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
packages/compass-components/src/components Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import sinon from 'sinon';
1212describe ( 'Breadcrumbs Component' , function ( ) {
1313 afterEach ( cleanup ) ;
1414
15- it ( 'renders nothing when list is empty' , function ( ) {
15+ it ( 'renders empty when list is empty' , function ( ) {
1616 render ( < Breadcrumbs items = { [ ] } /> ) ;
1717 expect ( screen . getByTestId ( 'breadcrumbs' ) . children . length ) . to . equal ( 0 ) ;
1818 } ) ;
Original file line number Diff line number Diff line change @@ -61,6 +61,14 @@ export const Breadcrumbs = ({
6161 className ?: string ;
6262} ) => {
6363 const darkMode = useDarkMode ( ) ;
64+ if ( items . length === 0 ) {
65+ return (
66+ < div
67+ className = { cx ( breadcrumbStyles , className ) }
68+ data-testid = "breadcrumbs"
69+ />
70+ ) ;
71+ }
6472 const lastItem = items [ items . length - 1 ] ;
6573 const clickableItems = items . slice ( 0 , - 1 ) as BreadcrumbItem [ ] ;
6674 return (
You can’t perform that action at this time.
0 commit comments