Skip to content

Commit

Permalink
chore(docs): update TutorialReactNative.md (jestjs#10802)
Browse files Browse the repository at this point in the history
  • Loading branch information
llauderesv committed Nov 10, 2020
1 parent 5deaa01 commit bafb4eb
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 36 deletions.
26 changes: 14 additions & 12 deletions docs/TutorialReactNative.md
Expand Up @@ -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 (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>
This is a React Native snapshot test.
</Text>
</View>
);
}
}

const styles = StyleSheet.create({
container: {
alignItems: 'center',
Expand All @@ -54,18 +67,7 @@ const styles = StyleSheet.create({
},
});

export default class Intro extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>
This is a React Native snapshot test.
</Text>
</View>
);
}
}
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:
Expand Down
26 changes: 14 additions & 12 deletions website/versioned_docs/version-22.x/TutorialReactNative.md
Expand Up @@ -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 (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>
This is a React Native snapshot test.
</Text>
</View>
);
}
}

const styles = StyleSheet.create({
container: {
alignItems: 'center',
Expand All @@ -55,18 +68,7 @@ const styles = StyleSheet.create({
},
});

export default class Intro extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>
This is a React Native snapshot test.
</Text>
</View>
);
}
}
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:
Expand Down
26 changes: 14 additions & 12 deletions website/versioned_docs/version-25.x/TutorialReactNative.md
Expand Up @@ -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 (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>
This is a React Native snapshot test.
</Text>
</View>
);
}
}

const styles = StyleSheet.create({
container: {
alignItems: 'center',
Expand All @@ -55,18 +68,7 @@ const styles = StyleSheet.create({
},
});

export default class Intro extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>
This is a React Native snapshot test.
</Text>
</View>
);
}
}
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:
Expand Down

0 comments on commit bafb4eb

Please sign in to comment.