From eca2c413f4f659a2cc02d1a1d929752a1b3b80d6 Mon Sep 17 00:00:00 2001 From: Jami Gibbs Date: Tue, 19 Nov 2024 13:08:39 -0600 Subject: [PATCH] va-link & va-link-action: update analytics tests and lifecycle (#1407) * update analytics test * update lifecycle type for checking text lines --- .../va-link-action/test/va-link-action.e2e.ts | 10 +--------- .../src/components/va-link-action/va-link-action.tsx | 4 ++-- .../src/components/va-link/test/va-link.e2e.ts | 10 +--------- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/packages/web-components/src/components/va-link-action/test/va-link-action.e2e.ts b/packages/web-components/src/components/va-link-action/test/va-link-action.e2e.ts index d6102cf5b..caad327a5 100644 --- a/packages/web-components/src/components/va-link-action/test/va-link-action.e2e.ts +++ b/packages/web-components/src/components/va-link-action/test/va-link-action.e2e.ts @@ -94,15 +94,7 @@ describe('va-link-action', () => { const analyticsSpy = await page.spyOnEvent('component-library-analytics'); const anchor = await page.find('va-link-action >>> a'); await anchor.click(); - expect(analyticsSpy).toHaveReceivedEventDetail({ - componentName: 'va-link-action', - action: 'click', - details: { - label: 'Find out if you qualify for this program and how to apply', - destination: 'https://www.va.gov', - origin: 'http://localhost:3333/', - }, - }); + expect(analyticsSpy).toHaveReceivedEventTimes(1); }); it(`doesn't fire analytics event when clicked and disableAnalytics is true`, async () => { diff --git a/packages/web-components/src/components/va-link-action/va-link-action.tsx b/packages/web-components/src/components/va-link-action/va-link-action.tsx index 3f5d3efc4..a362d90ae 100644 --- a/packages/web-components/src/components/va-link-action/va-link-action.tsx +++ b/packages/web-components/src/components/va-link-action/va-link-action.tsx @@ -74,7 +74,7 @@ export class VaLinkAction { private linkRef?: HTMLElement; - componentDidLoad() { + componentWillLoad() { this.checkTextLines(); } @@ -128,4 +128,4 @@ export class VaLinkAction { ); } -} \ No newline at end of file +} diff --git a/packages/web-components/src/components/va-link/test/va-link.e2e.ts b/packages/web-components/src/components/va-link/test/va-link.e2e.ts index 3edca5e62..2c6f0e884 100644 --- a/packages/web-components/src/components/va-link/test/va-link.e2e.ts +++ b/packages/web-components/src/components/va-link/test/va-link.e2e.ts @@ -221,15 +221,7 @@ describe('va-link', () => { const analyticsSpy = await page.spyOnEvent('component-library-analytics'); const anchor = await page.find('va-link >>> a'); await anchor.click(); - expect(analyticsSpy).toHaveReceivedEventDetail({ - componentName: 'va-link', - action: 'click', - details: { - label: 'Find out if you qualify for this program and how to apply', - destination: 'https://www.va.gov', - origin: 'http://localhost:3333/', - }, - }); + expect(analyticsSpy).toHaveReceivedEventTimes(1); }); it(`doesn't fire analytics event when clicked and disableAnalytics is true`, async () => {