I defined a function like this in Javascript:
checkButton (elem, expectedPresent, expectedEnabled) {
var id = elem.locator_.value;
var title = this.getTitle(id);
expectedPresent = typeof expectedPresent !== 'undefined' ? expectedPresent : true;
expectedEnabled = typeof expectedEnabled !== 'undefined' ? expectedEnabled : true;
var enabledCheck = expectedEnabled ? "enabled" : "disabled";
it(title + ' - Check it is ' + enabledCheck, function () {
expect(elem.isPresent()).toBe(expectedPresent);
expect(elem.isEnabled()).toBe(expectedEnabled);
});
}
The two trailing parameters are optional.
Now I am using Typescript. Can someone tell me if there is a better way for me to define these optional parameters using Typescript. Also how should I set the arguments so that Typescript will not give a syntax error in the call to this function when the params are not present?