Skip to content

Commit

Permalink
feat(fireEvent): make read-only event target properties definable for…
Browse files Browse the repository at this point in the history
… testing
  • Loading branch information
9inpachi committed Aug 30, 2021
1 parent ff84a50 commit b09c02e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@ function createEvent(
value: files,
})
}
Object.assign(node, targetProperties)

const modifiableProperties = {}
Object.keys(targetProperties).forEach(key => {
modifiableProperties[key] = {
value: targetProperties[key],
writable: true,
}
})
Object.defineProperties(node, modifiableProperties)

const window = getWindowFromNode(node)
const EventConstructor = window[EventType] || window.Event
let event
Expand Down

0 comments on commit b09c02e

Please sign in to comment.