-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Functionality for testing picker ios (#605)
Implement functionality for changing the column values of pickers on IOS
- Loading branch information
1 parent
ae15bbf
commit 7b4a2f0
Showing
12 changed files
with
110 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"eslint.enable": false | ||
"eslint.enable": false, | ||
"git.ignoreLimitWarning": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
describe('DatePicker', () => { | ||
beforeEach(async () => { | ||
await device.reloadReactNative(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await element(by.text('DatePicker')).tap(); | ||
}); | ||
|
||
it('datePicker should trigger change handler correctly', async () => { | ||
await element(by.type('UIPickerView')).setColumnToValue(1,"6"); | ||
await element(by.type('UIPickerView')).setColumnToValue(2,"34"); | ||
await expect(element(by.id("timeLabel"))).toHaveText('choosenTime is 6:34'); | ||
}); | ||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React, { Component } from 'react'; | ||
import { | ||
Text, | ||
View, | ||
StyleSheet, | ||
DatePickerIOS | ||
} from 'react-native'; | ||
|
||
export default class DatePickerScreen extends Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
chosenDate: new Date() | ||
} | ||
this._setDate = this._setDate.bind(this); | ||
} | ||
|
||
_setDate(newDate) { | ||
this.setState({ | ||
chosenDate :newDate | ||
}) | ||
} | ||
|
||
getTime() { | ||
minutes = this.state.chosenDate.getMinutes() | ||
hour = this.state.chosenDate.getHours() | ||
if( hour > 12 ) { | ||
hour = hour - 12; | ||
} | ||
return `${hour}:${minutes}` | ||
} | ||
|
||
render() { | ||
return ( | ||
<View style={{flex: 1, paddingTop: 20, justifyContent: 'center', alignItems: 'center'}}> | ||
<Text style = {styles.dateText} testID='timeLabel'> | ||
{"choosenTime is " + this.getTime()} | ||
</Text> | ||
<DatePickerIOS | ||
style = {styles.datePicker} | ||
date = {this.state.chosenDate} | ||
onDateChange={this._setDate} | ||
/> | ||
</View> | ||
); | ||
} | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
datePicker: { | ||
width:'100%', | ||
height:200, | ||
backgroundColor:'green', | ||
}, | ||
dateText: { | ||
textAlign: 'center', | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,4 @@ | |
"babel-template": "^6.26.0", | ||
"java-method-parser": "^0.4.5" | ||
} | ||
} | ||
} |