1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | 'use strict';
|
12 |
|
13 | var React = require('react-native');
|
14 | var createClass = require('create-react-class');
|
15 |
|
16 | var {
|
17 | AppRegistry,
|
18 | ScrollView,
|
19 | StyleSheet,
|
20 | Text,
|
21 | TouchableOpacity,
|
22 | View,
|
23 | } = React;
|
24 |
|
25 | var TESTS = [
|
26 | require('./IntegrationTestHarnessTest'),
|
27 | require('./FSTest')
|
28 | ];
|
29 |
|
30 | TESTS.forEach(
|
31 | (test) => AppRegistry.registerComponent(test.displayName, () => test)
|
32 | );
|
33 |
|
34 | var IntegrationTestsApp = createClass({
|
35 | getInitialState: function() {
|
36 | return {
|
37 | test: null,
|
38 | };
|
39 | },
|
40 | render: function() {
|
41 | if (this.state.test) {
|
42 | return (
|
43 | <ScrollView>
|
44 | <this.state.test />
|
45 | </ScrollView>
|
46 | );
|
47 | }
|
48 | return (
|
49 | <View style={styles.container}>
|
50 | <Text style={styles.row}>
|
51 | Click on a test to run it in this shell for easier debugging and
|
52 | development. Run all tests in the testing envirnment with cmd+U in
|
53 | Xcode.
|
54 | </Text>
|
55 | <View style={styles.separator} />
|
56 | <ScrollView>
|
57 | {TESTS.map((test) => [
|
58 | <TouchableOpacity onPress={() => this.setState({test})}>
|
59 | <View style={styles.row}>
|
60 | <Text style={styles.testName}>
|
61 | {test.displayName}
|
62 | </Text>
|
63 | </View>
|
64 | </TouchableOpacity>,
|
65 | <View style={styles.separator} />
|
66 | ])}
|
67 | </ScrollView>
|
68 | </View>
|
69 | );
|
70 | }
|
71 | });
|
72 |
|
73 | var styles = StyleSheet.create({
|
74 | container: {
|
75 | backgroundColor: 'white',
|
76 | marginTop: 40,
|
77 | margin: 15,
|
78 | },
|
79 | row: {
|
80 | padding: 10,
|
81 | },
|
82 | testName: {
|
83 | fontWeight: '500',
|
84 | },
|
85 | separator: {
|
86 | height: 1,
|
87 | backgroundColor: '#bbbbbb',
|
88 | },
|
89 | });
|
90 |
|
91 | AppRegistry.registerComponent('IntegrationTestsApp', () => IntegrationTestsApp);
|