Skip to content

Commit

Permalink
Merge branch 'master' into issue1916
Browse files Browse the repository at this point in the history
  • Loading branch information
sstern6 committed Mar 22, 2019
2 parents 9d4b3b7 + 7ff8ea2 commit d166048
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
20 changes: 0 additions & 20 deletions packages/enzyme-test-suite/test/ReactWrapper-spec.jsx
Expand Up @@ -416,26 +416,6 @@ describeWithDOM('mount', () => {
expect(wrapper.context().name).to.equal(context.name);
expect(wrapper.context('name')).to.equal(context.name);
});

itIf(is('< 16'), 'works with SFCs', () => {
const Foo = ({ foo }) => (
<div>
<div className="bar">bar</div>
<div className="qoo">{foo}</div>
</div>
);

Foo.contextTypes = {
_: PropTypes.string,
};

const wrapper = mount(<Foo foo="qux" />, {
context: {
_: 'foo',
},
});
expect(wrapper.context('_')).to.equal('foo');
});
});
});

Expand Down
5 changes: 3 additions & 2 deletions packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx
Expand Up @@ -284,6 +284,7 @@ describe('shallow', () => {
);
SimpleComponent.contextTypes = { name: PropTypes.string };

const context = { name: 'foo' };
const wrapper = shallow(<SimpleComponent />, { context });

expect(wrapper.context().name).to.equal(context.name);
Expand Down Expand Up @@ -790,11 +791,11 @@ describe('shallow', () => {

expect(() => wrapper.contains({})).to.throw(
Error,
'ShallowWrapper::contains() can only be called with ReactElement (or array of them), string or number as argument.', // eslint-disable-line max-len
'ShallowWrapper::contains() can only be called with a ReactElement (or an array of them), a string, or a number as an argument.',
);
expect(() => wrapper.contains(() => ({}))).to.throw(
Error,
'ShallowWrapper::contains() can only be called with ReactElement (or array of them), string or number as argument.', // eslint-disable-line max-len
'ShallowWrapper::contains() can only be called with a ReactElement (or an array of them), a string, or a number as an argument.',
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/enzyme/src/ShallowWrapper.js
Expand Up @@ -757,7 +757,7 @@ class ShallowWrapper {
contains(nodeOrNodes) {
const adapter = getAdapter(this[OPTIONS]);
if (!isReactElementAlike(nodeOrNodes, adapter)) {
throw new Error('ShallowWrapper::contains() can only be called with ReactElement (or array of them), string or number as argument.');
throw new Error('ShallowWrapper::contains() can only be called with a ReactElement (or an array of them), a string, or a number as an argument.');
}
const predicate = Array.isArray(nodeOrNodes)
? other => containsChildrenSubArray(
Expand Down

0 comments on commit d166048

Please sign in to comment.