File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @linode/manager " : Added
3+ ---
4+
5+ unit test cases for EntityHeader component ([ #11222 ] ( https://github.com/linode/manager/pull/11222 ) )
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
3+ import { renderWithTheme } from 'src/utilities/testHelpers' ;
4+
5+ import { EntityHeader } from './EntityHeader' ;
6+
7+ import { HeaderProps } from './EntityHeader' ;
8+
9+ const mockText = 'Hello world' ;
10+
11+ const defaultProps : HeaderProps = {
12+ title : mockText ,
13+ } ;
14+
15+ describe ( 'EntityHeader' , ( ) => {
16+ it ( 'should render title with variant when isSummaryView is True' , ( ) => {
17+ const { getByRole } = renderWithTheme (
18+ < EntityHeader variant = "h2" isSummaryView { ...defaultProps } />
19+ ) ;
20+ const heading = getByRole ( 'heading' , { level : 2 } ) ;
21+ expect ( heading ) . toBeInTheDocument ( ) ;
22+ expect ( heading ) . toHaveTextContent ( mockText ) ;
23+ } ) ;
24+
25+ it ( 'should not render title when isSummaryView is False' , ( ) => {
26+ const { queryByText } = renderWithTheme (
27+ < EntityHeader isSummaryView = { false } { ...defaultProps } />
28+ ) ;
29+ expect ( queryByText ( mockText ) ) . not . toBeInTheDocument ( ) ;
30+ } ) ;
31+
32+ it ( 'should render children if provided' , ( ) => {
33+ const { getByText } = renderWithTheme (
34+ < EntityHeader { ...defaultProps } >
35+ < div > Child items can go here!</ div >
36+ </ EntityHeader >
37+ ) ;
38+ expect ( getByText ( 'Child items can go here!' ) ) . toBeInTheDocument ( ) ;
39+ } ) ;
40+ } ) ;
You can’t perform that action at this time.
0 commit comments