@@ -123,10 +123,12 @@ describe('MDC-based MatProgressSpinner', () => {
123123 fixture . componentInstance . diameter = 32 ;
124124 fixture . detectChanges ( ) ;
125125
126- expect ( parseInt ( spinner . style . width ) )
126+ const { width, height} = spinner . getBoundingClientRect ( ) ;
127+
128+ expect ( width )
127129 . withContext ( 'Expected the custom diameter to be applied to the host element width.' )
128130 . toBe ( 32 ) ;
129- expect ( parseInt ( spinner . style . height ) )
131+ expect ( height )
130132 . withContext ( 'Expected the custom diameter to be applied to the host element height.' )
131133 . toBe ( 32 ) ;
132134 expect ( parseInt ( svgElement . clientWidth ) )
@@ -168,11 +170,12 @@ describe('MDC-based MatProgressSpinner', () => {
168170
169171 const spinner = fixture . debugElement . query ( By . css ( 'mat-progress-spinner' ) ) ! . nativeElement ;
170172 const svgElement : HTMLElement = fixture . nativeElement . querySelector ( 'svg' ) ;
173+ const { width, height} = spinner . getBoundingClientRect ( ) ;
171174
172- expect ( parseFloat ( spinner . style . width ) )
175+ expect ( width )
173176 . withContext ( 'Expected the custom diameter to be applied to the host element width.' )
174177 . toBe ( 32.5 ) ;
175- expect ( parseFloat ( spinner . style . height ) )
178+ expect ( height )
176179 . withContext ( 'Expected the custom diameter to be applied to the host element height.' )
177180 . toBe ( 32.5 ) ;
178181 expect ( Math . ceil ( svgElement . clientWidth ) )
@@ -213,8 +216,10 @@ describe('MDC-based MatProgressSpinner', () => {
213216 fixture . componentInstance . strokeWidth = 40 ;
214217 fixture . detectChanges ( ) ;
215218
216- expect ( element . style . width ) . toBe ( '100px' ) ;
217- expect ( element . style . height ) . toBe ( '100px' ) ;
219+ const { width, height} = element . getBoundingClientRect ( ) ;
220+
221+ expect ( width ) . toBe ( 100 ) ;
222+ expect ( height ) . toBe ( 100 ) ;
218223 } ) ;
219224
220225 it ( 'should not collapse the host element if the stroke width is less than the default' , ( ) => {
@@ -224,8 +229,10 @@ describe('MDC-based MatProgressSpinner', () => {
224229 fixture . componentInstance . strokeWidth = 5 ;
225230 fixture . detectChanges ( ) ;
226231
227- expect ( element . style . width ) . toBe ( '100px' ) ;
228- expect ( element . style . height ) . toBe ( '100px' ) ;
232+ const { width, height} = element . getBoundingClientRect ( ) ;
233+
234+ expect ( width ) . toBe ( 100 ) ;
235+ expect ( height ) . toBe ( 100 ) ;
229236 } ) ;
230237
231238 it ( 'should set the color class on the mat-spinner' , ( ) => {
@@ -277,8 +284,10 @@ describe('MDC-based MatProgressSpinner', () => {
277284 expect ( spinner . componentInstance . strokeWidth ) . toBe ( 11 ) ;
278285 expect ( spinner . componentInstance . value ) . toBe ( 25 ) ;
279286
280- expect ( spinner . nativeElement . style . width ) . toBe ( '37px' ) ;
281- expect ( spinner . nativeElement . style . height ) . toBe ( '37px' ) ;
287+ const { width, height} = spinner . nativeElement . getBoundingClientRect ( ) ;
288+
289+ expect ( width ) . toBe ( 37 ) ;
290+ expect ( height ) . toBe ( 37 ) ;
282291
283292 expect ( svgElement . clientWidth ) . toBe ( 37 ) ;
284293 expect ( svgElement . clientHeight ) . toBe ( 37 ) ;
@@ -290,8 +299,9 @@ describe('MDC-based MatProgressSpinner', () => {
290299 let spinner = fixture . debugElement . query ( By . directive ( MatProgressSpinner ) ) ! ;
291300 spinner . componentInstance . diameter = 32 ;
292301 fixture . detectChanges ( ) ;
293- expect ( spinner . nativeElement . style . width ) . toBe ( '32px' ) ;
294- expect ( spinner . nativeElement . style . height ) . toBe ( '32px' ) ;
302+ const { width, height} = spinner . nativeElement . getBoundingClientRect ( ) ;
303+ expect ( width ) . toBe ( 32 ) ;
304+ expect ( height ) . toBe ( 32 ) ;
295305 } ) ;
296306
297307 it ( 'should be able to set a default diameter' , ( ) => {
0 commit comments