1
1
/* eslint-env qunit */
2
2
import document from 'global/document' ;
3
- import window from 'global/window' ;
4
3
import sinon from 'sinon' ;
5
4
import * as Dom from '../../../src/js/utils/dom.js' ;
6
- import { IS_SAFARI } from '../../../src/js/utils/browser.js' ;
7
5
import TestHelpers from '../test-helpers.js' ;
8
6
9
7
QUnit . module ( 'utils/dom' ) ;
@@ -689,11 +687,14 @@ QUnit.test('isSingleLeftClick() checks return values for mousedown event', funct
689
687
assert . ok ( Dom . isSingleLeftClick ( mouseEvent ) , 'a touch event on simulated mobiles is a single left click' ) ;
690
688
} ) ;
691
689
692
- // The next test is skipped on Safari < 14, which has a broken document.styleSheets
693
- // copyStyleSheetsToWindow() is only used on browsers supporting documentPictureInPicture - Chromium 113+
694
- const skipOnOldSafari = IS_SAFARI && parseInt ( window . navigator . userAgent . match ( / V e r s i o n \/ ( \d + ) \. / ) [ 1 ] , 10 ) < 14 ? 'skip' : 'test' ;
690
+ QUnit . test ( 'Dom.copyStyleSheetsToWindow() copies all style sheets to a window' , function ( assert ) {
691
+ /**
692
+ * This test is checking that styles are copied by comparing strings in original stylesheets to those in
693
+ * documents.styleSheets in the new (fake) window. This can be problematic on older Safari as documents.styleSheets
694
+ * does not always return the original style - a shorthand property like `background: white` may be returned as
695
+ * `background-color: white`.
696
+ */
695
697
696
- QUnit [ skipOnOldSafari ] ( 'Dom.copyStyleSheetsToWindow() copies all style sheets to a window' , function ( assert ) {
697
698
const fakeWindow = document . createElement ( 'div' ) ;
698
699
const done = assert . async ( ) ;
699
700
@@ -705,7 +706,7 @@ QUnit[skipOnOldSafari]('Dom.copyStyleSheetsToWindow() copies all style sheets to
705
706
706
707
const style1 = document . createElement ( 'style' ) ;
707
708
708
- style1 . textContent = 'body { background: white; }' ;
709
+ style1 . textContent = 'body { background-color : white; }' ;
709
710
document . head . appendChild ( style1 ) ;
710
711
711
712
const style2 = document . createElement ( 'style' ) ;
0 commit comments