mirror of
https://github.com/vuejs/vue.git
synced 2024-11-22 04:39:46 +00:00
13 lines
325 B
TypeScript
13 lines
325 B
TypeScript
expect.extend({
|
|
toHaveClass(el: Element, cls: string) {
|
|
const pass = el.classList
|
|
? el.classList.contains(cls)
|
|
: (el.getAttribute('class') || '').split(/\s+/g).indexOf(cls) > -1
|
|
return {
|
|
pass,
|
|
message: () =>
|
|
`Expected element${pass ? ' ' : ' not '}to have class ${cls}`
|
|
}
|
|
}
|
|
})
|