Skip to content

Commit

Permalink
fixup! fixup! fixup! 🐛 [RUM-3708] slidingSessionWindow clear window a…
Browse files Browse the repository at this point in the history
…fter 5 seconds
  • Loading branch information
thomas-lebeau committed May 13, 2024
1 parent 2482068 commit eff59c8
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { RumPerformanceEntryType } from '../../../browser/performanceCollection'
import type { CumulativeLayoutShift } from './trackCumulativeLayoutShift'
import { trackCumulativeLayoutShift } from './trackCumulativeLayoutShift'

fdescribe('trackCumulativeLayoutShift', () => {
describe('trackCumulativeLayoutShift', () => {
let setupBuilder: TestSetupBuilder
let isLayoutShiftSupported: boolean
let originalSupportedEntryTypes: PropertyDescriptor | undefined
Expand Down Expand Up @@ -128,7 +128,6 @@ fdescribe('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 @@ -143,7 +142,7 @@ fdescribe('trackCumulativeLayoutShift', () => {
createPerformanceEntry(RumPerformanceEntryType.LAYOUT_SHIFT, { value: 0.1 }),
])
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
createPerformanceEntry(RumPerformanceEntryType.LAYOUT_SHIFT, { value: 0.2, sources: [{ node: divElement }] }),
createPerformanceEntry(RumPerformanceEntryType.LAYOUT_SHIFT, { value: 0.2 }),
])
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
createPerformanceEntry(RumPerformanceEntryType.LAYOUT_SHIFT, { value: 0.2 }),
Expand All @@ -158,7 +157,7 @@ fdescribe('trackCumulativeLayoutShift', () => {
])

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

describe('cls target element', () => {
Expand Down Expand Up @@ -216,7 +215,7 @@ fdescribe('trackCumulativeLayoutShift', () => {
expect(clsCallback.calls.mostRecent().args[0].targetSelector).toEqual(undefined)
})

fit('should get the target element of the largest layout shift', () => {
it('should get the target element of the largest layout shift', () => {
const { lifeCycle, clock } = setupBuilder.withFakeClock().build()
const divElement = appendElement('<div id="div-element"></div>')

Expand Down

0 comments on commit eff59c8

Please sign in to comment.