From d20be53455461d561ff820947e9da250fd3666c9 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Wed, 6 Feb 2019 18:26:26 +0000 Subject: [PATCH] Document test renderer act (temporary fix) --- content/docs/addons-test-utils.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content/docs/addons-test-utils.md b/content/docs/addons-test-utils.md index 40cec512..12606b5a 100644 --- a/content/docs/addons-test-utils.md +++ b/content/docs/addons-test-utils.md @@ -46,6 +46,10 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm To prepare a component for assertions, wrap the code rendering it and performing updates inside an `act()` call. This makes your test run closer to how React works in the browser. +>Note +> +>If you use `react-test-renderer`, it also provides an `act` export that behaves the same way. + For example, let's say we have this `Counter` component: ```js @@ -342,4 +346,4 @@ ReactTestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13}); > > You will have to provide any event property that you're using in your component (e.g. keyCode, which, etc...) as React is not creating any of these for you. -* * * \ No newline at end of file +* * *