@@ -8,17 +8,28 @@ afterEach(cleanup)
88describe ( 'systemComponent' , ( ) => {
99 describe ( '#createSystemComponent' , ( ) => {
1010 it ( 'creates a div that omit props' , ( ) => {
11- const Box = createSystemComponent ( React . createElement )
11+ const Box = createSystemComponent ( React )
1212 const { container } = render ( < Box display = "block" /> )
1313 expect ( container . firstChild . tagName ) . toBe ( 'DIV' )
1414 expect ( container . firstChild ) . not . toHaveAttribute ( 'display' )
1515 } )
1616
1717 it ( 'supports "as" prop' , ( ) => {
18- const Box = createSystemComponent ( React . createElement )
18+ const Box = createSystemComponent ( React )
1919 const { container } = render ( < Box as = "header" display = "block" /> )
2020 expect ( container . firstChild . tagName ) . toBe ( 'HEADER' )
2121 expect ( container . firstChild ) . not . toHaveAttribute ( 'display' )
2222 } )
23+
24+ it ( 'forwards ref' , ( ) => {
25+ const Box = createSystemComponent ( React )
26+ const ref = jest . fn ( )
27+ const { container } = render (
28+ < Box ref = { ref } as = "header" display = "block" /> ,
29+ )
30+ expect ( container . firstChild . tagName ) . toBe ( 'HEADER' )
31+ expect ( container . firstChild ) . not . toHaveAttribute ( 'display' )
32+ expect ( ref ) . toHaveBeenCalled ( )
33+ } )
2334 } )
2435} )
0 commit comments