From 55f1eaf0c2779522fef4e1421c02197aa32909d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alvarez?= Date: Fri, 24 Nov 2023 09:11:25 +0100 Subject: [PATCH] feat(packages/sui-react-web-vitals): minor updates --- packages/sui-react-web-vitals/src/index.js | 1 + packages/sui-react-web-vitals/test/browser/indexSpec.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/sui-react-web-vitals/src/index.js b/packages/sui-react-web-vitals/src/index.js index e4775ad57..f391c2e88 100644 --- a/packages/sui-react-web-vitals/src/index.js +++ b/packages/sui-react-web-vitals/src/index.js @@ -105,6 +105,7 @@ export default function WebVitalsReporter({ path: pathname, target, loadState: attribution.loadState, + visibilityState: document.visibilityState, ...(attribution.eventType && {eventType: attribution.eventType}) }) } diff --git a/packages/sui-react-web-vitals/test/browser/indexSpec.js b/packages/sui-react-web-vitals/test/browser/indexSpec.js index ee2ad7e93..bf6260950 100644 --- a/packages/sui-react-web-vitals/test/browser/indexSpec.js +++ b/packages/sui-react-web-vitals/test/browser/indexSpec.js @@ -36,7 +36,7 @@ describe('WebVitalsReporter', () => { await screen.findByRole('heading', {name: 'Title'}) }) - it('should track cwv using logger callback', async () => { + it('should track cwv using callback', async () => { const reporter = { onINP: fn => { fn({name: 'TTFB', value: 10}) @@ -49,7 +49,7 @@ describe('WebVitalsReporter', () => { await waitFor(() => [expect(onReport.calledWithMatch({name: 'TTFB', amount: 10, pathname: '/'})).to.be.true]) }) - it('should track cwv using logger callback with route id', async () => { + it('should track cwv using callback with route id', async () => { const reporter = { onINP: fn => { fn({name: 'TTFB', value: 10}) @@ -67,7 +67,7 @@ describe('WebVitalsReporter', () => { ]) }) - it('should track cwv using logger with browser', async () => { + it('should track cwv using callback with browser', async () => { const reporter = { onINP: fn => { fn({name: 'TTFB', value: 10}) @@ -91,7 +91,7 @@ describe('WebVitalsReporter', () => { ]) }) - it('should track cwv using logger with browser in context', async () => { + it('should track cwv using callback with browser in context', async () => { const reporter = { onINP: fn => { fn({name: 'TTFB', value: 10})