@@ -3,7 +3,7 @@ import { describe, it, expect } from "vitest";
33import { render , getByTestId } from "@testing-library/react" ;
44
55import * as Icons from "../src" ;
6- import { Icon , IconBase , IconWeight } from "../src/lib" ;
6+ import { Icon , IconBase , SSRBase , IconWeight } from "../src/lib" ;
77
88const aliases = new Set ( [
99 "FileDotted" ,
@@ -19,7 +19,8 @@ const aliases = new Set([
1919] ) ;
2020
2121const isIcon = ( candidate : any ) : candidate is Icon =>
22- "displayName" in candidate && candidate . displayName !== "IconBase" ;
22+ "displayName" in candidate &&
23+ ! [ "IconBase" , "SSRBase" ] . includes ( candidate . displayName ) ;
2324
2425const allIcons = Object . entries ( Icons ) . filter (
2526 ( [ name , module ] ) => ! aliases . has ( name ) && isIcon ( module )
@@ -161,4 +162,39 @@ describe("Custom icons can be rendered", () => {
161162 const result = render ( < CustomIcon weight = "duotone" data-testid = "test" /> ) ;
162163 expect ( getByTestId ( result . container , "test" ) ) . toBeTruthy ( ) ;
163164 } ) ;
165+
166+ const CustomSSRIcon : Icon = forwardRef ( ( props , ref ) => (
167+ < SSRBase ref = { ref } { ...props } weights = { weights } />
168+ ) ) ;
169+
170+ CustomSSRIcon . displayName = "CustomSSRIcon" ;
171+
172+ it ( "Custom SSR icon [thin] renders" , ( ) => {
173+ const result = render ( < CustomSSRIcon weight = "thin" data-testid = "test" /> ) ;
174+ expect ( getByTestId ( result . container , "test" ) ) . toBeTruthy ( ) ;
175+ } ) ;
176+ it ( "Custom SSR icon [light] renders" , ( ) => {
177+ const result = render ( < CustomSSRIcon weight = "light" data-testid = "test" /> ) ;
178+ expect ( getByTestId ( result . container , "test" ) ) . toBeTruthy ( ) ;
179+ } ) ;
180+ it ( "Custom SSR icon [regular] renders" , ( ) => {
181+ const result = render (
182+ < CustomSSRIcon weight = "regular" data-testid = "test" />
183+ ) ;
184+ expect ( getByTestId ( result . container , "test" ) ) . toBeTruthy ( ) ;
185+ } ) ;
186+ it ( "Custom SSR icon [bold] renders" , ( ) => {
187+ const result = render ( < CustomSSRIcon weight = "bold" data-testid = "test" /> ) ;
188+ expect ( getByTestId ( result . container , "test" ) ) . toBeTruthy ( ) ;
189+ } ) ;
190+ it ( "Custom SSR icon [fill] renders" , ( ) => {
191+ const result = render ( < CustomSSRIcon weight = "fill" data-testid = "test" /> ) ;
192+ expect ( getByTestId ( result . container , "test" ) ) . toBeTruthy ( ) ;
193+ } ) ;
194+ it ( "Custom SSR icon [duotone] renders" , ( ) => {
195+ const result = render (
196+ < CustomSSRIcon weight = "duotone" data-testid = "test" />
197+ ) ;
198+ expect ( getByTestId ( result . container , "test" ) ) . toBeTruthy ( ) ;
199+ } ) ;
164200} ) ;
0 commit comments