@@ -79,16 +79,19 @@ describe('test BlockHeader render', () => {
7979 expect ( getByText ( '说明文字' ) ) . toHaveClass ( 'title__description' ) ;
8080 expect ( getByText ( 'Icon' ) ) . toBeTruthy ( ) ;
8181 } ) ;
82- test ( 'should render BlockHeader background success' , ( ) => {
82+ test ( 'should render BlockHeader background false success' , ( ) => {
8383 const props = { title : '测试1' , background : false } ;
8484 const { container } = render ( < BlockHeader { ...props } /> ) ;
8585 const wrap = container . firstChild ;
86- expect ( wrap ! . firstChild ) . not . toHaveClass ( `background` ) ;
86+ expect ( wrap ! . firstChild ) . not . toHaveClass ( `dtc-block-header__title-- background` ) ;
8787 } ) ;
88- test ( 'should render BlockHeader className when isSmall is small' , ( ) => {
88+ test ( 'should render BlockHeader className when size is small' , ( ) => {
8989 const { container, getByText } = render ( < BlockHeader { ...props2 } /> ) ;
9090 const wrap = container . firstChild ! ;
9191 expect ( wrap ) . toHaveClass ( `${ prefixCls } test__className` ) ;
92+ expect ( wrap . firstChild ) . toHaveClass (
93+ `dtc-block-header__title dtc-block-header__title--small dtc-block-header__title--background`
94+ ) ;
9295 expect ( getByText ( '标题2' ) ) . toHaveClass ( 'title__text' ) ;
9396 expect ( getByText ( '说明文字' ) ) . toHaveClass ( 'title__description' ) ;
9497 expect ( getByText ( 'Icon' ) ) . toBeTruthy ( ) ;
@@ -97,16 +100,17 @@ describe('test BlockHeader render', () => {
97100 test ( 'should render BlockHeader tooltip success' , ( ) => {
98101 const { container } = render ( < BlockHeader { ...props3 } /> ) ;
99102 const wrap = container . firstChild ! ;
100- const afterTitleWrap = wrap . firstChild ! . firstChild ! . lastChild ;
101- expect ( afterTitleWrap ! . firstChild ) . toHaveClass ( 'anticon-question-circle' ) ;
103+ const tooltipWrap = wrap . firstChild ! . firstChild ! . lastChild ;
104+ expect ( tooltipWrap ! . firstChild ) . toHaveClass ( 'anticon-question-circle' ) ;
102105 } ) ;
103106
104- test ( 'should render BlockHeader tooltip and desc success' , ( ) => {
107+ test ( 'should render BlockHeader description success' , ( ) => {
105108 const { container } = render ( < BlockHeader { ...props4 } /> ) ;
106109 const wrap = container . firstChild ! ;
107- const afterTitleWrap = wrap . firstChild ! . firstChild ! . lastChild ;
108- expect ( afterTitleWrap ) . toHaveTextContent ( '说明文字' ) ;
110+ const description = wrap . firstChild ! . firstChild ! . lastChild ;
111+ expect ( description ) . toHaveTextContent ( '说明文字' ) ;
109112 } ) ;
113+
110114 test ( 'should render BlockHeader correct dom length' , ( ) => {
111115 const { container } = render ( < BlockHeader title = "分类级别" addonBefore = "" /> ) ;
112116 const titleBoxWrap = container . firstChild ! . firstChild ! . firstChild ;
@@ -118,6 +122,7 @@ describe('test BlockHeader render', () => {
118122 const titleBoxWrap1 = container1 . firstChild ! . firstChild ! . firstChild ;
119123 expect ( titleBoxWrap1 ! . childNodes . length ) . toEqual ( 3 ) ;
120124 } ) ;
125+
121126 test ( 'should render BlockHeader correct margin-bottom' , ( ) => {
122127 const { container : noStyle } = render ( < BlockHeader title = "分类级别" addonBefore = "" /> ) ;
123128 expect ( noStyle . querySelector ( '.dtc-block-header' ) ) . not . toHaveAttribute ( 'style' ) ;
0 commit comments