# Self-review: Writing more test scenarios - Advanced React

1. **What’s the correct call to fire an** `onChange` **event on an input with react-testing-library’s** `fireEvent` **API?**
    
    * ```javascript
        fireEvent.change(input, { target: { value: 'myValue' } });
        ```
        
    * ```javascript
        fireEvent.change(input, { value: 'myValue' });
        ```
        
    * ```javascript
        fireEvent.onChange(input, { target: { value: 'myValue' } }); 
        ```
        
2. How would you fire a click event on a submit button with react-testing-library `fireEvent` API?
    
    * ```javascript
        fireEvent.onClick(button);
        ```
        
    * ```javascript
        fireEvent.click(button);
        ```
        
    * ```javascript
        fireEvent.onClick(button, { target: { value: 'submit' } });
        ```
        
3. **When locating an element by using one of the screen querying methods from react-testing-library, such as** `screen.getByRole` **or** `screen.getByLabelText`**, what would be the return value of the call if the element is not found?**
    
    * <mark>An error will be thrown</mark>
        
    * null
        
    * undefined
        

---

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1726476067022/28f0b312-5659-4816-95b0-91b46bed8667.png align="center")
