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 1
1
{
2
2
"name" : " @bindable-ui/bindable" ,
3
3
"description" : " An Aurelia component library" ,
4
- "version" : " 1.11.8 " ,
4
+ "version" : " 1.11.9 " ,
5
5
"repository" : {
6
6
"type" : " git" ,
7
7
"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', () => {
615
615
expect ( col . sortClass ) . toBe ( component . styles . sortDesc ) ;
616
616
} ) ;
617
617
} ) ;
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
+ } ) ;
618
639
} ) ;
619
640
} ) ;
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ export class CTable {
171
171
172
172
public getClasses ( str = '' ) {
173
173
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 ) ) ;
175
175
176
176
return classes . join ( ' ' ) ;
177
177
}
You can’t perform that action at this time.
0 commit comments