Permalink
Browse files

Start/stop meetings and add them to list.

  • Loading branch information...
dblock committed Jul 1, 2018
1 parent b05d45d commit 249dd0096a444f4d7fb88c992988156ecc0d7165
39 App.js
@@ -1,45 +1,10 @@
import React from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import Main from './app/components/Main'

export default class App extends React.Component {
state = {
isMeetingStarted: false
}

startMeeting() {
this.setState({ isMeetingStarted: true })
}

stopMeeting() {
this.setState({ isMeetingStarted: false })
}

toggleMeeting() {
if (this.state.isMeetingStarted) {
this.stopMeeting();
} else {
this.startMeeting();
}
}

render() {
return (
<View style={styles.container}>
<Text>33 Minutes</Text>
<Button
onPress={() => this.toggleMeeting()}
title={ this.state.isMeetingStarted ? 'Stop Meeting' : 'Start Meeting' }>
</Button>
</View>
<Main />
);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
}
});
@@ -10,19 +10,5 @@ describe('app', () => {
const rendered = app.toJSON();
expect(rendered).toMatchSnapshot()
});

describe('toggle', () => {
it('start meeting', () => {
app.getInstance().toggleMeeting();
const rendered = app.toJSON();
expect(rendered).toMatchSnapshot()
});

it('stop meeting', () => {
app.getInstance().toggleMeeting();
const rendered = app.toJSON();
expect(rendered).toMatchSnapshot()
});
})
})

@@ -0,0 +1,17 @@
import React from 'react';
import Main from '../app/components/Main';

import renderer from 'react-test-renderer';

describe('main', () => {
const main = renderer.create(<Main />);

describe('toggle', () => {
it('start meeting', () => {
main.getInstance().toggleMeeting();
const rendered = main.toJSON();
expect(rendered).toMatchSnapshot()
});
})
})

@@ -4,228 +4,110 @@ exports[`app renders app 1`] = `
<View
style={
Object {
"alignItems": "center",
"backgroundColor": "#fff",
"flex": 1,
"justifyContent": "center",
}
}
>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
>
33 Minutes
</Text>
<View
accessibilityComponentType="button"
accessibilityLabel={undefined}
accessibilityTraits={
Array [
"button",
]
}
accessible={true}
collapsable={undefined}
hasTVPreferredFocus={undefined}
hitSlop={undefined}
isTVSelectable={true}
nativeID={undefined}
onLayout={undefined}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"opacity": 1,
"alignItems": "center",
"backgroundColor": "black",
"justifyContent": "center",
"marginBottom": 10,
"paddingTop": 20,
}
}
testID={undefined}
tvParallaxProperties={undefined}
>
<View
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Array [
Object {},
]
Object {
"color": "white",
"fontSize": 18,
"padding": 26,
}
}
>
<Text
accessible={true}
allowFontScaling={true}
disabled={undefined}
ellipsizeMode="tail"
style={
Array [
Object {
"color": "#007AFF",
"fontSize": 18,
"padding": 8,
"textAlign": "center",
},
]
}
>
Start Meeting
</Text>
</View>
- 33 Minutes -
</Text>
</View>
</View>
`;

exports[`app toggle start meeting 1`] = `
<View
style={
Object {
"alignItems": "center",
"backgroundColor": "#fff",
"flex": 1,
"justifyContent": "center",
}
}
>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
>
33 Minutes
</Text>
<View
accessibilityComponentType="button"
accessibilityLabel={undefined}
accessibilityTraits={
Array [
"button",
]
}
accessible={true}
collapsable={undefined}
hasTVPreferredFocus={undefined}
hitSlop={undefined}
isTVSelectable={true}
nativeID={undefined}
onLayout={undefined}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
<RCTScrollView
style={
Object {
"opacity": 1,
}
}
testID={undefined}
tvParallaxProperties={undefined}
>
<View
style={
Array [
Object {},
]
"flex": 1,
"marginBottom": 100,
}
>
<Text
accessible={true}
allowFontScaling={true}
disabled={undefined}
ellipsizeMode="tail"
style={
Array [
Object {
"color": "#007AFF",
"fontSize": 18,
"padding": 8,
"textAlign": "center",
},
]
}
>
Stop Meeting
</Text>
</View>
</View>
</View>
`;

exports[`app toggle stop meeting 1`] = `
<View
style={
Object {
"alignItems": "center",
"backgroundColor": "#fff",
"flex": 1,
"justifyContent": "center",
}
}
>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
>
33 Minutes
</Text>
<View />
</RCTScrollView>
<View
accessibilityComponentType="button"
accessibilityLabel={undefined}
accessibilityTraits={
Array [
"button",
]
}
accessible={true}
collapsable={undefined}
hasTVPreferredFocus={undefined}
hitSlop={undefined}
isTVSelectable={true}
nativeID={undefined}
onLayout={undefined}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"opacity": 1,
"borderTopWidth": 1,
"marginTop": 10,
"padding": 50,
}
}
testID={undefined}
tvParallaxProperties={undefined}
>
<View
style={
accessibilityComponentType="button"
accessibilityLabel={undefined}
accessibilityTraits={
Array [
Object {},
"button",
]
}
accessible={true}
collapsable={undefined}
hasTVPreferredFocus={undefined}
hitSlop={undefined}
isTVSelectable={true}
nativeID={undefined}
onLayout={undefined}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"opacity": 1,
}
}
testID={undefined}
tvParallaxProperties={undefined}
>
<Text
accessible={true}
allowFontScaling={true}
disabled={undefined}
ellipsizeMode="tail"
<View
style={
Array [
Object {
"color": "#007AFF",
"fontSize": 18,
"padding": 8,
"textAlign": "center",
},
Object {},
]
}
>
Start Meeting
</Text>
<Text
accessible={true}
allowFontScaling={true}
disabled={undefined}
ellipsizeMode="tail"
style={
Array [
Object {
"color": "#007AFF",
"fontSize": 18,
"padding": 8,
"textAlign": "center",
},
]
}
>
Start Meeting
</Text>
</View>
</View>
</View>
</View>
Oops, something went wrong.

0 comments on commit 249dd00

Please sign in to comment.