Home > assistive-webdriver > isMatch
Returns whether the text coming from the screen reader passed as the first parameter matches the expected text specified as the second parameter.
Signature:
export declare function isMatch(screenReaderText: string, expectedText: any): boolean;
Parameter | Type | Description |
---|---|---|
screenReaderText | string | text coming from the screen reader |
expectedText | any | expected text. See the remarks for more details about accepted types. |
Returns:
boolean
true if the text coming from the screen reader matches the expected text, false otherwise.
expectedText
can be:
a string: the text matches if screenReaderText
contains the text in expectedText
a regular expression: the text matches if screenReaderText
matches the regular expression
a function: the function is called, and should return a boolean describing whether it matches or not.
an array: the text matches if there is a match with one of the items of the array (which can be a string, a regular expression, a function or a nested array), according to the rules previously mentioned