diff --git a/packages/enzyme-adapter-react-16/src/ReactSixteenAdapter.js b/packages/enzyme-adapter-react-16/src/ReactSixteenAdapter.js
index 0fe85e834..afa65effa 100644
--- a/packages/enzyme-adapter-react-16/src/ReactSixteenAdapter.js
+++ b/packages/enzyme-adapter-react-16/src/ReactSixteenAdapter.js
@@ -474,7 +474,9 @@ class ReactSixteenAdapter extends EnzymeAdapter {
if (!eventFn) {
throw new TypeError(`ReactWrapper::simulate() event '${event}' does not exist`);
}
- eventFn(adapter.nodeToHostNode(node), mock);
+ wrapAct(() => {
+ eventFn(adapter.nodeToHostNode(node), mock);
+ });
},
batchedUpdates(fn) {
return fn();
diff --git a/packages/enzyme-test-suite/test/ReactWrapper-spec.jsx b/packages/enzyme-test-suite/test/ReactWrapper-spec.jsx
index f511ee28d..31867c086 100644
--- a/packages/enzyme-test-suite/test/ReactWrapper-spec.jsx
+++ b/packages/enzyme-test-suite/test/ReactWrapper-spec.jsx
@@ -1034,6 +1034,25 @@ describeWithDOM('mount', () => {
done();
}, 100);
});
+
+ it('works with `useEffect` simulated events', () => {
+ const effectSpy = sinon.spy();
+ function ComponentUsingEffectHook() {
+ useEffect(effectSpy);
+ const [counter, setCounter] = useState(0);
+
+ return (
+
+ );
+ }
+ const wrapper = mount();
+
+ const button = wrapper.find('button');
+ button.simulate('click');
+
+ expect(button.text()).to.equal('1');
+ expect(effectSpy).to.have.property('callCount', 2);
+ });
});
itIf(is('>= 16.2'), 'supports fragments', () => {