open-consul/ui/packages/consul-ui/tests/steps/interactions/click.js
John Cowen 67b70878f3
ui: Add vendor directory as a target for JS linting and lint (#9157)
* ui: Add vendor for js linting

* Lint all the things
2020-11-11 16:59:15 +00:00

25 lines
679 B
JavaScript

export default function(scenario, find, click) {
scenario
.when('I click "$selector"', function(selector) {
return click(selector);
})
// TODO: Probably nicer to think of better vocab than having the 'without " rule'
.when(
[
'I click (?!")$property(?!")',
'I click $property on the $component',
'I click $property on the $component component',
],
function(property, component, next) {
try {
if (typeof component === 'string') {
property = `${component}.${property}`;
}
return find(property)();
} catch (e) {
throw e;
}
}
);
}