From b3ee8bb9beb326f50362c8932cf90f8fa7994659 Mon Sep 17 00:00:00 2001 From: Locrian24 Date: Tue, 6 Feb 2024 13:30:43 -0800 Subject: [PATCH] Minor spec for behaviour update --- src/widgets/EmbedWidget.ts | 2 +- test/specs/InstantAccessRendering.feature | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/widgets/EmbedWidget.ts b/src/widgets/EmbedWidget.ts index 30cd11e5..250ee687 100644 --- a/src/widgets/EmbedWidget.ts +++ b/src/widgets/EmbedWidget.ts @@ -89,7 +89,7 @@ export default class EmbedWidget extends Widget { if (this._shouldFireLoadEvent()) { this._loadEvent(_sqh); _log("loaded"); - } else { + } else if (frameDoc) { this._attachLoadEventListener(frameDoc, _sqh); } }); diff --git a/test/specs/InstantAccessRendering.feature b/test/specs/InstantAccessRendering.feature index cb9a9c1e..fed8eb1d 100644 --- a/test/specs/InstantAccessRendering.feature +++ b/test/specs/InstantAccessRendering.feature @@ -36,6 +36,18 @@ Feature: Instant Access Widget rendering When the widget is loaded by squatchJs Then there will be no Load Analytics API event + @minutia + Scenario: A Load Analytics API event is fired by an Instant Access widget once a user has been registered within the widget + Given a widget is rendered with the code + """ + squatch.widget(initObj) + """ + And there is no user object or jwt in the initObj + When the widget is loaded by squatchJs + Then an event listener is attached to the widget iframe's document body + When a "sq:user-registration" event is fired from the widget + Then a Load Analytics API event is fired + @landmine Scenario: Rendering a Verified Access widget with `squatch.widget` causes component errors Given a widget is rendered with the code