import { FilterIcon24 , FilterIcon32 } from "./assets" ; import { MultiVariantIcon , MultiVariantIconProps , createMultiVariantIcon } from "@components/icons" ; import { renderWithTheme } from "@jest-utils" ; function createIcon ( props = { } ) { return < MultiVariantIcon src24 = { FilterIcon24 } src32 = { FilterIcon32 } { ... props } />; } test ( "ref is a DOM element" , async ( ) => { let refNode = null ; renderWithTheme ( createIcon ( { ref : node => { refNode = node ; } } ) ) ; expect ( refNode ) . not . toBeNull ( ) ; expect ( refNode instanceof SVGElement ) . toBeTruthy ( ) ; expect ( refNode . tagName . toUpperCase ( ) ) . toBe ( "SVG" ) ; } ) ; test ( "hoc icon ref is a DOM element" , async ( ) => { let refNode = null ; const HocIcon = createMultiVariantIcon ( FilterIcon24 , FilterIcon32 ) ; renderWithTheme ( < HocIcon ref = { node => { refNode = node ; } } />); expect ( refNode ) . not . toBeNull ( ) ; expect ( refNode instanceof SVGElement ) . toBeTruthy ( ) ; expect ( refNode . tagName . toUpperCase ( ) ) . toBe ( "SVG" ) ; } ) ;