export function toHaveCssClass ( ) { return { compare : buildError ( false ) , negativeCompare : buildError ( true ) } ; function buildError ( isNot ) { return function ( actual , className ) { return { pass : actual . classList . contains ( className ) === ! isNot , get message ( ) { return `Expected ${ actual . outerHTML } ${ isNot ? 'not ' : '' }to contain the CSS class "${ className }"` ; } , } ; } ; } } export function toHaveText ( ) { return { compare : buildError ( false ) , negativeCompare : buildError ( true ) } ; function buildError ( isNot ) { return function ( actual , expectedText ) { const actualText = actual . textContent ; return { pass : ( actualText === expectedText ) === ! isNot , get message ( ) { return `Expected "${ actualText }" ${ isNot ? 'not ' : '' }to be equal to "${ expectedText }"` ; } , } ; } ; } }