hiptest-publisher icon indicating copy to clipboard operation
hiptest-publisher copied to clipboard

Default parameters for Javascript

Open ClaudiaJ opened this issue 7 years ago • 0 comments

I wanted to fix this in #83 (or at least add it to my own Cucumber+ESModules language), but ripped it out before submitting the PR.

ES6 supports default parameters now, and so I copied down what other languages had templated like this:

lib/templates/javascript/parameter.hbs

{{{ underscore rendered_children.name }}}{{#if has_default_value? }} = {{{ rendered_children.default }}}{{/if}}

This kinda worked, in that I got default params for params that have a default value, but it looked like in practice has_default_value? was truthy for every parameter, resulting in function signatures having empty string as the default for every parameter for which no default was actually defined in HipTest:

function iSignUp(user = "", password = "") {
    // TODO: Implement action: do something
    throw 'Not implemented';
}

ClaudiaJ avatar Feb 08 '18 23:02 ClaudiaJ