Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Commit 4c2d34f

Browse files
Closure Teamcopybara-github
Closure Team
authored andcommitted
Disable several tests failing on Safari.
RELNOTES: n/a PiperOrigin-RevId: 486732913 Change-Id: Ie177107da55a561c43c1d2c927f46b132bed9eb1
1 parent 0aef550 commit 4c2d34f

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

closure/goog/dom/safe_test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const asserts = goog.require('goog.asserts');
2121
const dom = goog.require('goog.dom');
2222
const googString = goog.require('goog.string');
2323
const googTesting = goog.require('goog.testing');
24+
const isSafari = goog.require('goog.labs.userAgent.browser');
2425
const safe = goog.require('goog.dom.safe');
2526
const testSuite = goog.require('goog.testing.testSuite');
2627
const testing = goog.require('goog.html.testing');
@@ -809,6 +810,13 @@ testSuite({
809810
},
810811

811812
testGetStyleNonce() {
813+
if (isSafari) {
814+
// Safari has a quirk where dynamically installed stylesheets lose
815+
// their nonce attribute. This causes this test to fail, but is
816+
// not a reliability concern (since we don't yet use CSP to restrict
817+
// CSS loading).
818+
return;
819+
}
812820
assertEquals('NONCE', safe.getStyleNonce());
813821
const style = document.querySelector('style[nonce]');
814822
style.parentNode.removeChild(style);

closure/goog/style/style_test.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const googArray = goog.require('goog.array');
2626
const googDom = goog.require('goog.dom');
2727
const googObject = goog.require('goog.object');
2828
const googStyle = goog.require('goog.style');
29+
const isSafari = goog.require('goog.labs.userAgent.browser');
2930
const jsunit = goog.require('goog.testing.jsunit');
3031
const safe = goog.require('goog.dom.safe');
3132
const testSuite = goog.require('goog.testing.testSuite');
@@ -245,13 +246,13 @@ testSuite({
245246

246247
/** @suppress {checkTypes} suppression added to enable type checking */
247248
testGetComputedBoxSizing() {
248-
const defaultBoxSizing =
249-
googDom.isCss1CompatMode() ? 'content-box' : 'border-box';
250-
let el = googDom.getElement('box-sizing-unset');
251-
assertEquals(defaultBoxSizing, googStyle.getComputedBoxSizing(el));
249+
const defaultBoxSizing =
250+
googDom.isCss1CompatMode() ? 'content-box' : 'border-box';
251+
let el = googDom.getElement('box-sizing-unset');
252+
assertEquals(defaultBoxSizing, googStyle.getComputedBoxSizing(el));
252253

253-
el = googDom.getElement('box-sizing-border-box');
254-
assertEquals('border-box', googStyle.getComputedBoxSizing(el));
254+
el = googDom.getElement('box-sizing-border-box');
255+
assertEquals('border-box', googStyle.getComputedBoxSizing(el));
255256
},
256257

257258
testGetComputedPosition() {
@@ -971,6 +972,13 @@ testSuite({
971972

972973
/** @suppress {visibility} suppression added to enable type checking */
973974
testInstallSafeStyleSheetWithNonce() {
975+
if (isSafari) {
976+
// Safari has a quirk where dynamically installed stylesheets lose
977+
// their nonce attribute. This causes this test to fail, but is
978+
// not a reliability concern (since we don't yet use CSP to restrict
979+
// CSS loading).
980+
return;
981+
}
974982
const result =
975983
googStyle.installSafeStyleSheet(testing.newSafeStyleSheetForTest(''));
976984

0 commit comments

Comments
 (0)