Skip to content

Commit

Permalink
fixup! πŸ› [RUM-3708] slidingSessionWindow clear window after 5 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-lebeau committed May 13, 2024
1 parent 959c5c3 commit 43a9ad0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ describe('trackCumulativeLayoutShift', () => {

it('should get the max value sessions', () => {
const { lifeCycle, clock } = setupBuilder.withFakeClock().build()
const divElement = appendElement('<div id="div-element"></div>')

// first session window
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
Expand All @@ -144,7 +145,7 @@ describe('trackCumulativeLayoutShift', () => {
createPerformanceEntry(RumPerformanceEntryType.LAYOUT_SHIFT, { value: 0.1 }),
])
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
createPerformanceEntry(RumPerformanceEntryType.LAYOUT_SHIFT, { value: 0.2 }),
createPerformanceEntry(RumPerformanceEntryType.LAYOUT_SHIFT, { value: 0.2, sources: [{ node: divElement }] }),
])
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
createPerformanceEntry(RumPerformanceEntryType.LAYOUT_SHIFT, { value: 0.2 }),
Expand All @@ -159,7 +160,7 @@ describe('trackCumulativeLayoutShift', () => {
])

expect(clsCallback).toHaveBeenCalledTimes(4)
expect(clsCallback.calls.mostRecent().args[0]).toEqual({ value: 0.5, targetSelector: undefined })
expect(clsCallback.calls.mostRecent().args[0]).toEqual({ value: 0.5, targetSelector: '#div-element' })
})

describe('cls target element', () => {
Expand Down

0 comments on commit 43a9ad0

Please sign in to comment.