UNPKG

2.09 kBJavaScriptView Raw
1/**
2 * Copyright (c) 2015-present, Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
8 *
9 * @providesModule IntegrationTestsApp
10 */
11'use strict';
12
13var React = require('react-native');
14var createClass = require('create-react-class');
15
16var {
17 AppRegistry,
18 ScrollView,
19 StyleSheet,
20 Text,
21 TouchableOpacity,
22 View,
23} = React;
24
25var TESTS = [
26 require('./IntegrationTestHarnessTest'),
27 require('./FSTest')
28];
29
30TESTS.forEach(
31 (test) => AppRegistry.registerComponent(test.displayName, () => test)
32);
33
34var 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
73var 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
91AppRegistry.registerComponent('IntegrationTestsApp', () => IntegrationTestsApp);