我想使用Chai-jQuery .match
assertion:
// from Cypress docs:
// match(selector)
expect($emptyEl).to.match(':empty')
但问题是,存在同名的BDD Assertion:
// from Cypress docs:
// match(RegExp)
expect('testing').to.match(/^test/)
我想使用第一个,但我不知道如何使用——每次使用BDD断言并抛出错误时.例如:
expect(cy.get('div')).to.match('#someId')
match要求其参数为RegExp.您通过了:#someId
我try 将许多不同的内容传递到expect()
调用中,希望触发不同的重载,但我总是遇到这个错误.
那么,要使用Chai jQuery .match
aseertion,我需要做什么呢?