@@ -50,5 +50,47 @@ describe('ContentWrapper component', () => {
5050 const el = container . querySelector ( '.ms-content' ) ;
5151 expect ( el ) . toExist ( ) ;
5252 } ) ;
53-
53+ it ( 'test classes generated from default props' , ( ) => {
54+ const DEFAULT_THEME_CLASS_NAME = 'ms-bright' ;
55+ const DEFAULT_ALIGN_CLASS_NAME = 'ms-align-center' ;
56+ const DEFAULT_SIZE_CLASS_NAME = 'ms-size-full' ;
57+ ReactDOM . render ( < ContentWrapper type = "text" /> , document . getElementById ( "container" ) ) ;
58+ const container = document . getElementById ( 'container' ) ;
59+ const el = container . querySelector ( '.ms-content' ) ;
60+ expect ( el ) . toExist ( ) ;
61+ expect ( el . getAttribute ( 'class' ) ) . toBe ( `ms-content ms-content-text ${ DEFAULT_THEME_CLASS_NAME } ${ DEFAULT_ALIGN_CLASS_NAME } ${ DEFAULT_SIZE_CLASS_NAME } ` ) ;
62+ } ) ;
63+ it ( 'test classes generated from theme prop' , ( ) => {
64+ const THEME = 'dark' ;
65+ const THEME_CLASS_NAME = `ms-${ THEME } ` ;
66+ const DEFAULT_ALIGN_CLASS_NAME = 'ms-align-center' ;
67+ const DEFAULT_SIZE_CLASS_NAME = 'ms-size-full' ;
68+ ReactDOM . render ( < ContentWrapper type = "text" theme = { THEME } /> , document . getElementById ( "container" ) ) ;
69+ const container = document . getElementById ( 'container' ) ;
70+ const el = container . querySelector ( '.ms-content' ) ;
71+ expect ( el ) . toExist ( ) ;
72+ expect ( el . getAttribute ( 'class' ) ) . toBe ( `ms-content ms-content-text ${ THEME_CLASS_NAME } ${ DEFAULT_ALIGN_CLASS_NAME } ${ DEFAULT_SIZE_CLASS_NAME } ` ) ;
73+ } ) ;
74+ it ( 'test classes generated from align prop' , ( ) => {
75+ const ALIGN = 'right' ;
76+ const DEFAULT_THEME_CLASS_NAME = 'ms-bright' ;
77+ const ALIGN_CLASS_NAME = `ms-align-${ ALIGN } ` ;
78+ const DEFAULT_SIZE_CLASS_NAME = 'ms-size-full' ;
79+ ReactDOM . render ( < ContentWrapper type = "text" align = { ALIGN } /> , document . getElementById ( "container" ) ) ;
80+ const container = document . getElementById ( 'container' ) ;
81+ const el = container . querySelector ( '.ms-content' ) ;
82+ expect ( el ) . toExist ( ) ;
83+ expect ( el . getAttribute ( 'class' ) ) . toBe ( `ms-content ms-content-text ${ DEFAULT_THEME_CLASS_NAME } ${ ALIGN_CLASS_NAME } ${ DEFAULT_SIZE_CLASS_NAME } ` ) ;
84+ } ) ;
85+ it ( 'test classes generated from size prop' , ( ) => {
86+ const SIZE = 'medium' ;
87+ const DEFAULT_THEME_CLASS_NAME = 'ms-bright' ;
88+ const DEFAULT_ALIGN_CLASS_NAME = 'ms-align-center' ;
89+ const SIZE_CLASS_NAME = `ms-size-${ SIZE } ` ;
90+ ReactDOM . render ( < ContentWrapper type = "text" size = { SIZE } /> , document . getElementById ( "container" ) ) ;
91+ const container = document . getElementById ( 'container' ) ;
92+ const el = container . querySelector ( '.ms-content' ) ;
93+ expect ( el ) . toExist ( ) ;
94+ expect ( el . getAttribute ( 'class' ) ) . toBe ( `ms-content ms-content-text ${ DEFAULT_THEME_CLASS_NAME } ${ DEFAULT_ALIGN_CLASS_NAME } ${ SIZE_CLASS_NAME } ` ) ;
95+ } ) ;
5496} ) ;
0 commit comments