Skip to content
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

Add options to ShallowWrapper#shallow #275

Merged
merged 1 commit into from
Mar 21, 2016

Conversation

ncuillery
Copy link
Contributor

I have just enhanced the ShallowWrapper#shallow to support the same options arg as the top level shallow method.

It is useful when your component is wrapped by an high-order component like the ones provided in popular Flux implementations :

For example :

class MyComponent {
  [...]
}
MyComponent.contextTypes = {
  foo: React.PropTypes.string
}

export default connectToStore(MyComponent, [], () => {
  [...]
})

Then you can easily shallow render MyComponent:

const context = {foo: 'bar'};
const wrapper = shallow(MyComponent).shallow({ context })

I added the same context tests of shallow method to ShallowWrapper#shallow.

@lelandrichardson
Copy link
Collaborator

@ncuillery seems pretty reasonable. Looks like your branch is out of date though. You mind rebasing and fixing any conflicts?

Thanks.

@ncuillery
Copy link
Contributor Author

Done !

@ncuillery
Copy link
Contributor Author

Lint errors due to recent #276

I'll fix that

lelandrichardson added a commit that referenced this pull request Mar 21, 2016
Add options to ShallowWrapper#shallow
@lelandrichardson lelandrichardson merged commit d53be0d into enzymejs:master Mar 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants