@@ -56,40 +56,19 @@ describe('Header', () => {
5656
5757 it ( 'renders the header with logo and links' , ( ) => {
5858 render ( < Header /> ) ;
59- expect ( screen . getAllByAltText ( 'Ably logo' ) . length ) . toBeGreaterThan ( 0 ) ;
59+ expect ( screen . getByAltText ( 'Ably' ) ) . toBeInTheDocument ( ) ;
6060
61- expect ( screen . getByText ( 'Docs' ) ) . toBeInTheDocument ( ) ;
61+ expect ( screen . getAllByText ( 'Docs' ) ) . toHaveLength ( 2 ) ;
6262 expect ( screen . getByText ( 'Examples' ) ) . toBeInTheDocument ( ) ;
6363 } ) ;
6464
65- it ( 'renders the search bar when searchBar is true' , ( ) => {
66- render ( < Header searchBar = { true } /> ) ;
67- expect ( screen . getByText ( 'SearchBar' ) ) . toBeInTheDocument ( ) ;
68- } ) ;
69-
70- it ( 'does not render the search bar when searchBar is false' , ( ) => {
71- render ( < Header searchBar = { false } /> ) ;
72- expect ( screen . queryByText ( 'SearchBar' ) ) . not . toBeInTheDocument ( ) ;
73- } ) ;
74-
7565 it ( 'toggles the mobile menu when the burger icon is clicked' , ( ) => {
7666 render ( < Header /> ) ;
7767 const burgerIcon = screen . getByText ( 'icon-gui-bars-3-outline' ) ;
7868 fireEvent . click ( burgerIcon ) ;
79- expect ( screen . getByText ( 'icon-gui-x-mark-outline' ) ) . toBeInTheDocument ( ) ;
8069 expect ( screen . getByText ( 'LeftSidebar' ) ) . toBeInTheDocument ( ) ;
8170 } ) ;
8271
83- it ( 'disables scrolling when the mobile menu is open' , ( ) => {
84- render ( < Header /> ) ;
85- const burgerIcon = screen . getByText ( 'icon-gui-bars-3-outline' ) ;
86- fireEvent . click ( burgerIcon ) ;
87- expect ( document . body ) . toHaveClass ( 'overflow-hidden' ) ;
88- const closeIcon = screen . getByText ( 'icon-gui-x-mark-outline' ) ;
89- fireEvent . click ( closeIcon ) ;
90- expect ( document . body ) . not . toHaveClass ( 'overflow-hidden' ) ;
91- } ) ;
92-
9372 it ( 'renders the sign in buttons when not signed in' , ( ) => {
9473 render (
9574 < UserContext . Provider value = { { sessionState : { signedIn : false } , apps : [ ] } } >
0 commit comments