@@ -17,6 +17,16 @@ const FAB_BUTTON_COSY = 'igx-button--fab-cosy';
1717
1818describe ( 'IgxButton' , ( ) => {
1919 configureTestSuite ( ) ;
20+
21+ const baseClass = 'igx-button' ;
22+ const classes = {
23+ flat : `${ baseClass } --flat` ,
24+ raised : `${ baseClass } --raised` ,
25+ outlined : `${ baseClass } --outlined` ,
26+ fab : `${ baseClass } --fab` ,
27+ icon : `${ baseClass } --icon`
28+ } ;
29+
2030 beforeEach ( async ( ( ) => {
2131 TestBed . configureTestingModule ( {
2232 declarations : [
@@ -117,23 +127,28 @@ describe('IgxButton', () => {
117127
118128 theButton . type = 'raised' ;
119129 fixture . detectChanges ( ) ;
120- expect ( theButtonNativeEl . classList ) . toEqual ( 'igx-button--raised' ) ;
130+ expect ( theButtonNativeEl . classList . length ) . toEqual ( 1 ) ;
131+ expect ( theButtonNativeEl . classList ) . toContain ( classes . raised ) ;
121132
122133 theButton . type = 'outlined' ;
123134 fixture . detectChanges ( ) ;
124- expect ( theButtonNativeEl . classList ) . toEqual ( 'igx-button--outlined' ) ;
135+ expect ( theButtonNativeEl . classList . length ) . toEqual ( 1 ) ;
136+ expect ( theButtonNativeEl . classList ) . toContain ( classes . outlined ) ;
125137
126138 theButton . type = 'fab' ;
127139 fixture . detectChanges ( ) ;
128- expect ( theButtonNativeEl . classList ) . toEqual ( 'igx-button--fab' ) ;
140+ expect ( theButtonNativeEl . classList . length ) . toEqual ( 1 ) ;
141+ expect ( theButtonNativeEl . classList ) . toContain ( classes . fab ) ;
129142
130143 theButton . type = 'icon' ;
131144 fixture . detectChanges ( ) ;
132- expect ( theButtonNativeEl . classList ) . toEqual ( 'igx-button--icon' ) ;
145+ expect ( theButtonNativeEl . classList . length ) . toEqual ( 1 ) ;
146+ expect ( theButtonNativeEl . classList ) . toContain ( classes . icon ) ;
133147
134148 theButton . type = 'flat' ;
135149 fixture . detectChanges ( ) ;
136- expect ( theButtonNativeEl . classList ) . toEqual ( 'igx-button--flat' ) ;
150+ expect ( theButtonNativeEl . classList . length ) . toEqual ( 1 ) ;
151+ expect ( theButtonNativeEl . classList ) . toContain ( classes . flat ) ;
137152 } ) ;
138153} ) ;
139154
0 commit comments