Skip to content

Commit 4573b49

Browse files
committed
chore: fix warning about unconfigurable property
Fixes that some browsers in Browserstack or Saucelabs warn about the `defineProperty` call in the interactivity checker tests. `LOG: 'Attempting to configure 'frameElement' with descriptor '{}' on object '[object Window]' and got error, giving up: TypeError: Attempting to change the getter of an unconfigurable property.'`. This happens because some browsers explicitly set all properties to `configurable: false` on `window` objects. Since this is only happening inside of Safari, we don't overwrite the property.
1 parent ff0e612 commit 4573b49

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/cdk/a11y/interactivity-checker/interactivity-checker.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,12 @@ describe('InteractivityChecker', () => {
346346
iframe.setAttribute('tabindex', '-1');
347347
iframe.contentDocument.body.appendChild(button);
348348

349-
Object.defineProperty(iframe.contentWindow, 'frameElement', {
350-
get: () => { throw 'Access Denied!'; }
351-
});
349+
// Some browsers explicitly prevent overwriting of properties on a `Window` object.
350+
if (!platform.SAFARI) {
351+
Object.defineProperty(iframe.contentWindow, 'frameElement', {
352+
get: () => { throw 'Access Denied!'; }
353+
});
354+
}
352355

353356
expect(() => checker.isTabbable(button)).not.toThrow();
354357
});

0 commit comments

Comments
 (0)