Skip to content

Commit cbba710

Browse files
Fixing: addons-test-utils
1 parent 49be9c6 commit cbba710

File tree

1 file changed

+0
-71
lines changed

1 file changed

+0
-71
lines changed

content/docs/addons-test-utils.md

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,9 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm
1919

2020
> Nota:
2121
>
22-
<<<<<<< HEAD
23-
> Airbnb ha liberado una utilidad para pruebas llamada Enzyme, que hace fácil asegurar, manipular y navegar por el resultado de sus Componentes de React. Si está decidiendo que utilidad para pruebas unitarias utilizar junto con Jest u otra herramienta para pruebas, vale la pena darle un vistazo a: [http://airbnb.io/enzyme/](http://airbnb.io/enzyme/)
24-
>
25-
> Como otra opción, también hay otra utilidad para pruebas llamada react-testing-library diseñada para permitir e incentivar el escribir las pruebas de sus componentes de la misma forma en que los usuarios finales los usarían. De igual forma, funciona con cualquiera de los ejecutores de pruebas: [https://git.io/react-testing-library](https://git.io/react-testing-library)
26-
=======
2722
> We recommend using [`react-testing-library`](https://git.io/react-testing-library) which is designed to enable and encourage writing tests that use your components as the end users do.
2823
>
2924
> Alternatively, Airbnb has released a testing utility called [Enzyme](http://airbnb.io/enzyme/), which makes it easy to assert, manipulate, and traverse your React Components' output.
30-
>>>>>>> 98c1d22fbef2638cafb03b07e0eabe2a6186fca8
3125
3226
- [`act()`](#act)
3327
- [`mockComponent()`](#mockcomponent)
@@ -48,67 +42,6 @@ var ReactTestUtils = require('react-dom/test-utils'); // ES5 with npm
4842

4943
## Referencia
5044

51-
<<<<<<< HEAD
52-
## Renderizado superficial
53-
54-
Cuando se escriben pruebas de unidad para React, el renderizado superficial puede ser de ayuda. El renderizado superficial permite renderizar el componente "un nivel de profundidad" y asegurar lo que su método de renderizado retorna, sin preocuparse acerca del comportamiento de los componentes hijos, los cuales no son instanciados o renderizados. Esto no requiere de un DOM.
55-
56-
> Nota:
57-
>
58-
> El renderizado superficial se ha movido a `react-test-renderer/shallow`.<br>
59-
> [Puede encontrar más información sobre el renderizado superficial en su página de referencia](/docs/shallow-renderer.html)
60-
61-
## Otras utilidades
62-
63-
### `Simulate`
64-
65-
```javascript
66-
Simulate.{eventName}(
67-
element,
68-
[eventData]
69-
)
70-
```
71-
72-
Simula la ejecución de un evento en un nodo del DOM con los datos opcionales de evento `eventData`.
73-
74-
`Simulate` tiene un método para [cada uno de los eventos que React comprende](/docs/events.html#supported-events).
75-
76-
**Haciendo clic en un elemento**
77-
78-
```javascript
79-
// <button ref={(node) => this.button = node}>...</button>
80-
const node = this.button;
81-
ReactTestUtils.Simulate.click(node);
82-
```
83-
84-
**Cambiar el valor en un campo de entrada y presionar ENTER.**
85-
86-
```javascript
87-
// <input ref={(node) => this.textInput = node} />
88-
const node = this.textInput;
89-
node.value = 'giraffe';
90-
ReactTestUtils.Simulate.change(node);
91-
ReactTestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13});
92-
```
93-
94-
> Nota
95-
>
96-
> Se debe proveer cualquiera de las propiedades del evento que se esté usando en tu componente (p.e. keyCode, which, etc...) ya que React no creará ninguna de estas por ti.
97-
98-
* * *
99-
100-
### `renderIntoDocument()`
101-
102-
```javascript
103-
renderIntoDocument(element)
104-
```
105-
106-
Renderiza un Elemento de React en un nodo separado del DOM en el documento. **Esta función requiere un DOM**
107-
108-
> Nota:
109-
>
110-
> Necesitará tener `window`, `window.document` y `window.document.createElement` habilitados de forma global **antes** de importar `React`. De otro modo React pensará que no tiene acceso al DOM y los métodos como `setState` no funcionarán.
111-
=======
11245
### `act()`
11346

11447
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.
@@ -190,7 +123,6 @@ it('can render and update a counter', () => {
190123
```
191124

192125
Don't forget that dispatching DOM events only works when the DOM container is added to the `document`. You can use a helper like [`react-testing-library`](https://github.com/kentcdodds/react-testing-library) to reduce the boilerplate code.
193-
>>>>>>> 98c1d22fbef2638cafb03b07e0eabe2a6186fca8
194126

195127
* * *
196128

@@ -376,8 +308,6 @@ ReactDOM.render(element, domContainer);
376308
> You will need to have `window`, `window.document` and `window.document.createElement` globally available **before** you import `React`. Otherwise React will think it can't access the DOM and methods like `setState` won't work.
377309
378310
* * *
379-
<<<<<<< HEAD
380-
=======
381311

382312
## Other Utilities
383313

@@ -417,4 +347,3 @@ ReactTestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13});
417347
> 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.
418348
419349
* * *
420-
>>>>>>> 98c1d22fbef2638cafb03b07e0eabe2a6186fca8

0 commit comments

Comments
 (0)