Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: koba04 <koba0004@gmail.com>
  • Loading branch information
ljharb and koba04 committed Mar 18, 2019
1 parent 5e28ce4 commit 30313f7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/enzyme-test-suite/test/ReactWrapper-spec.jsx
Expand Up @@ -5436,7 +5436,8 @@ describeWithDOM('mount', () => {
wrapper.find('button').invoke('onClick')();
expect(wrapper.state('count')).to.equal(1);
});
it('can return the handlers return value', () => {

it('can return the handlers’ return value', () => {
const spy = sinon.stub().returns(123);
class Foo extends React.Component {
render() {
Expand All @@ -5452,6 +5453,7 @@ describeWithDOM('mount', () => {
expect(value).to.equal(123);
expect(spy.called).to.equal(true);
});

it('can pass in arguments', () => {
const spy = sinon.spy();
class Foo extends React.Component {
Expand Down
4 changes: 3 additions & 1 deletion packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx
Expand Up @@ -5517,7 +5517,8 @@ describe('shallow', () => {
wrapper.find('button').invoke('onClick')();
expect(wrapper.state('count')).to.equal(1);
});
it('can return the handlers return value', () => {

it('can return the handlers’ return value', () => {
const spy = sinon.stub().returns(123);
class Foo extends React.Component {
render() {
Expand All @@ -5533,6 +5534,7 @@ describe('shallow', () => {
expect(value).to.equal(123);
expect(spy.called).to.equal(true);
});

it('can pass in arguments', () => {
const spy = sinon.spy();
class Foo extends React.Component {
Expand Down
4 changes: 2 additions & 2 deletions packages/enzyme/src/ReactWrapper.js
Expand Up @@ -813,10 +813,10 @@ class ReactWrapper {
return this.single('invoke', () => {
const handler = this.prop(propName);
if (typeof handler !== 'function') {
throw new TypeError('ReactWrapper::invoke() expects a function prop name as its first argument');
throw new TypeError('ReactWrapper::invoke() requires the name of a prop whose value is a function');
}
return (...args) => {
const response = handler.apply(this, args);
const response = handler(...args);
this[ROOT].update();
return response;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/enzyme/src/ShallowWrapper.js
Expand Up @@ -1143,10 +1143,10 @@ class ShallowWrapper {
return this.single('invoke', () => {
const handler = this.prop(propName);
if (typeof handler !== 'function') {
throw new TypeError('ShallowWrapper::invoke() expects a function prop name as its first argument');
throw new TypeError('ShallowWrapper::invoke() requires the name of a prop whose value is a function');
}
return (...args) => {
const response = handler.apply(this, args);
const response = handler(...args);
this[ROOT].update();
return response;
};
Expand Down

0 comments on commit 30313f7

Please sign in to comment.