Skip to content

Commit

Permalink
test(fireEvent): add test spec for read-only target properties
Browse files Browse the repository at this point in the history
  • Loading branch information
9inpachi committed Aug 31, 2021
1 parent b09c02e commit df76448
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/__tests__/events.js
Expand Up @@ -366,6 +366,16 @@ test('assigns clipboardData properties', () => {
expect(clipboardData.getData('text')).toBe('example')
})

test('assigns read-only target properties', () => {
const node = document.createElement('div')
const spy = jest.fn()
node.addEventListener('scroll', spy)

expect(node.scrollWidth).toBe(0)
fireEvent.scroll(node, {target: {scrollWidth: 10}})
expect(node.scrollWidth).toBe(10)
})

test('fires events on Window', () => {
const messageSpy = jest.fn()
window.addEventListener('message', messageSpy)
Expand Down

0 comments on commit df76448

Please sign in to comment.