Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding more component jest snapshots #30

Merged
merged 25 commits into from
Dec 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2c3000d
refs #22
marcelomorgado Dec 18, 2018
7fda7ae
Merge branch 'develop' into feature/snapshots
pcowgill Dec 18, 2018
e5732e4
Merge pull request #7 from pcowgill/feature/snapshots
marcelomorgado Dec 18, 2018
ceed977
Screen/Presentational components refactoring
marcelomorgado Dec 18, 2018
59ed95d
Screens components snapshot update
marcelomorgado Dec 18, 2018
0cf20ba
Presentational components tests & snapshots
marcelomorgado Dec 18, 2018
60ce394
Bug fix
marcelomorgado Dec 18, 2018
2926d9c
Merge branch 'feature/snapshots' of https://github.com/marcelomorgado…
marcelomorgado Dec 18, 2018
2ad694f
Merge branch 'develop' of https://github.com/tasitlabs/tasit into fea…
marcelomorgado Dec 18, 2018
4ec934a
Merge branch 'develop' into feature/snapshots
pcowgill Dec 18, 2018
1170dc4
Update demo/components/presentational/EthereumQuestion.js
pcowgill Dec 19, 2018
a4290da
Update demo/components/presentational/EthereumSignIn.js
pcowgill Dec 19, 2018
8416143
Update demo/components/presentational/Home.js
pcowgill Dec 19, 2018
f3c0081
Update demo/components/presentational/LandClaim.js
pcowgill Dec 19, 2018
bf976c4
Update demo/components/presentational/ListLands.js
pcowgill Dec 19, 2018
17daf30
Update demo/components/presentational/OnboardingHome.js
pcowgill Dec 19, 2018
aac14c4
Update demo/screens/EthereumQuestionScreen.js
pcowgill Dec 19, 2018
2646ea3
Update demo/screens/EthereumSignInScreen.js
pcowgill Dec 19, 2018
f8f6a47
Update demo/screens/EthereumSignUpScreen.js
pcowgill Dec 19, 2018
02b6958
Update demo/screens/HomeScreen.js
pcowgill Dec 19, 2018
94db968
Update demo/screens/LandClaimScreen.js
pcowgill Dec 19, 2018
bd354cc
Update demo/screens/OnboardingHomeScreen.js
pcowgill Dec 19, 2018
f8f718c
Removing old components (without Screen suffix).
marcelomorgado Dec 19, 2018
47f3899
react-native-responsive-dimensions
marcelomorgado Dec 19, 2018
951427b
Update snapshots of components affected by responsive-dimentions
marcelomorgado Dec 19, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions demo/AppNavigator.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import { createStackNavigator, createAppContainer } from "react-navigation";
import Home from "./screens/Home";
import ListLands from "./screens/ListLands";
import LandClaim from "./screens/LandClaim";
import OnboardingHome from "./screens/OnboardingHome";
import EthereumQuestion from "./screens/EthereumQuestion";
import EthereumSignUp from "./screens/EthereumSignUp";
import EthereumSignIn from "./screens/EthereumSignIn";
import Colors from "@constants/Colors";

import HomeScreen from "./screens/HomeScreen";
import ListLandsScreen from "./screens/ListLandsScreen";
import LandClaimScreen from "./screens/LandClaimScreen";
import OnboardingHomeScreen from "./screens/OnboardingHomeScreen";
import EthereumQuestionScreen from "./screens/EthereumQuestionScreen";
import EthereumSignUpScreen from "./screens/EthereumSignUpScreen";
import EthereumSignInScreen from "./screens/EthereumSignInScreen";
import Colors from "@constants/Colors.js";

