File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -497,6 +497,15 @@ describe('flex directive', () => {
497497 } , styler ) ;
498498 } ) ;
499499
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+
500509 describe ( '' , ( ) => {
501510
502511 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 {
6161 const hasCalc = String ( basis ) . indexOf ( 'calc' ) > - 1 ;
6262 const usingCalc = hasCalc || ( basis === 'auto' ) ;
6363 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 ;
6767
6868 let isValue = ( hasCalc || hasUnits ) ;
6969
@@ -166,7 +166,7 @@ export class FlexStyleBuilder extends StyleBuilder {
166166
167167 // Fix for issues 277, 534, and 728
168168 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 ;
170170 css [ max ] = isFixed || ( ! usingCalc && shrink ) ? basis : null ;
171171 }
172172
You can’t perform that action at this time.
0 commit comments