minor js fixes

This commit is contained in:
Jonathan Lipps
2013-04-08 18:58:51 -07:00
parent cb390c6a77
commit eee179f7c1
2 changed files with 18 additions and 17 deletions

View File

@@ -75,7 +75,7 @@ var respondError = function(req, res, statusObj, value) {
}
if (typeof newValue === "object") {
if (_.has(value, "message")) {
if (newValue !== null && _.has(value, "message")) {
// make sure this doesn't get obliterated
value.origValue = value.message;
message += " (Original error: " + value.message + ")";

View File

@@ -22,26 +22,27 @@ describe('preferences app', function() {
// have modified the plist of your preferences.app to run iphone
// instead of ipad by default (this test is for iphone)
it('should turn off autocomplete', function(done) {
h.driver.elementsByTagName('tableCell', function(err, els) {
els[1].click(function(err) {
h.driver.elementsByTagName('tableCell', function(err, els) {
els[1].click(function(err) {
h.driver.elementByXPath('//switch[@name="Auto-Correction"]', function(err, switchEl) {
switchEl.getValue(function(err, checked) {
if (checked === 1) {
// was checked, click it off
switchEl.click(function(err) {
done();
});
} else {
// was unchecked, do nothing
var p = {strategy: "tag name", selector: "tableCell", index: 1};
h.driver.execute("mobile: findAndAct", [p], function(err) {
should.not.exist(err);
setTimeout(function() {
h.driver.execute("mobile: findAndAct", [p], function(err) {
should.not.exist(err);
h.driver.elementByXPath('//switch[@name="Auto-Correction"]', function(err, switchEl) {
switchEl.getValue(function(err, checked) {
if (checked === 1) {
// was checked, click it off
switchEl.click(function(err) {
done();
}
});
});
} else {
// was unchecked, do nothing
done();
}
});
});
});
});
}, 1000);
});
});
});