mirror of
https://github.com/wassname/talk.git
synced 2026-08-02 13:10:23 +08:00
[CORL-158] Open/Close stream inside of configure tab (#2223)
* feat: Open or Close stream inside of configure tab * feat: default disable/close commenting message * fix: adjusted tests
This commit is contained in:
@@ -2,7 +2,6 @@ import React from "react";
|
||||
import { ReactTestInstance } from "react-test-renderer";
|
||||
|
||||
import findParentsWithType from "./findParentsWithType";
|
||||
import findParentWithType from "./findParentWithType";
|
||||
import matchText, { TextMatchOptions, TextMatchPattern } from "./matchText";
|
||||
|
||||
const matcher = (pattern: TextMatchPattern, options?: TextMatchOptions) => (
|
||||
@@ -39,14 +38,17 @@ export function getByText(
|
||||
pattern: TextMatchPattern,
|
||||
options?: TextMatchOptions & SelectorOptions
|
||||
) {
|
||||
const result = findParentWithType(
|
||||
container.find(matcher(pattern, options)),
|
||||
const results = findParentsWithType(
|
||||
container.findAll(matcher(pattern, options)),
|
||||
options && options.selector
|
||||
);
|
||||
if (!result) {
|
||||
throw new Error(`Couldn't find text ${pattern}`);
|
||||
if (results.length === 1) {
|
||||
return results[0];
|
||||
}
|
||||
return result;
|
||||
if (results.length === 0) {
|
||||
throw new Error(`Could't find element with text ${pattern}`);
|
||||
}
|
||||
throw new Error(`Found multiple elements with text ${pattern}`);
|
||||
}
|
||||
|
||||
export function getAllByText(
|
||||
|
||||
Reference in New Issue
Block a user