I have this function:
this.checkButton = function (buttonName, element, expectedPresent, expectedEnabled) {
var enabledCheck = expectedEnabled ? "enabled" : "disabled";
it('Find a ' + buttonName + ' button and check it is ' + enabledCheck, function () {
expect(element.isPresent()).toBe(expectedPresent);
expect(element.isEnabled()).toBe(expectedEnabled);
});
}
Is there a way I can make this so that if the function is called without the last two parameters then those parameters will both default to true?
Answer
If I understood what you want.
Try to say in starting of function.
expectedPresent = (expectedPresent==undefined) ? true : expectedPresent;
expectedEnabled = (expectedEnabled==undefined) ? true : expectedEnabled;
I hope this helps.
No comments:
Post a Comment