[CORL-116] Configure sitewide commenting (#2193)

* feat: configure sitewide commenting

* fix: repaired snapshots

* fix: updated snapshots

* test: update snapshots
This commit is contained in:
Kiwi
2019-02-13 18:36:37 +01:00
committed by GitHub
parent 51880bcfc9
commit c91a0fafa5
14 changed files with 454 additions and 76 deletions
@@ -1,3 +1,4 @@
import { uniq } from "lodash";
import { ReactTestInstance } from "react-test-renderer";
import { queryAllByText } from "./byText";
@@ -62,6 +63,7 @@ export function queryAllByLabelText(
options?: TextMatchOptions
) {
const matches = container.findAll(ariaLabelMatcher(pattern, options));
// Find matching aria-labelledby and id pairs.
queryAllByText(container, pattern, options).forEach(i => {
if (typeof i.type !== "string") {
return;
@@ -77,15 +79,20 @@ export function queryAllByLabelText(
);
} catch {} // tslint:disable-line:no-empty
}
if (i.type === "label" && i.props.htmlFor) {
try {
matches.push(
container.find(
x => typeof x.type === "string" && x.props.id === i.props.htmlFor
)
);
} catch {} // tslint:disable-line:no-empty
}
});
return matches;
// Find matching labels.
queryAllByText(container, pattern, { ...options, selector: "label" }).forEach(
i => {
if (i.props.htmlFor) {
try {
matches.push(
container.find(
x => typeof x.type === "string" && x.props.id === i.props.htmlFor
)
);
} catch {} // tslint:disable-line:no-empty
}
}
);
return uniq(matches);
}