mirror of
https://github.com/langgenius/dify.git
synced 2026-04-23 20:36:14 +08:00
test: use happy dom (#34154)
This commit is contained in:
@ -11,7 +11,7 @@ describe('code.tsx components', () => {
|
||||
vi.clearAllMocks()
|
||||
vi.spyOn(console, 'error').mockImplementation(() => {})
|
||||
vi.useFakeTimers({ shouldAdvanceTime: true })
|
||||
// jsdom does not implement scrollBy; mock it to prevent stderr noise
|
||||
// The test DOM runtime does not implement scrollBy; mock it to prevent stderr noise
|
||||
window.scrollBy = vi.fn()
|
||||
})
|
||||
|
||||
|
||||
@ -307,7 +307,7 @@ describe('useDocToc', () => {
|
||||
|
||||
it('should update activeSection when scrolling past a section', async () => {
|
||||
vi.useFakeTimers()
|
||||
// innerHeight/2 = 384 in jsdom (default 768), so top <= 384 means "scrolled past"
|
||||
// innerHeight/2 = 384 with the default test viewport height (768), so top <= 384 means "scrolled past"
|
||||
const { scrollContainer, cleanup } = setupScrollDOM([
|
||||
{ id: 'intro', text: 'Intro', top: 100 },
|
||||
{ id: 'details', text: 'Details', top: 600 },
|
||||
|
||||
Reference in New Issue
Block a user