diff --git a/test/utils/initMatchers.js b/test/utils/initMatchers.js index b83d55411732f9..6490c97250d6f1 100644 --- a/test/utils/initMatchers.js +++ b/test/utils/initMatchers.js @@ -104,7 +104,12 @@ chai.use((chaiAPI, utils) => { * @returns {CSSStyleDeclaration} */ function pretendVisibleGetComputedStyle(element) { - const declaration = new CSSStyleDeclaration(); + // `CSSStyleDeclaration` is not constructable + // https://stackoverflow.com/a/52732909/3406963 + // this is not equivalent to the declaration from `getComputedStyle` + // e.g `getComputedStyle` would return a readonly declaration + // let's hope this doesn't get passed around until it's no longer clear where it comes from + const declaration = document.createElement('span').style; // initial values declaration.content = '';