Skip to content

Commit 037e29d

Browse files
authored
refactor: refactoring the condition function in toHaveText (#1930)
1 parent 8a3d674 commit 037e29d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/matchers/element/toHaveText.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
wrapExpectedWithArray
99
} from '../../utils.js'
1010

11-
async function condition(el: WebdriverIO.Element | WebdriverIO.ElementArray, text: string | RegExp | Array<string | RegExp> | ExpectWebdriverIO.PartialMatcher | Array<string | RegExp>, options: ExpectWebdriverIO.StringOptions) {
11+
async function condition(el: WebdriverIO.Element | WebdriverIO.ElementArray, text: string | RegExp | Array<string | RegExp> | ExpectWebdriverIO.PartialMatcher, options: ExpectWebdriverIO.StringOptions) {
1212
const actualTextArray: string[] = []
1313
const resultArray: boolean[] = []
1414
let checkAllValuesMatchCondition: boolean
@@ -22,7 +22,7 @@ async function condition(el: WebdriverIO.Element | WebdriverIO.ElementArray, tex
2222
: compareText(actualText, text, options).result
2323
resultArray.push(result)
2424
}
25-
checkAllValuesMatchCondition = resultArray.every(result => result)
25+
checkAllValuesMatchCondition = resultArray.every(Boolean)
2626
} else {
2727
const actualText = await (el as WebdriverIO.Element).getText()
2828
actualTextArray.push(actualText)

0 commit comments

Comments
 (0)