Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guest user #1246

Merged
merged 13 commits into from
Apr 2, 2019
9 changes: 9 additions & 0 deletions gsa/src/web/utils/testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ afterEach(cleanup);
const queryAllByName = (container, name) =>
queryAllByAttribute('name', container, name);

const queryByName = (container, name) => {
const els = queryAllByName(container, name);
bjoernricks marked this conversation as resolved.
Show resolved Hide resolved
if (!els.length) {
return null;
}
return els[0];
};

const getByName = (container, name) => {
const els = queryAllByName(container, name);
if (!els.length) {
Expand All @@ -70,6 +78,7 @@ export const render = ui => {
container,
element: hasValue(container) ? container.firstChild : undefined,
getByName: name => getByName(baseElement, name),
queryByName: name => queryByName(baseElement, name),
queryAllByName: name => queryAllByName(baseElement, name),
...other,
};
Expand Down