File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -18,4 +18,25 @@ describe('skill OG SVG', () => {
1818 expect ( svg ) . toContain ( 'v1.2.3' )
1919 expect ( svg ) . toContain ( 'clawdhub.com/jhillock/discord-doctor' )
2020 } )
21+
22+ it ( 'clips and wraps long descriptions' , ( ) => {
23+ const longWord = 'a' . repeat ( 200 )
24+ const svg = buildSkillOgSvg ( {
25+ markDataUrl : 'data:image/png;base64,AAA=' ,
26+ title : 'Gurkerlcli' ,
27+ description : `Prefix ${ longWord } suffix` ,
28+ ownerLabel : '@pasogott' ,
29+ versionLabel : 'v0.1.0' ,
30+ footer : 'clawdhub.com/pasogott/gurkerlcli' ,
31+ } )
32+
33+ expect ( svg ) . toContain ( '<clipPath id="cardClip">' )
34+ expect ( svg ) . toContain ( 'clip-path="url(#cardClip)"' )
35+ expect ( svg ) . not . toContain ( longWord )
36+ expect ( svg ) . toContain ( '…' )
37+
38+ const descBlock = svg . match ( / < t e x t [ ^ > ] * f o n t - s i z e = " 2 6 " [ \s \S ] * ?< \/ t e x t > / ) ?. [ 0 ] ?? ''
39+ const descTspans = descBlock . match ( / < t s p a n / g) ?? [ ]
40+ expect ( descTspans . length ) . toBeLessThanOrEqual ( 3 )
41+ } )
2142} )
You can’t perform that action at this time.
0 commit comments