@@ -18,9 +18,8 @@ import {
1818 mockGetContainerMetadata ,
1919} from '../data/api.mocks' ;
2020
21- import { ComponentPicker , LibraryAndComponentPicker } from './ComponentPicker' ;
22- import { ContentType , allLibraryPageTabs } from '../routes' ;
23- import { LibraryProvider } from '../common/context/LibraryContext' ;
21+ import { LibraryAndComponentPicker } from './ComponentPicker' ;
22+ import { ContentType } from '../routes' ;
2423
2524jest . mock ( 'react-router-dom' , ( ) => ( {
2625 ...jest . requireActual ( 'react-router-dom' ) ,
@@ -458,70 +457,3 @@ describe('<LibraryAndComponentPicker />', () => {
458457 expect ( screen . queryByText ( / n e v e r p u b l i s h e d / i) ) . not . toBeInTheDocument ( ) ;
459458 } ) ;
460459} ) ;
461-
462- describe ( '<ComponentPicker restrictOpenInfoSidebar />' , ( ) => {
463- const { libraryId } = mockContentLibrary ;
464-
465- const renderPicker = ( restrictOpenInfoSidebar : boolean ) => render (
466- < LibraryProvider libraryId = { libraryId } >
467- < ComponentPicker
468- componentPickerMode = "single"
469- restrictOpenInfoSidebar = { restrictOpenInfoSidebar }
470- visibleTabs = { allLibraryPageTabs }
471- />
472- </ LibraryProvider > ,
473- ) ;
474-
475- beforeEach ( ( ) => {
476- initializeMocks ( ) ;
477- mockSearchResult ( { ...mockResult } ) ;
478- } ) ;
479-
480- it ( 'should open component info sidebar on card click when restrictOpenInfoSidebar is false' , async ( ) => {
481- const user = userEvent . setup ( ) ;
482- renderPicker ( false ) ;
483-
484- const [ componentCard ] = await screen . findAllByText ( 'Introduction to Testing' ) ;
485-
486- // Click on the component card body
487- await user . click ( componentCard ) ;
488-
489- // Sidebar should open
490- expect ( await screen . findByTestId ( 'library-sidebar' ) ) . toBeInTheDocument ( ) ;
491- } ) ;
492-
493- it ( 'should not open component info sidebar on card click when restrictOpenInfoSidebar is true' , async ( ) => {
494- const user = userEvent . setup ( ) ;
495- renderPicker ( true ) ;
496-
497- const [ componentCard ] = await screen . findAllByText ( 'Introduction to Testing' ) ;
498-
499- // Click on the component card body
500- await user . click ( componentCard ) ;
501-
502- // Sidebar should NOT open
503- expect ( screen . queryByTestId ( 'library-sidebar' ) ) . not . toBeInTheDocument ( ) ;
504- } ) ;
505-
506- it ( 'should open container info sidebar on card click when restrictOpenInfoSidebar is false' , async ( ) => {
507- const user = userEvent . setup ( ) ;
508- renderPicker ( false ) ;
509-
510- // Click on the unit card body
511- await user . click ( await screen . findByText ( 'Published Test Unit' ) ) ;
512-
513- // Sidebar should open
514- expect ( await screen . findByTestId ( 'library-sidebar' ) ) . toBeInTheDocument ( ) ;
515- } ) ;
516-
517- it ( 'should not open container info sidebar on card click when restrictOpenInfoSidebar is true' , async ( ) => {
518- const user = userEvent . setup ( ) ;
519- renderPicker ( true ) ;
520-
521- // Click on the unit card body
522- await user . click ( await screen . findByText ( 'Published Test Unit' ) ) ;
523-
524- // Sidebar should NOT open
525- expect ( screen . queryByTestId ( 'library-sidebar' ) ) . not . toBeInTheDocument ( ) ;
526- } ) ;
527- } ) ;
0 commit comments