Skip to content

Commit 60ea652

Browse files
committed
Revert "[New] shallow: Add invoke(eventName, ...args)"
This reverts commit eb14926cbc5de867745ca7c892bda533ddff043b.
1 parent 258823f commit 60ea652

File tree

6 files changed

+0
-294
lines changed

6 files changed

+0
-294
lines changed

SUMMARY.md

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
* [hasClass(className)](/docs/api/ShallowWrapper/hasClass.md)
4949
* [hostNodes()](/docs/api/ShallowWrapper/hostNodes.md)
5050
* [html()](/docs/api/ShallowWrapper/html.md)
51-
* [invoke(event[, ...args])](/docs/api/ShallowWrapper/invoke.md)
5251
* [instance()](/docs/api/ShallowWrapper/instance.md)
5352
* [is(selector)](/docs/api/ShallowWrapper/is.md)
5453
* [isEmpty()](/docs/api/ShallowWrapper/isEmpty.md)

docs/api/ShallowWrapper/invoke.md

-39
This file was deleted.

docs/api/shallow.md

-3
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ Returns the key of the current node.
180180
#### [`.simulate(event[, data]) => ShallowWrapper`](ShallowWrapper/simulate.md)
181181
Simulates an event on the current node.
182182

183-
#### [`.invoke(event[, ...args]) => Any`](ShallowWrapper/invoke.md)
184-
Invokes an event handler on the current node and returns the handlers value.
185-
186183
#### [`.setState(nextState) => ShallowWrapper`](ShallowWrapper/setState.md)
187184
Manually sets state of the root component.
188185

packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,6 @@ describe('shallow', () => {
12031203
'hostNodes',
12041204
'html',
12051205
'instance',
1206-
'invoke',
12071206
'is',
12081207
'isEmpty',
12091208
'isEmptyRender',

packages/enzyme-test-suite/test/shared/methods/invoke.jsx

-224
This file was deleted.

packages/enzyme/src/ShallowWrapper.js

-26
Original file line numberDiff line numberDiff line change
@@ -1106,32 +1106,6 @@ class ShallowWrapper {
11061106
return this.type() === null ? cheerio() : cheerio.load('')(this.html());
11071107
}
11081108

1109-
/*
1110-
* Used to simulate events. Pass an eventname and (optionally) event arguments.
1111-
* Will invoke an event handler prop of the same name and return its value.
1112-
*
1113-
* @param {String} event
1114-
* @param {Array} args
1115-
* @returns {Any}
1116-
*/
1117-
invoke(event, ...args) {
1118-
return this.single('invoke', () => {
1119-
const handler = this.prop(propFromEvent(event));
1120-
let response = null;
1121-
1122-
if (handler) {
1123-
withSetStateAllowed(() => {
1124-
performBatchedUpdates(this, () => {
1125-
response = handler(...args);
1126-
});
1127-
this.root.update();
1128-
});
1129-
}
1130-
1131-
return response;
1132-
});
1133-
}
1134-
11351109
/**
11361110
* Used to simulate events. Pass an eventname and (optionally) event arguments. This method of
11371111
* testing events should be met with some skepticism.

0 commit comments

Comments
 (0)