Skip to content

Commit

Permalink
va-link & va-link-action: update analytics tests and lifecycle (#1407)
Browse files Browse the repository at this point in the history
* update analytics test

* update lifecycle type for checking text lines
  • Loading branch information
jamigibbs authored Nov 19, 2024
1 parent e7f371d commit eca2c41
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class VaLinkAction {

private linkRef?: HTMLElement;

componentDidLoad() {
componentWillLoad() {
this.checkTextLines();
}

Expand Down Expand Up @@ -128,4 +128,4 @@ export class VaLinkAction {
</Host>
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit eca2c41

Please sign in to comment.