-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
storiesOf().add() reads fn.name if only 1 arg provided #27
Conversation
Okay. I am fine with this. But I wanna know really how you use this. May be that helps me to do the documentation. |
Basically my use case is that I want to use the same 'stories' (ie. components + props) for like this: import React from 'react'
import test from 'blue-tape'
import {shallow} from 'enzyme'
import StepHeader from '../step-header'
const props = {
file: { name: 'name of the file' },
name: 'name of the project',
table: {
length: 1234,
columns: { length: 56 },
},
}
const tableAsValue = () => <StepHeader {...props} />
const tableAsPromiseState = () => <StepHeader {...props} table={PromiseState.resolve(props.table)} />
storiesOf('StepHeader', module)
.add(tableAsValue)
.add(tableAsPromiseState)
test('<StepHeader /> table as value', t => {
const wrapper = shallow(tableAsValue())
t.true(wrapper.contains(props.name))
t.end()
})
test('<StepHeader /> table as PromiseState', t => {
const wrapper = shallow(tableAsPromiseState())
t.true(wrapper.contains(props.name))
t.end()
}) |
Do you have any concrete plans for how to integrate stories with tests? From my limited time using storybook it seems that another missing piece is for |
Okay. About tests. Both tests and stories are two different things.
Stories are usually create by designers (for anyone who play that role). Then developers writes tests for the functionality. That's to make sure, designers do not break the app. That's how we think about testing. |
Hey, we talked about this PR. Although I like it, this violate one of our API design goals. Which is: There should be only one way to do something This violate that. Finally, really appreciate working on this. |
Thanks for considering it. In the end this was nothing more than a convenience. About tests, I know tests and stories are different things, my point is that, at least for me, they usually end up sharing one thing, the props passed to the component. Since stories are little more than props + component, I'm thinking it suits my needs for the tests to operate on the stories |
@nfcampos yeah. That's a good idea too. |
Reset test state before each run in watch mode
Remove src/ from paths in the REACT/WEBPACK_REACT Welcome.js component
Need to build before we can deploy
improve perf by upgrading from Yarn to Yann
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 950d0f2. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
This change helps when the function provided to .add() is reused in the same file for eg. tests, so it is defined outside of the call to .add() and assigned to a variable. The story takes the name of the function/variable.