Skip to content

Commit

Permalink
fix(tests): Skip a test on old Safari
Browse files Browse the repository at this point in the history
  • Loading branch information
mister-ben committed Jul 12, 2023
1 parent c66bf40 commit 4875f57
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/unit/utils/dom.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* eslint-env qunit */
import document from 'global/document';
import window from 'global/window';
import sinon from 'sinon';
import * as Dom from '../../../src/js/utils/dom.js';
import { IS_SAFARI } from '../../../src/js/utils/browser.js';
import TestHelpers from '../test-helpers.js';

QUnit.module('utils/dom');
Expand Down Expand Up @@ -687,7 +689,11 @@ QUnit.test('isSingleLeftClick() checks return values for mousedown event', funct
assert.ok(Dom.isSingleLeftClick(mouseEvent), 'a touch event on simulated mobiles is a single left click');
});

QUnit.test('Dom.copyStyleSheetsToWindow() copies all style sheets to a window', function(assert) {
// The next test is skipped on Safari < 14, which has a broken document.styleSheets
// copyStyleSheetsToWindow() is only used on browsers supporting documentPictureInPicture - Chromium 113+
const skipOnOldSafari = IS_SAFARI && parseInt(window.navigator.userAgent.match(/Version\/(\d+)\./)[1], 10) < 14 ? 'skip' : 'test';

QUnit[skipOnOldSafari]('Dom.copyStyleSheetsToWindow() copies all style sheets to a window', function(assert) {
const fakeWindow = document.createElement('div');
const done = assert.async();

Expand Down

0 comments on commit 4875f57

Please sign in to comment.