calabash/calabash-ios-server — pull request #19 by jmoody (2013-05-29 18:14:04+00:00)
Title: adds :changeDatePickerDate operation to the server to allow testers to easily interact with date pickers

hey karl,

i don't expect you to merge this branch (yet). it is more of a proof of concept that i want to run by you before i move on to the next phase of tests.

so, date pickers. what a drag! i have been fighting with them for over a year now. briar addresses most of my needs, but others are finding hard to use.

a search for 'date picker' on the forum reveals that no one has found a great solution for interacting with them and that newcomers find it difficult to make any progress.

the biggest problem is that, while it is possible to set the date using `query`, the targets of the date picker do not get have their actions called. for example, a common UI pattern is to have a label update when the picker changes (see attached screenshot). in briar, i have to _toggle_ one of the columns to get the associated label to update and this causes no end of problems because of min/max dates and AM/PM devices.

here is how i call the target/actions in the new operation:

```
if (notifyTargets) {
NSSet *targets = [picker allTargets];
for (id target in targets) {
NSArray *actions = [picker actionsForTarget:target forControlEvent:UIControlEventValueChanged];
for (NSString *action in actions) {
SEL sel = NSSelectorFromString(action);
[target performSelector:sel withObject:picker];
}
}
}
```

i have this working and tested on the ruby side for times:

```
Then I change the time on the picker to "1:45 PM"
Then I change the time on the picker to "13:45"
```

before i move on to testing dates and dates + times, i want to make sure that you think this is a good addition. what do you think?

![2013-05-29_20-04-01](https://f.cloud.github.com/assets/466104/580561/0fb610b0-c88b-11e2-8c0d-2b57b10d3a49.png)