Skip to content

Commit a8163fd

Browse files
author
Shipra Gupta
committed
fix(overlay): add null checks for window.__swc.warn in test environments
1 parent 1f3e027 commit a8163fd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

1st-gen/packages/overlay/src/slottable-request-directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class SlottableRequestDirective extends AsyncDirective {
7474
{ signal }
7575
);
7676

77-
if (window.__swc.DEBUG) {
77+
if (window.__swc?.DEBUG && window.__swc?.warn) {
7878
window.__swc.warn(
7979
undefined,
8080
`⚠️ WARNING ⚠️ : The Overlay Trigger Directive is experimental and there is no guarantees behind its usage in an application!! Its API and presence within the library could be changed at anytime. See "sp-overlay" or "Overlay.open()" for a stable API for overlaying content on your application.`,

1st-gen/packages/overlay/src/slottable-request-event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class SlottableRequestEvent extends Event {
2323
this.name = name;
2424
this.data = data;
2525
this.slotName = key !== undefined ? `${name}.${key}` : name;
26-
if (window.__swc.DEBUG) {
26+
if (window.__swc?.DEBUG && window.__swc?.warn) {
2727
window.__swc.warn(
2828
undefined,
2929
`⚠️ WARNING ⚠️ : \`slottable-request\` events are experimental and there is no guarantees behind usage of them in an application!! Their shape and presence within the library could be changed at anytime.

0 commit comments

Comments
 (0)