Skip to content

Commit

Permalink
chore: store level 2 navigation events
Browse files Browse the repository at this point in the history
  • Loading branch information
williazz committed Aug 24, 2023
1 parent 9ea3521 commit 94baa98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/plugins/event-plugins/NavigationPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ export class NavigationPlugin extends InternalPlugin {
if (this.context?.record) {
this.context.record(
PERFORMANCE_NAVIGATION_EVENT_TYPE,
eventDataNavigationTimingLevel2
eventDataNavigationTimingLevel2,
entryData
);
}
};
Expand Down
10 changes: 10 additions & 0 deletions src/plugins/event-plugins/__tests__/NavigationPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,14 @@ describe('NavigationPlugin tests', () => {
// Assert
expect(record).toHaveBeenCalled();
});

test('when level 2 navigation event is recorded then is is stored', async () => {
const plugin: NavigationPlugin = buildNavigationPlugin();
// Run
plugin.load(context);
window.dispatchEvent(new Event('load'));
plugin.disable();
const call = record.mock.calls[0];
expect(call[2]).toMatchObject(navigationEvent);
});
});

0 comments on commit 94baa98

Please sign in to comment.