diff --git a/content/docs/reference-test-renderer.md b/content/docs/reference-test-renderer.md index 3de2d5752..90ed00295 100644 --- a/content/docs/reference-test-renderer.md +++ b/content/docs/reference-test-renderer.md @@ -6,20 +6,20 @@ layout: docs category: Reference --- -**Importing** +**Importazione** ```javascript import TestRenderer from 'react-test-renderer'; // ES6 const TestRenderer = require('react-test-renderer'); // ES5 with npm ``` -## Overview {#overview} +## Panoramica {#overview} -This package provides a React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM or a native mobile environment. +Questo package fornisce un renderizzatore React che può essere usato per renderizzare componenti React come oggetti Javascript puri, senza dipendere dal DOM o da un ambiente mobile nativo. -Essentially, this package makes it easy to grab a snapshot of the platform view hierarchy (similar to a DOM tree) rendered by a React DOM or React Native component without using a browser or [jsdom](https://github.com/tmpvar/jsdom). +Fondamentalmente, questo package permette di catturare facilmente uno snapshot della vista gerarchica della piattaforma (simile ad un albero DOM) renderizzata dal DOM di React o da un componente di React Native senza utilizzare un browser o [jsdom](https://github.com/tmpvar/jsdom). -Example: +Esempio: ```javascript import TestRenderer from 'react-test-renderer'; @@ -38,9 +38,9 @@ console.log(testRenderer.toJSON()); // children: [ 'Facebook' ] } ``` -You can use Jest's snapshot testing feature to automatically save a copy of the JSON tree to a file and check in your tests that it hasn't changed: [Learn more about it](https://facebook.github.io/jest/blog/2016/07/27/jest-14.html). +Puoi utilizzare la feature di snapshot testing di Jest per salvare automaticamente una copia dell'albero JSON in un file e verificare nei tuoi test che non sia cambiato: [Per saperne di più](https://facebook.github.io/jest/blog/2016/07/27/jest-14.html). -You can also traverse the output to find specific nodes and make assertions about them. +Puoi anche navigare l'output per trovare nodi specifici e fare asserzioni su di essi. ```javascript import TestRenderer from 'react-test-renderer'; @@ -71,7 +71,7 @@ expect(testInstance.findByProps({className: "sub"}).children).toEqual(['Sub']); * [`TestRenderer.create()`](#testrenderercreate) -### TestRenderer instance {#testrenderer-instance} +### Istanza di TestRenderer {#testrenderer-instance} * [`testRenderer.toJSON()`](#testrenderertojson) * [`testRenderer.toTree()`](#testrenderertotree) @@ -94,7 +94,7 @@ expect(testInstance.findByProps({className: "sub"}).children).toEqual(['Sub']); * [`testInstance.parent`](#testinstanceparent) * [`testInstance.children`](#testinstancechildren) -## Reference {#reference} +## Riferimento {#reference} ### `TestRenderer.create()` {#testrenderercreate} @@ -102,7 +102,7 @@ expect(testInstance.findByProps({className: "sub"}).children).toEqual(['Sub']); TestRenderer.create(element, options); ``` -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. The returned instance has the following methods and properties. +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. ### `testRenderer.toJSON()` {#testrenderertojson} @@ -110,7 +110,7 @@ Create a `TestRenderer` instance with the passed React element. It doesn't use t testRenderer.toJSON() ``` -Return an object representing the rendered tree. This tree only contains the platform-specific nodes like `