forked from testing-library/dom-testing-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
matches.d.ts
33 lines (27 loc) 路 894 Bytes
/
matches.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
export type MatcherFunction = (content: string, element: HTMLElement) => boolean
export type Matcher = string | RegExp | MatcherFunction
export type NormalizerFn = (text: string) => string
export interface MatcherOptions {
exact?: boolean
/** Use normalizer with getDefaultNormalizer instead */
trim?: boolean
/** Use normalizer with getDefaultNormalizer instead */
collapseWhitespace?: boolean
normalizer?: NormalizerFn
/** set query suppress suggestions */
suggest?: boolean
}
export type Match = (
textToMatch: string,
node: HTMLElement | null,
matcher: Matcher,
options?: MatcherOptions,
) => boolean
export interface DefaultNormalizerOptions {
trim?: boolean
collapseWhitespace?: boolean
}
export function getDefaultNormalizer(
options?: DefaultNormalizerOptions,
): NormalizerFn
// N.B. Don't expose fuzzyMatches + matches here: they're not public API