score:2
Accepted answer
looks like you're passing e.target
to wrapper.simulate
...
...just change that to e
and it should work:
it("should call props.cellclick() whith e.target argument", () => {
wrapper.simulate("click", e); // <= pass e
expect(cellclick.mock.calls[0][0]).tobe(e.target); // success!
});
Source: stackoverflow.com
Related Query
- How can I check a function for having arguments without checking their values, using jest & enzyme in react component?
- How to replicate the nextjs getStaticProps() function for all pages without having to repeat all pages
- How can I wait for multiple promises to all be done before using their return data for another function call?
- How can I setup flow to check ALL files in create react app without checking node_modules?
- How can I check for null values within my data prior to passing onClick props?
- How can I store the value of an async function to be used multiple times in a function without having to make the async call multiple times?
- How can I use Map function for an Array with values and another array as a value in Javascript
- How can I define TypeScript type for a setState function when React.Dispatch<React.SetStateAction<string>> not accepted?
- How can ı pass function with state for react useContext
- How i can create the function for the countdown in React native?
- How can I format my values for the x-axis in nivo line?
- How to pass arguments to callback in React + Typescript without new function creation?
- How can we write a click handler for a Stateless Function Component in React JS
- How can I create a reusable function that will setState for a variable object property?
- In React, how can I add a copy-to-clipboard functionality, by writing a simple function without any files imported?
- How can I map a concatenated value for this state, without it being passed as a string?
- How can I disable CORS for a single route in Express without rewriting all of my routes?
- How to create generic typescript function that binds arguments for storybook control
- How to define an interface for React function component with defaultProps without throwing missing type error?
- In Reactjs, how to make a prop function do separate tasks and return their values according to the required condition
- How dynamically import multiple exports from module without knowing their values beforehand
- Rendering text boxes using map function for each object in this.state array. how can i handle text in the text area
- How can you generate predictable react keys for items without unique ids?
- How can I trigger a child component function only for some specific parents component in next js?
- How can i intercept a component to check for permission
- How to wait for Promise.all to resolve before returning values in async function (express JS)
- How can i export a function without passing it as props or using the export keyword?
- How can I check for a value in a conditional array?
- How can I use variables in useEffect without having them in a dependency?
- How to pass a function with arguments as prop in React without creating an arrow function
More Query from same tag
- Redux - reducers / action creators not linked properly to component
- React hyperlink in a NavLink
- How to style body tag with CSS-in-JS approach?
- Replace background image if the url is empty
- Accessing align environment in ReactMarkdown
- Displaying conditional jsx based on the state of info in a json file
- How do I create a list in of the type [number, number][ ] from values inside a nested dictionary?
- CORS issues. Github pages -> Heroku
- Serve a React app from Google Cloud Storage
- React - Keep form information after getting a 401 response from API
- Tic Tac Toe React Js : Not able to print location
- trying to configure next-auth signin page, but having a problem with getProviders()
- The TextField on Paper closes unexpectedly in Material UI
- How do I style a pseudoelement based on the element's own value?
- String useState Value Is Empty after Storing a Value in an API Response to It
- Material UI Palette custom color with ThemeProvider
- Each child in a list should have a unique "key" prop. in react
- React router v4 use declarative Redirect without rendering the current component
- SweetAlert is rendering if its hidden
- Component Style Update Not Waiting on setTimeOut Function
- Upload component not behaving as expected when supplied with the default file list
- Reseting the redux store/state when a User Logs Out
- React-Redux:reducer only return initial state
- Best practice for ReactJS form components
- What is the best way to trigger an redux action if the props changed after the react 16.3?
- Firebase hosting with react router
- Designing Component React is reusable
- Babel expects "," where there should be a "."?
- CSS in reactJS application does not apply text color
- How would I pass my converted timestamp date from fetch api to my component?