question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to call function props in stories?

See original GitHub issue

Hi, I am testing a component using Storyshots. This component contains function props like these:

action={() => action(key)}
actionReverse={() => actionReverse(key)}

However, since those functions are not called, I am unable to reach 100% coverage test on that component. How am I supposed to test those kind of props?

Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Hypnosphicommented, Oct 3, 2017

You’re doing good =) To enable snapshotting, just add this line:

expect(filterInput).toMatchSnapshot();
0reactions
zainfathonicommented, Oct 3, 2017

Got it, thanks! 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to call function props in stories? · Issue #1941
Hi, I am testing a component using Storyshots. This component contains function props like these: action={() => action(key)} ...
Read more >
Play function - Storybook - JS.ORG
Play functions are small snippets of code executed after the story renders. ... Run the following command to install the addon and the...
Read more >
Storybook call function which is a prop of the component
I have a component "Item" and a container. The container has a lazy Loading function, with which I load the items.
Read more >
How passing props to component works in React
Master how to pass props (properties) to components in React with this useful beginner's guide, including demo code.
Read more >
React: How To Access Props In A Functional Component
You have 2 free member-only stories left this month. ... them in your functional component callback just as you would with any other...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found