@@ -52,3 +52,40 @@ describe('StandardsList', () => {
5252 expect ( html . match ( / s t a n d a r d s - l i s t _ _ i t e m / g) ! . length ) . toBe ( 5 )
5353 } )
5454} )
55+
56+ import { LabCard } from '../../src/design/components/lab-card'
57+ import type { FeaturedLab } from '../../src/build/featured'
58+
59+ describe ( 'LabCard' , ( ) => {
60+ const lab : FeaturedLab = {
61+ title : 'Forms Lab' ,
62+ tagline : 'Digitize forms to create modern, accessible experiences for public outreach.' ,
63+ order : 1 ,
64+ links : [
65+ { label : 'Demo (Forms Platform)' , url : 'https://example.com/demo' } ,
66+ { label : 'GitHub repository — Forms Platform' , url : 'https://github.com/flexion/forms' } ,
67+ ] ,
68+ }
69+
70+ test ( 'renders the title as an h3 with no link' , async ( ) => {
71+ const html = await renderToHtml ( < LabCard lab = { lab } /> )
72+ expect ( html ) . toMatch ( / < h 3 [ ^ > ] * c l a s s = " l a b - c a r d _ _ t i t l e " [ ^ > ] * > F o r m s L a b < \/ h 3 > / )
73+ // Title should not be wrapped in an anchor
74+ expect ( html ) . not . toMatch ( / < h 3 [ ^ > ] * > [ ^ < ] * < a / )
75+ } )
76+
77+ test ( 'renders the tagline' , async ( ) => {
78+ const html = await renderToHtml ( < LabCard lab = { lab } /> )
79+ expect ( html ) . toContain ( 'Digitize forms to create modern, accessible experiences' )
80+ } )
81+
82+ test ( 'renders one link per entry with external treatment' , async ( ) => {
83+ const html = await renderToHtml ( < LabCard lab = { lab } /> )
84+ expect ( html ) . toContain ( 'href="https://example.com/demo"' )
85+ expect ( html ) . toContain ( 'href="https://github.com/flexion/forms"' )
86+ expect ( html ) . toContain ( 'Demo (Forms Platform)' )
87+ expect ( html ) . toContain ( 'GitHub repository — Forms Platform' )
88+ // Uses the Link component with external variant
89+ expect ( html . match ( / d a t a - v a r i a n t = " e x t e r n a l " / g) ?. length ) . toBe ( 2 )
90+ } )
91+ } )
0 commit comments