Skip to content

Commit

Permalink
test the document classname changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Borcsik committed Nov 11, 2024
1 parent 28d7d8b commit e5df23e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/__tests__/extensions/replay/sessionrecording.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/// <reference lib="dom" />

import '@testing-library/jest-dom'

import { PostHogPersistence } from '../../../posthog-persistence'
import {
CONSOLE_LOG_RECORDING_ENABLED_SERVER_SIDE,
Expand Down Expand Up @@ -2184,6 +2186,7 @@ describe('SessionRecording', () => {
// Simulate URL change to blocked URL
fakeNavigateTo('https://test.com/blocked')
_emit(createIncrementalSnapshot({ data: { source: 3 } }))
expect(document.body).toHaveClass('ph-no-capture')

await waitFor(() => {
// Verify the buffer was flushed with all events including pause
Expand Down Expand Up @@ -2214,6 +2217,8 @@ describe('SessionRecording', () => {
// Verify recording resumes with resume event
_emit(createIncrementalSnapshot({ data: { source: 5 } }))

expect(document.body).not.toHaveClass('ph-no-capture')

expect(sessionRecording['buffer'].data).toStrictEqual([
expect.objectContaining({
type: 2,
Expand Down

0 comments on commit e5df23e

Please sign in to comment.