const AppNavigator = createStackNavigator(
{
Home,
ListLands,
LandClaim,
OnboardingHome,
EthereumQuestion,
EthereumSignUp,
EthereumSignIn,
HomeScreen,
ListLandsScreen,
LandClaimScreen,
OnboardingHomeScreen,
EthereumQuestionScreen,
EthereumSignUpScreen,
EthereumSignInScreen,
},
{
initialRouteName: "Home",
initialRouteName: "HomeScreen",
defaultNavigationOptions: {
headerStyle: {
backgroundColor: Colors.headerBackgroundColor,
Expand Down
32 changes: 32 additions & 0 deletions demo/components/presentational/EthereumQuestion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";
import { Button, StyleSheet, View } from "react-native";
import { responsiveHeight } from "react-native-responsive-dimensions";
import LargeText from "./LargeText";
import Colors from "@constants/Colors";

export default function EthereumQuestion(props) {
return (
<View style={styles.container}>
<LargeText>{`Are you new to Ethereum?`}</LargeText>
<View style={styles.buttonView}>
<Button title="Yep" onPress={props.onSignUp} />
</View>
<View style={styles.buttonView}>
<Button title="Nope" onPress={props.onSignIn} />
</View>
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.backgroundColor,
alignItems: "center",
justifyContent: "center",
},
buttonView: {
flexDirection: "row",
marginTop: responsiveHeight(4),
},
});
11 changes: 11 additions & 0 deletions demo/components/presentational/EthereumQuestion.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";
import { shallow } from "enzyme";
import EthereumQuestion from "./EthereumQuestion";

describe("EthereumQuestion", () => {
it("renders the component", async () => {
expect(
shallow(<EthereumQuestion onSignUp={() => {}} onSignIn={() => {}} />)
).toMatchSnapshot();
});
});
29 changes: 29 additions & 0 deletions demo/components/presentational/EthereumSignIn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from "react";
import { Button, StyleSheet, View } from "react-native";
import { responsiveHeight } from "react-native-responsive-dimensions";
import LargeText from "./LargeText";
import Colors from "@constants/Colors";

export default function EthereumSignIn(props) {
return (
<View style={styles.container}>
<LargeText>{`Cool. Let's start by hooking this app with your wallet.`}</LargeText>
<View style={styles.buttonView}>
<Button title="Connect with WalletConnect" onPress={props.onConnect} />
</View>
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.backgroundColor,
alignItems: "center",
justifyContent: "center",
},
buttonView: {
flexDirection: "row",
marginTop: responsiveHeight(5),
},
});
9 changes: 9 additions & 0 deletions demo/components/presentational/EthereumSignIn.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";
import { shallow } from "enzyme";
import EthereumSignIn from "./EthereumSignIn";

describe("EthereumSignIn", () => {
it("renders the component", async () => {
expect(shallow(<EthereumSignIn onConnect={() => {}} />)).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React from "react";
import { StyleSheet, KeyboardAvoidingView } from "react-native";
import { responsiveHeight } from "react-native-responsive-dimensions";
import { Header } from "react-navigation";
import Colors from "@constants/Colors";
import LargeText from "@presentational/LargeText";
import EthereumSignUpForm from "@presentational/EthereumSignUpForm";

export default class EthereumSignUp extends React.Component {
render() {
const OFFSET = 20;
const OFFSET = responsiveHeight(3);
return (
<KeyboardAvoidingView
keyboardVerticalOffset={Header.HEIGHT + OFFSET}
Expand Down
9 changes: 9 additions & 0 deletions demo/components/presentational/EthereumSignUp.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";
import { shallow } from "enzyme";
import EthereumSignUp from "./EthereumSignUp";

describe("EthereumSignUp", () => {
it("renders the component", async () => {
expect(shallow(<EthereumSignUp />)).toMatchSnapshot();
});
});
15 changes: 12 additions & 3 deletions demo/components/presentational/EthereumSignUpForm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import React from "react";
import { Button, StyleSheet, View, Text, TextInput } from "react-native";
import {
responsiveHeight,
responsiveWidth,
responsiveFontSize,
} from "react-native-responsive-dimensions";
import { Account } from "tasit-sdk";

export default class EthereumSignUpForm extends React.Component {
Expand Down Expand Up @@ -43,11 +48,15 @@ export default class EthereumSignUpForm extends React.Component {
const styles = StyleSheet.create({
userRow: { flexDirection: "row" },
userInputView: { flex: 1, alignItems: "flex-end" },
userInput: { justifyContent: "flex-start", width: 90, fontSize: 20 },
userInput: {
justifyContent: "flex-start",
width: responsiveWidth(28),
fontSize: responsiveFontSize(3),
},
ensView: { flex: 1 },
ensText: { justifyContent: "flex-end", fontSize: 20 },
ensText: { justifyContent: "flex-end", fontSize: responsiveFontSize(3) },
buttonView: {
flexDirection: "row",
marginTop: 30,
marginTop: responsiveHeight(5),
},
});
23 changes: 23 additions & 0 deletions demo/components/presentational/Home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from "react";
import { Image, Button, StyleSheet, View } from "react-native";
import LargeText from "./LargeText";
import Colors from "@constants/Colors";

export default function Home(props) {
return (
<View style={styles.container}>
<Image source={require("../../assets/images/icon.png")} />
<LargeText>{`Tasit`}</LargeText>
<Button title="Decentraland" onPress={props.onPress} />
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.backgroundColor,
alignItems: "center",
justifyContent: "center",
},
});
9 changes: 9 additions & 0 deletions demo/components/presentational/Home.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";
import { shallow } from "enzyme";
import Home from "./Home";

describe("Home", () => {
it("renders the component", async () => {
expect(shallow(<Home onPress={() => {}} />)).toMatchSnapshot();
});
});
3 changes: 2 additions & 1 deletion demo/components/presentational/Land.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import { Image, StyleSheet, View, Text } from "react-native";
import { responsiveWidth } from "react-native-responsive-dimensions";

export default function Land({ land }) {
return (
Expand All @@ -15,6 +16,6 @@ export default function Land({ land }) {

const styles = StyleSheet.create({
landContainer: {
width: 224,
width: responsiveWidth(60),
},
});
16 changes: 16 additions & 0 deletions demo/components/presentational/Land.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
import { shallow } from "enzyme";
import Land from "./Land";

describe("Land", () => {
it("renders the component", async () => {
const land = {
id: -1,
name: "Not found",
img: require("../../assets/images/icon.png"),
priceMana: 0,
priceUsd: 0,
};
expect(shallow(<Land land={land} />)).toMatchSnapshot();
});
});
33 changes: 33 additions & 0 deletions demo/components/presentational/LandClaim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react";
import { StyleSheet, View, Button } from "react-native";
import { responsiveHeight } from "react-native-responsive-dimensions";
import Land from "./Land";
import Colors from "@constants/Colors";

export default function LandClaim(props) {
return (
<View style={styles.container}>
<Land land={props.land} />
<View style={styles.buttonView}>
<Button
style={styles.claimButton}
title="Claim"
onPress={props.onClaim}
/>
</View>
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.backgroundColor,
alignItems: "center",
justifyContent: "center",
},
buttonView: {
flexDirection: "row",
marginTop: responsiveHeight(5),
},
});
9 changes: 9 additions & 0 deletions demo/components/presentational/LandClaim.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";
import { shallow } from "enzyme";
import LandClaim from "./LandClaim";

describe("LandClaim", () => {
it("renders the component", async () => {
expect(shallow(<LandClaim onClaim={() => {}} />)).toMatchSnapshot();
});
});
29 changes: 29 additions & 0 deletions demo/components/presentational/LandRow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from "react";
import { StyleSheet, View, TouchableHighlight } from "react-native";
import {
responsiveHeight,
responsiveWidth,
} from "react-native-responsive-dimensions";
import Land from "./Land";

export default function LandRow(props) {
return (
<TouchableHighlight onPress={props.onPress}>
<View style={styles.row}>
<Land land={props.land} />
</View>
</TouchableHighlight>
);
}

const styles = StyleSheet.create({
row: {
paddingTop: responsiveHeight(3),
pcowgill marked this conversation as resolved.
Show resolved Hide resolved
paddingBottom: responsiveHeight(3),
paddingLeft: responsiveWidth(3),
paddingRight: responsiveWidth(3),
marginBottom: responsiveHeight(1),
alignItems: "center",
justifyContent: "center",
},
});
9 changes: 9 additions & 0 deletions demo/components/presentational/LandRow.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";
import { shallow } from "enzyme";
import LandRow from "./LandRow";

describe("LandRow", () => {
it("renders the component", async () => {
expect(shallow(<LandRow />)).toMatchSnapshot();
});
});
7 changes: 5 additions & 2 deletions demo/components/presentational/LargeText.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React from "react";
import { StyleSheet, Text } from "react-native";
import { responsiveHeight } from "react-native-responsive-dimensions";
import {
responsiveHeight,
responsiveFontSize,
} from "react-native-responsive-dimensions";
import Colors from "@constants/Colors";

export default function LargeText(props) {
Expand All @@ -10,7 +13,7 @@ export default function LargeText(props) {
const styles = StyleSheet.create({
text: {
padding: responsiveHeight(2),
fontSize: 30,
fontSize: responsiveFontSize(4),
textAlign: "center",
fontWeight: "bold",
color: Colors.textColor,
Expand Down
9 changes: 9 additions & 0 deletions demo/components/presentational/LargeText.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";
import { shallow } from "enzyme";
import LargeText from "./LargeText";

describe("LargeText", () => {
it("renders the component", async () => {
expect(shallow(<LargeText />)).toMatchSnapshot();
});
});
20 changes: 20 additions & 0 deletions demo/components/presentational/ListLands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import { ListView, StyleSheet } from "react-native";
import Colors from "@constants/Colors";

export default function ListLands(props) {
return (
<ListView
style={styles.container}
dataSource={props.dataSource}
renderRow={props.renderRow}
/>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.backgroundColor,
},
});
9 changes: 9 additions & 0 deletions demo/components/presentational/ListLands.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";
import { shallow } from "enzyme";
import ListLands from "./ListLands";

describe("ListLands", () => {
it("renders the component", async () => {
expect(shallow(<ListLands />)).toMatchSnapshot();
});
});
Loading