Skip to content

Commit b55ffc1

Browse files
committed
test(fireEvent): add test spec for read-only target properties
1 parent 32ad741 commit b55ffc1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/__tests__/events.js

+10
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,16 @@ test('assigns clipboardData properties', () => {
376376
expect(clipboardData.getData('text')).toBe('example')
377377
})
378378

379+
test('assigns read-only target properties', () => {
380+
const node = document.createElement('div')
381+
const spy = jest.fn()
382+
node.addEventListener('scroll', spy)
383+
384+
expect(node.scrollWidth).toBe(0)
385+
fireEvent.scroll(node, {target: {scrollWidth: 10}})
386+
expect(node.scrollWidth).toBe(10)
387+
})
388+
379389
test('fires events on Window', () => {
380390
const messageSpy = jest.fn()
381391
window.addEventListener('message', messageSpy)

0 commit comments

Comments
 (0)