From bafb4ebdf5b04a307643f08807c59664dc70befa Mon Sep 17 00:00:00 2001 From: Vince Llauderes Date: Tue, 10 Nov 2020 19:47:41 +0800 Subject: [PATCH] chore(docs): update TutorialReactNative.md (#10802) --- docs/TutorialReactNative.md | 26 ++++++++++--------- .../version-22.x/TutorialReactNative.md | 26 ++++++++++--------- .../version-25.x/TutorialReactNative.md | 26 ++++++++++--------- 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/docs/TutorialReactNative.md b/docs/TutorialReactNative.md index d0e1d4fc428a..fdebb6f84867 100644 --- a/docs/TutorialReactNative.md +++ b/docs/TutorialReactNative.md @@ -35,6 +35,19 @@ Let's create a [snapshot test](SnapshotTesting.md) for a small intro component w import React, {Component} from 'react'; import {StyleSheet, Text, View} from 'react-native'; +class Intro extends Component { + render() { + return ( + + Welcome to React Native! + + This is a React Native snapshot test. + + + ); + } +} + const styles = StyleSheet.create({ container: { alignItems: 'center', @@ -54,18 +67,7 @@ const styles = StyleSheet.create({ }, }); -export default class Intro extends Component { - render() { - return ( - - Welcome to React Native! - - This is a React Native snapshot test. - - - ); - } -} +export default Intro; ``` Now let's use React's test renderer and Jest's snapshot feature to interact with the component and capture the rendered output and create a snapshot file: diff --git a/website/versioned_docs/version-22.x/TutorialReactNative.md b/website/versioned_docs/version-22.x/TutorialReactNative.md index 0a1fd3b51f94..8b4b8e4330b3 100644 --- a/website/versioned_docs/version-22.x/TutorialReactNative.md +++ b/website/versioned_docs/version-22.x/TutorialReactNative.md @@ -36,6 +36,19 @@ Let's create a [snapshot test](SnapshotTesting.md) for a small intro component w import React, {Component} from 'react'; import {StyleSheet, Text, View} from 'react-native'; +class Intro extends Component { + render() { + return ( + + Welcome to React Native! + + This is a React Native snapshot test. + + + ); + } +} + const styles = StyleSheet.create({ container: { alignItems: 'center', @@ -55,18 +68,7 @@ const styles = StyleSheet.create({ }, }); -export default class Intro extends Component { - render() { - return ( - - Welcome to React Native! - - This is a React Native snapshot test. - - - ); - } -} +export default Intro; ``` Now let's use React's test renderer and Jest's snapshot feature to interact with the component and capture the rendered output and create a snapshot file: diff --git a/website/versioned_docs/version-25.x/TutorialReactNative.md b/website/versioned_docs/version-25.x/TutorialReactNative.md index 7ad8f4d6e3f7..712cdd72946b 100644 --- a/website/versioned_docs/version-25.x/TutorialReactNative.md +++ b/website/versioned_docs/version-25.x/TutorialReactNative.md @@ -36,6 +36,19 @@ Let's create a [snapshot test](SnapshotTesting.md) for a small intro component w import React, {Component} from 'react'; import {StyleSheet, Text, View} from 'react-native'; +class Intro extends Component { + render() { + return ( + + Welcome to React Native! + + This is a React Native snapshot test. + + + ); + } +} + const styles = StyleSheet.create({ container: { alignItems: 'center', @@ -55,18 +68,7 @@ const styles = StyleSheet.create({ }, }); -export default class Intro extends Component { - render() { - return ( - - Welcome to React Native! - - This is a React Native snapshot test. - - - ); - } -} +export default Intro; ``` Now let's use React's test renderer and Jest's snapshot feature to interact with the component and capture the rendered output and create a snapshot file: