From dfdddfd7cd15d676b6b1d99a018231916e1c9504 Mon Sep 17 00:00:00 2001 From: Daniela Borges Matos de Carvalho Date: Fri, 27 Oct 2017 12:40:58 +0100 Subject: [PATCH] Update test-utils to use refs correctly (#215) * Update test-utils to use refs correctly Update test-utils according to the new way of using refs: https://reactjs.org/docs/refs-and-the-dom.html * Tweak --- content/docs/addons-test-utils.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/docs/addons-test-utils.md b/content/docs/addons-test-utils.md index d83be3e6..cbdf09da 100644 --- a/content/docs/addons-test-utils.md +++ b/content/docs/addons-test-utils.md @@ -66,16 +66,16 @@ Simulate an event dispatch on a DOM node with optional `eventData` event data. **Clicking an element** ```javascript -// -const node = this.refs.button; +// +const node = this.button; ReactTestUtils.Simulate.click(node); ``` **Changing the value of an input field and then pressing ENTER.** ```javascript -// -const node = this.refs.input; +// this.textInput = node} /> +const node = this.textInput; node.value = 'giraffe'; ReactTestUtils.Simulate.change(node); ReactTestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13});