File tree 2 files changed +17
-2
lines changed
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,19 @@ describe('MatGridList', () => {
207
207
expect ( getStyle ( tiles [ 2 ] , 'top' ) ) . toBe ( '102px' ) ;
208
208
} ) ;
209
209
210
+ it ( 'should allow alternate units for the gutter size' , ( ) => {
211
+ const fixture = createComponent ( GridListWithUnspecifiedGutterSize ) ;
212
+ const gridList = fixture . debugElement . query ( By . directive ( MatGridList ) ) ;
213
+
214
+ gridList . componentInstance . gutterSize = '10%' ;
215
+ fixture . detectChanges ( ) ;
216
+
217
+ const tiles = fixture . debugElement . queryAll ( By . css ( 'mat-grid-tile' ) ) ;
218
+
219
+ expect ( getStyle ( tiles [ 0 ] , 'width' ) ) . toBe ( '90px' ) ;
220
+ expect ( getComputedLeft ( tiles [ 1 ] ) ) . toBe ( 110 ) ;
221
+ } ) ;
222
+
210
223
it ( 'should set the correct list height in ratio mode' , ( ) => {
211
224
const fixture = createComponent ( GridListWithRatioHeightAndMulipleRows ) ;
212
225
fixture . detectChanges ( ) ;
Original file line number Diff line number Diff line change @@ -286,11 +286,13 @@ export class FitTileStyler extends TileStyler {
286
286
287
287
288
288
/** Wraps a CSS string in a calc function */
289
- function calc ( exp : string ) : string { return `calc(${ exp } )` ; }
289
+ function calc ( exp : string ) : string {
290
+ return `calc(${ exp } )` ;
291
+ }
290
292
291
293
292
294
/** Appends pixels to a CSS string if no units are given. */
293
295
function normalizeUnits ( value : string ) : string {
294
- return ( value . match ( / p x | e m | r e m / ) ) ? value : value + 'px' ;
296
+ return value . match ( / ( [ A - Z a - z % ] + ) $ / ) ? value : ` ${ value } px` ;
295
297
}
296
298
You can’t perform that action at this time.
0 commit comments