react-dom-testing
react-dom-testing copied to clipboard
New simulate syntax
I'm considering to support a less verbose chaining syntax:
simulate(element)
.click()
.change('.input', { value: 'foobar' })
.keyUp({ data: { keyCode: 13 } })
.click('.close')
I think we should keep supporting the current syntax for compatibility, but make this syntax that is shown in the documentation by default.
I think we should do some overloading for convenience:
simulate(element)
.<event>(<target selector>)
.<event>(<event options>)
.<event>(<target selector>, <event options>)
We should be able to get all of the events from React Simulate the following why:
Object.keys(Simulate).forEach(key => {
if (typeof Simulate[key] === 'function') {
// add even method
}
})
If we do this, we should probably make a codemod to upgrade consumer code.