Skip to content

Commit

Permalink
test: mock resize observer
Browse files Browse the repository at this point in the history
  • Loading branch information
pirhoo committed Jul 10, 2024
1 parent 30b758c commit f773504
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/unit/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ import createBootstrap from 'bootstrap-vue-next'

// @ts-expect-error type
config.global.plugins = [i18n, createBootstrap()]

// @ts-expect-error type
Object.defineProperty(document, 'fonts', {
value: { ready: Promise.resolve({}) }
})

global.ResizeObserver = vi.fn().mockImplementation(() => ({
observe: vi.fn(),
unobserve: vi.fn(),
disconnect: vi.fn()
}))

global.HTMLCanvasElement.prototype.getContext = () => null
global.HTMLCanvasElement.prototype.toDataURL = () => null
global.URL.createObjectURL = () => ''

0 comments on commit f773504

Please sign in to comment.