open-consul/ui/packages/consul-ui/tests/steps/assertions/form.js
John Cowen 493ebb0713
ui: Move linting to the node:test script (#9385)
* Reconfigure linting to be a node-test

* Fixup linting across the project
2020-12-14 15:28:35 +00:00

18 lines
624 B
JavaScript

export default function(scenario, assert, find, currentPage) {
scenario.then('I see the $property form with yaml\n$yaml', function(property, data) {
let obj;
try {
obj = find(property);
} catch (e) {
obj = currentPage();
}
return Object.keys(data).reduce(function(prev, item, i, arr) {
const name = `${obj.prefix || property}[${item}]`;
const $el = document.querySelector(`[name="${name}"]`);
const actual = $el.value;
const expected = data[item];
assert.strictEqual(actual, expected, `Expected settings to be ${expected} was ${actual}`);
}, obj);
});
}