@@ -149,6 +149,57 @@ describe('BlockScrollStrategy', () => {
149
149
} ) ,
150
150
) ;
151
151
152
+ it (
153
+ `should't do anything if the page isn't scrollable while zoomed out` ,
154
+ skipIOS ( ( ) => {
155
+ if ( platform . FIREFOX ) {
156
+ // style.zoom is only supported from Firefox 126
157
+ return ;
158
+ }
159
+
160
+ forceScrollElement . style . display = 'none' ;
161
+ document . body . style . zoom = '75%' ;
162
+ overlayRef . attach ( componentPortal ) ;
163
+ expect ( document . body . scrollWidth ) . toBeGreaterThan ( window . innerWidth ) ;
164
+ expect ( documentElement . classList ) . not . toContain ( 'cdk-global-scrollblock' ) ;
165
+ overlayRef . detach ( ) ;
166
+ document . body . style . zoom = '100%' ;
167
+
168
+ document . documentElement . style . zoom = '75%' ;
169
+ overlayRef . attach ( componentPortal ) ;
170
+ expect ( document . body . scrollWidth ) . toBeGreaterThan ( window . innerWidth ) ;
171
+ expect ( documentElement . classList ) . not . toContain ( 'cdk-global-scrollblock' ) ;
172
+ document . documentElement . style . zoom = '100%' ;
173
+ } ) ,
174
+ ) ;
175
+
176
+ it (
177
+ `should add cdk-global-scrollblock while zoomed in` ,
178
+ skipIOS ( ( ) => {
179
+ if ( platform . FIREFOX ) {
180
+ // style.zoom is only supported from Firefox 126
181
+ return ;
182
+ }
183
+
184
+ forceScrollElement . style . width = window . innerWidth - 20 + 'px' ;
185
+ forceScrollElement . style . height = window . innerHeight - 20 + 'px' ;
186
+ overlayRef . attach ( componentPortal ) ;
187
+ expect ( documentElement . classList ) . not . toContain ( 'cdk-global-scrollblock' ) ;
188
+ overlayRef . detach ( ) ;
189
+
190
+ document . body . style . zoom = '200%' ;
191
+ overlayRef . attach ( componentPortal ) ;
192
+ expect ( documentElement . classList ) . toContain ( 'cdk-global-scrollblock' ) ;
193
+ document . body . style . zoom = '100%' ;
194
+ overlayRef . detach ( ) ;
195
+
196
+ document . documentElement . style . zoom = '200%' ;
197
+ overlayRef . attach ( componentPortal ) ;
198
+ expect ( documentElement . classList ) . toContain ( 'cdk-global-scrollblock' ) ;
199
+ document . documentElement . style . zoom = '100%' ;
200
+ } ) ,
201
+ ) ;
202
+
152
203
it ( 'should keep the content width' , ( ) => {
153
204
forceScrollElement . style . width = '100px' ;
154
205
0 commit comments