You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/addons-test-utils.md
+3-12
Original file line number
Diff line number
Diff line change
@@ -122,13 +122,8 @@ it('can render and update a counter', () => {
122
122
});
123
123
```
124
124
125
-
<<<<<<< HEAD
126
-
Non dimenticare che generare degli eventi DOM ha effetto solamente quando il contenitore dello stesso è aggiunto al `document`. Puoi usare una libreria come [`react-testing-library`](https://github.com/kentcdodds/react-testing-library) per aumentare la pulizia del codice.
127
-
=======
128
-
- Don't forget that dispatching DOM events only works when the DOM container is added to the `document`. You can use a library like [React Testing Library](https://testing-library.com/react) to reduce the boilerplate code.
129
-
130
-
- The [`recipes`](/docs/testing-recipes.html) document contains more details on how `act()` behaves, with examples and usage.
131
-
>>>>>>> 941f54180ef5e652221f54ef6d1f6f2e9e063597
125
+
- Non dimenticare che generare degli eventi DOM ha effetto solamente quando il contenitore dello stesso è aggiunto al `document`. Puoi usare una libreria come [React Testing Library](https://testing-library.com/react) per aumentare la pulizia del codice.
126
+
- La documentazione sulle [`ricette`](/docs/testing-recipes.html) contiene maggiori dettagli su come funziona `act()`, insieme ad esempi d'uso.
132
127
133
128
* * *
134
129
@@ -145,11 +140,7 @@ Passare il mock di un componente a questo metodo consente di migliorarlo, metten
145
140
146
141
> Nota:
147
142
>
148
-
<<<<<<< HEAD
149
-
> `mockComponent()` è un'API legacy. Raccomandiamo l'utilizzo di [shallow rendering](/docs/shallow-renderer.html) oppure [`jest.mock()`](https://facebook.github.io/jest/docs/en/tutorial-react-native.html#mock-native-modules-using-jestmock).
150
-
=======
151
-
> `mockComponent()` is a legacy API. We recommend using [`jest.mock()`](https://facebook.github.io/jest/docs/en/tutorial-react-native.html#mock-native-modules-using-jestmock) instead.
152
-
>>>>>>> 941f54180ef5e652221f54ef6d1f6f2e9e063597
143
+
> `mockComponent()` è un'API legacy. Raccomandiamo l'utilizzo di [`jest.mock()`](https://facebook.github.io/jest/docs/en/tutorial-react-native.html#mock-native-modules-using-jestmock).
Questa documentazione riflette sempre l'ultima versione stabile di React. A partire da React 16, puoi trovare le vecchie versioni della documentazione [in una pagina separata](/versions). Nota che la documentazione per le versioni precedenti viene salvata al momento del rilascio, non riceve più aggiornamenti in seguito.
124
-
=======
125
-
This documentation always reflects the latest stable version of React. Since React 16, you can find older versions of the documentation on a [separate page](/versions). Note that documentation for past versions is snapshotted at the time of the release, and isn't being continuously updated.
126
-
>>>>>>> 941f54180ef5e652221f54ef6d1f6f2e9e063597
122
+
Questa documentazione riflette sempre l'ultima versione stabile di React. A partire da React 16, puoi trovare le vecchie versioni della documentazione in una [pagina separata](/versions). Nota che la documentazione per le versioni precedenti viene salvata al momento del rilascio, non riceve più aggiornamenti in seguito.
Copy file name to clipboardExpand all lines: content/docs/hooks-intro.md
+2-6
Original file line number
Diff line number
Diff line change
@@ -31,12 +31,8 @@ Questa nuova funzione `useState` è il primo "Hook" che impareremo, l'esempio ap
31
31
32
32
>Nota
33
33
>
34
-
<<<<<<< HEAD
35
-
>React 16.8.0 è la prima versione che supporta gli Hooks. Durante l'upgrade, non dimenticare di aggiornare tutti i pacchetti, incluso React DOM. React Native supporterà gli Hooks nella prossima release stabile.
36
-
=======
37
-
>React 16.8.0 is the first release to support Hooks. When upgrading, don't forget to update all packages, including React DOM.
38
-
>React Native supports Hooks since [the 0.59 release of React Native](https://facebook.github.io/react-native/blog/2019/03/12/releasing-react-native-059).
39
-
>>>>>>> 941f54180ef5e652221f54ef6d1f6f2e9e063597
34
+
>React 16.8.0 è la prima versione che supporta gli Hooks. Durante l'upgrade, non dimenticare di aggiornare tutti i pacchetti, incluso React DOM.
35
+
>React Native supporta gli Hooks a partire dalla [release 0.59 di React Native](https://facebook.github.io/react-native/blog/2019/03/12/releasing-react-native-059).
Crea un'istanza di `TestRenderer` tramite l'elemento React passato in input. Non utilizza il DOM reale, ma renderizza comunque in maniera completa l'alberatura del componente in memoria così da poter fare asserzioni su di essa.
108
-
=======
109
-
Create a `TestRenderer` instance with the passed React element. It doesn't use the real DOM, but it still fully renders the component tree into memory so you can make assertions about it. Returns a [TestRenderer instance](#testrenderer-instance).
106
+
Crea un'istanza di `TestRenderer` tramite l'elemento React passato in input. Non utilizza il DOM reale, ma renderizza comunque in maniera completa l'alberatura del componente in memoria così da poter fare asserzioni su di essa. Ritorna una [istanza di TestRenderer](#testrenderer-instance).
110
107
111
108
### `TestRenderer.act()` {#testrendereract}
112
109
113
110
```javascript
114
111
TestRenderer.act(callback);
115
112
```
116
113
117
-
Similar to the [`act()`helper from `react-dom/test-utils`](/docs/test-utils.html#act), `TestRenderer.act`prepares a component for assertions. Use this version of`act()`to wrap calls to `TestRenderer.create`and`testRenderer.update`.
114
+
Similarmente all'[helper `act()`di `react-dom/test-utils`](/docs/test-utils.html#act), `TestRenderer.act`prepara un componente per le asserzioni. Usa questa versione di`act()`per il wrapping di chiamate a `TestRenderer.create`e`testRenderer.update`.
118
115
119
116
```javascript
120
117
import {create, act} from'react-test-renderer';
121
-
importAppfrom'./app.js'; //The component being tested
118
+
importAppfrom'./app.js'; //Il componente in test
122
119
123
-
//render the component
120
+
//renderizzazione del componente
124
121
let root;
125
122
act(() => {
126
123
root =create(<App value={1}/>)
127
124
});
128
125
129
-
//make assertions on root
126
+
//asserzioni sulla root
130
127
expect(root.toJSON()).toMatchSnapshot();
131
128
132
-
//update with some different props
129
+
//aggiornamenti qualche props
133
130
act(() => {
134
131
root =root.update(<App value={2}/>);
135
132
})
136
133
137
-
//make assertions on root
134
+
//asserzioni sulla root
138
135
expect(root.toJSON()).toMatchSnapshot();
139
136
```
140
-
>>>>>>> 941f54180ef5e652221f54ef6d1f6f2e9e063597
141
137
142
138
### `testRenderer.toJSON()` {#testrenderertojson}
143
139
@@ -153,11 +149,7 @@ Ritorna un oggetto che raffigura l'albero renderizzato. Questo albero contiene s
153
149
testRenderer.toTree()
154
150
```
155
151
156
-
<<<<<<< HEAD
157
-
Ritorna un oggetto che raffigura l'albero renderizzato. A differenza di `toJSON()`, la rappresentazione è più dettagliata di quella fornita da `toJSON()`, e include componenti scritti dall'utente. Probabilmente non hai bisogno di questo metodo a meno che non stia scrivendo una tua libreria di asserzioni sul test renderer.
158
-
=======
159
-
Return an object representing the rendered tree. The representation is more detailed than the one provided by `toJSON()`, and includes the user-written components. You probably don't need this method unless you're writing your own assertion library on top of the test renderer.
160
-
>>>>>>> 941f54180ef5e652221f54ef6d1f6f2e9e063597
152
+
Ritorna un oggetto che raffigura l'albero renderizzato. La rappresentazione è più dettagliata di quella fornita da `toJSON()`, e include componenti scritti dall'utente. Probabilmente non hai bisogno di questo metodo a meno che non stia scrivendo una tua libreria di asserzioni sul test renderer.
0 commit comments