Skip to content

Commit

Permalink
Merge branch 'development' into another_skip
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmathou authored Oct 26, 2018
2 parents f62ab10 b1f88aa commit dc3e343
Show file tree
Hide file tree
Showing 10 changed files with 2,897 additions and 2,781 deletions.
20 changes: 19 additions & 1 deletion __test__/ConfirmModal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 82,22 @@ describe('ConfirmModal', () => {
expect(Alert.alert).toHaveBeenCalledWith('Modal has been closed.')
});
});
})

describe('clicking to change style', () => {
it('changes confirmPressStatus when clicked', () => {
cM.find('#finalConfirm').simulate('press');
expect(cM.state().confirmPressStatus).toEqual(true);
});
});

describe('state', () => {
it('is a method to return the state', () => {
const returnedState = cM.state();
expect(returnedState).toEqual({
modalVisible: false,
confirmPressStatus: true,
cancelPressStatus: true,
});
});
});
});
20 changes: 15 additions & 5 deletions __test__/PreviousSite.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 6,23 @@ import injectionsites from "../components/injectionsites";

describe('PreviousSite', () => {
it('renders text of previous site location and time', () => {
const time = moment()
const calTime = time.calendar()
const app = shallow(<PreviousSite site={ injectionsites[0] } time={time}/>);
const time = moment();
const app = shallow(<PreviousSite site={injectionsites[0]} time={time}/>);
const text = app
.find('#site')
.dive()
.text();
expect(text).toEqual("Previous: Left Thigh 1, " calTime);
})
expect(text).toEqual('Left Thigh 1\n');
});

it('renders the time of the last injection', () => {
const time = moment();
const calTime = time.calendar();
const app = shallow(<PreviousSite site={injectionsites[0]} time={time}/>);
const text = app
.find('#time')
.dive()
.text();
expect(text).toEqual(calTime);
});
});
6 changes: 3 additions & 3 deletions __test__/__snapshots__/BodyImages.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 6,9 @@ exports[`BodyImages renders correctly 1`] = `
style={
Object {
"alignSelf": "center",
"height": 280,
"padding": 10,
"width": 180,
"height": 290,
"padding": 5,
"width": 220,
}
}
/>
Expand Down
Binary file added assets/images/bizz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions components/BodyImages.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 64,9 @@ export default class BodyImages extends Component {

const styles = StyleSheet.create({
image: {
width: 180,
height: 280,
padding: 10,
width: 220,
height: 290,
padding: 5,
alignSelf: 'center'
}
});
73 changes: 68 additions & 5 deletions components/ConfirmModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 8,13 @@ import { nextInjSite, rotateNSites } from '../redux/actions/sites';
export default class ConfirmModal extends Component {
state = {
modalVisible: false,
};
confirmPressStatus: true,
cancelPressStatus: true,
};

state() {
return this.state;
}

setModalVisible(visible) {
this.setState({ modalVisible: visible });
Expand All @@ -29,25 35,59 @@ export default class ConfirmModal extends Component {
>
<View style={styles.container}>
<View>
<Text>
Confirm injection site: {this.props.site.side} {this.props.site.part} {this.props.site.quadrant} {'\n'}
<Text style={{fontSize: 20, fontStyle: 'italic'}}>
Confirm injection site:{'\n'}
</Text>
<Text style={{ fontWeight: 'bold', textAlign: 'center', fontSize: 20 }}>
{this.props.site.side} {this.props.site.part} {this.props.site.quadrant} {'\n'}
</Text>
<TouchableHighlight
underlayColor={'orange'}
activeOpacity={1}
id={"finalConfirm"}
style={
this.state.confirmPressStatus
? styles.buttonPress
: styles.button
}
onPress={() => {
this.setModalVisible(!this.state.modalVisible);
this.props.onConfirmation();
}}
>
<Text style={styles.text}>Confirm</Text>
<Text style={
this.state.confirmPressStatus
? styles.welcomePress
: styles.welcome
}
>
Confirm
</Text>
</TouchableHighlight>
<Text>
{'\n'}
</Text>
<TouchableHighlight
underlayColor={'#000066'}
activeOpacity={1}
id={"cancel"}
style={
this.state.cancelPressStatus
? styles.button
: styles.buttonPress
}

onPress={() => {
this.setModalVisible(!this.state.modalVisible);
}}
>
<Text style={styles.text}>Cancel</Text>
<Text style={
this.state.cancelPressStatus
? styles.welcome
: styles.welcomePress
}>
Cancel
</Text>
</TouchableHighlight>
</View>
</View>
Expand Down Expand Up @@ -80,5 120,28 @@ const styles = StyleSheet.create({
text: {
textAlign: 'center',
fontSize: 20
},
welcome: {
fontSize: 20,
textAlign: "center",
margin: 10,
color: "#ffffff"
},
welcomePress: {
fontSize: 20,
textAlign: "center",
margin: 10,
color: "#ffffff"
},
button: {
borderColor: "#000066",
borderWidth: 1,
borderRadius: 10,
},
buttonPress: {
borderColor: "#000066",
backgroundColor: "#000066",
borderWidth: 1,
borderRadius: 10,
}
});
18 changes: 13 additions & 5 deletions components/PreviousSite.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 4,10 @@ import { StyleSheet, Text, View } from 'react-native';
class PreviousSite extends Component {
render() {
return (
<View>
<Text id="site" style={styles.previous}>
Previous: { this.props.site.side } { this.props.site.part } { this.props.site.quadrant }, {this.props.time.calendar()}
<View style={{ marginBottom: 10 }}>
<Text>
<Text style={styles.previous}>Previous: </Text> <Text id="site" style={styles.site}>{ this.props.site.side } { this.props.site.part } { this.props.site.quadrant }{'\n'}</Text>
<Text style={styles.previous}>When: </Text><Text id="time" style={styles.site}>{this.props.time.calendar()}</Text>
</Text>
</View>
);
Expand All @@ -15,8 16,15 @@ class PreviousSite extends Component {

const styles = StyleSheet.create({
previous: {
fontSize: 25,
textAlign: 'center',
fontStyle: 'italic',
},
site: {
fontWeight: 'bold',
},
timeText: {
fontStyle: 'italic',
marginLeft: 30,
fontWeight: 'bold',
},
});

Expand Down
8 changes: 4 additions & 4 deletions navigation/MainTabNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 39,8 @@ HistoryStack.navigationOptions = {
focused={focused}
name={
Platform.OS === 'ios'
? `ios-link${focused ? '' : '-outline'}`
: 'md-link'
? `ios-book${focused ? '' : '-outline'}`
: 'md-book'
}
/>
)
Expand All @@ -57,8 57,8 @@ SettingsStack.navigationOptions = {
focused={focused}
name={
Platform.OS === 'ios'
? `ios-options${focused ? '' : '-outline'}`
: 'md-options'
? `ios-settings${focused ? '' : '-outline'}`
: 'md-settings'
}
/>
)
Expand Down
Loading

0 comments on commit dc3e343

Please sign in to comment.