You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
487 B
19 lines
487 B
9 years ago
|
beforeEach(() => {
|
||
|
jasmine.addMatchers({
|
||
|
// since classList may not be supported in all browsers
|
||
|
toHaveClass: () => {
|
||
|
return {
|
||
|
compare: (el, cls) => {
|
||
|
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}`
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
})
|