@@ -212,28 +212,28 @@ function validateCustomViewPorts(customViewports) {
212
212
if ( ! element . styles ?. width ) {
213
213
throw new ValidationError ( 'Missing width in styles. please check the config file' ) ;
214
214
}
215
+ let width = element . styles . width ;
216
+ let height = element . styles . height ;
217
+ if ( width && typeof width != 'number' ) {
218
+ width = Number ( width ) ;
219
+ }
220
+ if ( height && typeof height != 'number' ) {
221
+ height = Number ( height ) ;
222
+ }
223
+ if ( width && width < MIN_RESOLUTION_WIDTH || width > MAX_RESOLUTION_WIDTH ) {
224
+ throw new ValidationError ( `customViewports.styles width must be > ${ MIN_RESOLUTION_WIDTH } , < ${ MAX_RESOLUTION_WIDTH } ` ) ;
225
+ }
226
+ if ( height & ( height < MIN_RESOLUTION_WIDTH || height > MAX_RESOLUTION_WIDTH ) ) {
227
+ throw new ValidationError ( `customViewports.styles height must be > ${ MIN_RESOLUTION_HEIGHT } , < ${ MAX_RESOLUTION_HEIGHT } ` ) ;
228
+ }
229
+ element . styles . width = width ;
230
+ element . styles . height = height ;
215
231
} else {
216
232
if ( ! element . waitForTimeout ) {
217
233
throw new ValidationError ( 'Missing styles and waitForTimeout. Specify either of them. please check the config file' ) ;
218
234
}
219
235
}
220
236
221
- let width = element . styles . width ;
222
- let height = element . styles . height ;
223
- if ( width && typeof width != 'number' ) {
224
- width = Number ( width ) ;
225
- }
226
- if ( height && typeof height != 'number' ) {
227
- height = Number ( height ) ;
228
- }
229
- if ( width && width < MIN_RESOLUTION_WIDTH || width > MAX_RESOLUTION_WIDTH ) {
230
- throw new ValidationError ( `customViewports.styles width must be > ${ MIN_RESOLUTION_WIDTH } , < ${ MAX_RESOLUTION_WIDTH } ` ) ;
231
- }
232
- if ( height & ( height < MIN_RESOLUTION_WIDTH || height > MAX_RESOLUTION_WIDTH ) ) {
233
- throw new ValidationError ( `customViewports.styles height must be > ${ MIN_RESOLUTION_HEIGHT } , < ${ MAX_RESOLUTION_HEIGHT } ` ) ;
234
- }
235
- element . styles . width = width ;
236
- element . styles . height = height ;
237
237
} ) ;
238
238
return
239
239
}
0 commit comments