This repository was archived by the owner on Jan 6, 2025. It is now read-only.
File tree 2 files changed +13
-4
lines changed
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -497,6 +497,15 @@ describe('flex directive', () => {
497
497
} , styler ) ;
498
498
} ) ;
499
499
500
+ it ( 'should set a min-width and max-width when basis is a rem value' , ( ) => {
501
+ componentWithTemplate ( `<div fxFlex='12rem'></div>` ) ;
502
+ expectNativeEl ( fixture ) . toHaveStyle ( {
503
+ 'flex' : '1 1 12rem' ,
504
+ 'max-width' : '12rem' ,
505
+ 'min-width' : '12rem'
506
+ } , styler ) ;
507
+ } ) ;
508
+
500
509
describe ( '' , ( ) => {
501
510
502
511
it ( 'should ignore fxLayout settings on same element' , ( ) => {
Original file line number Diff line number Diff line change @@ -61,9 +61,9 @@ export class FlexStyleBuilder extends StyleBuilder {
61
61
const hasCalc = String ( basis ) . indexOf ( 'calc' ) > - 1 ;
62
62
const usingCalc = hasCalc || ( basis === 'auto' ) ;
63
63
const isPercent = String ( basis ) . indexOf ( '%' ) > - 1 && ! hasCalc ;
64
- const hasUnits = String ( basis ) . indexOf ( 'px' ) > - 1 || String ( basis ) . indexOf ( 'em ' ) > - 1 ||
65
- String ( basis ) . indexOf ( 'vw ' ) > - 1 || String ( basis ) . indexOf ( 'vh ' ) > - 1 ;
66
- const isPx = String ( basis ) . indexOf ( 'px ' ) > - 1 || usingCalc ;
64
+ const hasUnits = String ( basis ) . indexOf ( 'px' ) > - 1 || String ( basis ) . indexOf ( 'rem ' ) > - 1 ||
65
+ String ( basis ) . indexOf ( 'em ' ) > - 1 || String ( basis ) . indexOf ( 'vw ' ) > - 1 ||
66
+ String ( basis ) . indexOf ( 'vh ' ) > - 1 ;
67
67
68
68
let isValue = ( hasCalc || hasUnits ) ;
69
69
@@ -166,7 +166,7 @@ export class FlexStyleBuilder extends StyleBuilder {
166
166
167
167
// Fix for issues 277, 534, and 728
168
168
if ( basis !== '0%' && basis !== '0px' && basis !== '0.000000001px' && basis !== 'auto' ) {
169
- css [ min ] = isFixed || ( isPx && grow ) ? basis : null ;
169
+ css [ min ] = isFixed || ( isValue && grow ) ? basis : null ;
170
170
css [ max ] = isFixed || ( ! usingCalc && shrink ) ? basis : null ;
171
171
}
172
172
You can’t perform that action at this time.
0 commit comments