Fix acceptAlert for UICatalog on iOS 7

This commit is contained in:
bootstraponline
2013-11-07 14:59:26 -05:00
parent d5046c1233
commit 3280949aca
+28 -12
View File
@@ -928,19 +928,35 @@ $.extend(au, {
, acceptAlert: function() {
var alert = this.mainApp.alert();
var acceptButton = alert.defaultButton();
var buttonCount = alert.buttons().length;
if (acceptButton.isNil() && buttonCount > 0) {
// last button is accept
acceptButton = alert.buttons()[buttonCount - 1];
}
if (!alert.isNil()) {
var acceptButton = alert.defaultButton();
var buttonCount = alert.buttons().length;
if (acceptButton.isNil() && buttonCount > 0) {
// last button is accept
acceptButton = alert.buttons()[buttonCount - 1];
}
acceptButton.tap();
this.waitForAlertToClose(alert);
return {
status: codes.Success.code,
value: null
};
acceptButton.tap();
this.waitForAlertToClose(alert);
return {
status: codes.Success.code,
value: null
};
} else {
var ios7AlertButtons = this._getElementsByXpath("actionsheet/button");
if (ios7AlertButtons.length > 0) {
ios7AlertButtons[0].tap();
return {
status: codes.Success.code,
value: null
};
} else {
return {
status: status.codes.UnknownError.code,
value: null
};
}
}
}
, alertIsPresent: function() {