File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
src/components/tables/c-table Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @bindable-ui/bindable" ,
33 "description" : " An Aurelia component library" ,
4- "version" : " 1.11.8 " ,
4+ "version" : " 1.11.9 " ,
55 "repository" : {
66 "type" : " git" ,
77 "url" : " https://github.com/bindable-ui/bindable"
Original file line number Diff line number Diff line change @@ -615,5 +615,26 @@ describe('c-table component', () => {
615615 expect ( col . sortClass ) . toBe ( component . styles . sortDesc ) ;
616616 } ) ;
617617 } ) ;
618+
619+ describe ( '#getClasses' , ( ) => {
620+ it ( 'will update with css class names from styles' , ( ) => {
621+ const str = 'bgWarning' ;
622+
623+ const classes = component . getClasses ( str ) ;
624+
625+ expect ( classes . split ( ' ' ) ) . toHaveLength ( 1 ) ;
626+ expect ( classes ) . toContain ( component . styles . bgWarning ) ;
627+ } ) ;
628+
629+ it ( "will keep CSS class names applied that aren't in styles" , ( ) => {
630+ const str = 'bgWarning my-custom-class' ;
631+
632+ const classes = component . getClasses ( str ) ;
633+
634+ expect ( classes . split ( ' ' ) ) . toHaveLength ( 2 ) ;
635+ expect ( classes ) . toContain ( component . styles . bgWarning ) ;
636+ expect ( classes ) . toContain ( 'my-custom-class' ) ;
637+ } ) ;
638+ } ) ;
618639 } ) ;
619640} ) ;
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ export class CTable {
171171
172172 public getClasses ( str = '' ) {
173173 const keys = str . split ( ' ' ) ;
174- const classes = keys . map ( key => this . styles [ key ] ) ;
174+ const classes = keys . map ( key => ( this . styles [ key ] ? this . styles [ key ] : key ) ) ;
175175
176176 return classes . join ( ' ' ) ;
177177 }
You can’t perform that action at this time.
0 commit comments