@@ -22,10 +22,22 @@ test('deprecate', () => {
2222} )
2323
2424describe ( 'checkHtmlElement' , ( ) => {
25+ let assertionContext
26+ beforeAll ( ( ) => {
27+ expect . extend ( {
28+ fakeMatcher ( ) {
29+ assertionContext = this
30+
31+ return { pass : true }
32+ } ,
33+ } )
34+
35+ expect ( true ) . fakeMatcher ( true )
36+ } )
2537 it ( 'does not throw an error for correct html element' , ( ) => {
2638 expect ( ( ) => {
2739 const element = document . createElement ( 'p' )
28- checkHtmlElement ( element , ( ) => { } , { } )
40+ checkHtmlElement ( element , ( ) => { } , assertionContext )
2941 } ) . not . toThrow ( )
3042 } )
3143
@@ -35,25 +47,25 @@ describe('checkHtmlElement', () => {
3547 'http://www.w3.org/2000/svg' ,
3648 'rect' ,
3749 )
38- checkHtmlElement ( element , ( ) => { } , { } )
50+ checkHtmlElement ( element , ( ) => { } , assertionContext )
3951 } ) . not . toThrow ( )
4052 } )
4153
4254 it ( 'does not throw for body' , ( ) => {
4355 expect ( ( ) => {
44- checkHtmlElement ( document . body , ( ) => { } , { } )
56+ checkHtmlElement ( document . body , ( ) => { } , assertionContext )
4557 } ) . not . toThrow ( )
4658 } )
4759
4860 it ( 'throws for undefined' , ( ) => {
4961 expect ( ( ) => {
50- checkHtmlElement ( undefined , ( ) => { } , { } )
62+ checkHtmlElement ( undefined , ( ) => { } , assertionContext )
5163 } ) . toThrow ( HtmlElementTypeError )
5264 } )
5365
5466 it ( 'throws for document' , ( ) => {
5567 expect ( ( ) => {
56- checkHtmlElement ( document , ( ) => { } , { } )
68+ checkHtmlElement ( document , ( ) => { } , assertionContext )
5769 } ) . toThrow ( HtmlElementTypeError )
5870 } )
5971
@@ -62,7 +74,7 @@ describe('checkHtmlElement', () => {
6274 checkHtmlElement (
6375 ( ) => { } ,
6476 ( ) => { } ,
65- { } ,
77+ assertionContext ,
6678 )
6779 } ) . toThrow ( HtmlElementTypeError )
6880 } )
@@ -77,7 +89,7 @@ describe('checkHtmlElement', () => {
7789 } ,
7890 } ,
7991 ( ) => { } ,
80- { } ,
92+ assertionContext ,
8193 )
8294 } ) . toThrow ( HtmlElementTypeError )
8395 } )
0 commit comments