Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/react/src/Skeleton/__tests__/SkeletonBox.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,28 @@ describe('SkeletonBox', () => {
// No errors should occur
expect(true).toBe(true)
})

it('should render after custom delay when delay is a number', () => {
const {container} = render(<SkeletonBox delay={500} />)

// Not visible initially
expect(container.querySelector('div')).not.toBeInTheDocument()

// Advance timers by less than the custom delay (500ms)
act(() => {
vi.advanceTimersByTime(400)
})

// Still not visible
expect(container.querySelector('div')).not.toBeInTheDocument()

// Advance timers to complete the custom delay
act(() => {
vi.advanceTimersByTime(100)
})

// Now it should be visible
expect(container.querySelector('div')).toBeInTheDocument()
})
})
})
Loading