@@ -1116,17 +1116,17 @@ describe('returnImageCollector', () => {
11161116 name : 'heroImage-1' ,
11171117 output : {
11181118 key : 'heroImage-1' ,
1119- label : '' ,
1119+ label : 'Alt text ' ,
11201120 type : 'IMAGE' ,
1121- imageUrl : 'https://cdn.example.com/image.png' ,
1122- description : 'Alt text' ,
1123- hyperlinkUrl : 'https://example.com/install' ,
1121+ src : 'https://cdn.example.com/image.png' ,
1122+ alt : 'Alt text' ,
1123+ href : 'https://example.com/install' ,
11241124 } ,
11251125 } ) ;
11261126 } ) ;
11271127
11281128 // (b) Minimal payload — no hyperlinkUrl
1129- it ( 'should omit hyperlinkUrl when hyperlinkUrl is absent' , ( ) => {
1129+ it ( 'should omit href when hyperlinkUrl is absent' , ( ) => {
11301130 const mockField : ImageField = {
11311131 type : 'IMAGE' ,
11321132 key : 'image' ,
@@ -1135,14 +1135,14 @@ describe('returnImageCollector', () => {
11351135 } ;
11361136 const result = returnImageCollector ( mockField , 0 ) ;
11371137 expect ( result . error ) . toBeNull ( ) ;
1138- expect ( result . output . imageUrl ) . toBe ( 'https://example.com/test-image.png' ) ;
1139- expect ( result . output . description ) . toBe ( 'Alt text' ) ;
1140- expect ( result . output . label ) . toBe ( '' ) ;
1141- expect ( result . output ) . not . toHaveProperty ( 'hyperlinkUrl ' ) ;
1138+ expect ( result . output . src ) . toBe ( 'https://example.com/test-image.png' ) ;
1139+ expect ( result . output . alt ) . toBe ( 'Alt text' ) ;
1140+ expect ( result . output . label ) . toBe ( 'Alt text ' ) ;
1141+ expect ( result . output ) . not . toHaveProperty ( 'href ' ) ;
11421142 } ) ;
11431143
1144- // (c) hyperlinkUrl present — hyperlink emitted; absent — omitted
1145- it ( 'should emit hyperlinkUrl when hyperlinkUrl is set and omit it when absent' , ( ) => {
1144+ // (c) hyperlinkUrl present — href emitted; absent — omitted
1145+ it ( 'should emit href when hyperlinkUrl is set and omit it when absent' , ( ) => {
11461146 const withHyperlink : ImageField = {
11471147 type : 'IMAGE' ,
11481148 key : 'image' ,
@@ -1151,7 +1151,7 @@ describe('returnImageCollector', () => {
11511151 hyperlinkUrl : 'https://example.com/click-target' ,
11521152 } ;
11531153 const resultWith = returnImageCollector ( withHyperlink , 0 ) ;
1154- expect ( resultWith . output . hyperlinkUrl ) . toBe ( 'https://example.com/click-target' ) ;
1154+ expect ( resultWith . output . href ) . toBe ( 'https://example.com/click-target' ) ;
11551155
11561156 const withoutHyperlink : ImageField = {
11571157 type : 'IMAGE' ,
@@ -1160,19 +1160,20 @@ describe('returnImageCollector', () => {
11601160 imageUrl : 'https://example.com/test-image.png' ,
11611161 } ;
11621162 const resultWithout = returnImageCollector ( withoutHyperlink , 0 ) ;
1163- expect ( resultWithout . output ) . not . toHaveProperty ( 'hyperlinkUrl ' ) ;
1163+ expect ( resultWithout . output ) . not . toHaveProperty ( 'href ' ) ;
11641164 } ) ;
11651165
1166- // (d) description passes through verbatim
1167- it ( 'should pass description through verbatim' , ( ) => {
1166+ // (d) description passes through verbatim as alt and label
1167+ it ( 'should pass description through verbatim as alt and label ' , ( ) => {
11681168 const mockField : ImageField = {
11691169 type : 'IMAGE' ,
11701170 key : 'image' ,
11711171 description : 'Friendly alt text' ,
11721172 imageUrl : 'https://example.com/test-image.png' ,
11731173 } ;
11741174 const result = returnImageCollector ( mockField , 0 ) ;
1175- expect ( result . output . description ) . toBe ( 'Friendly alt text' ) ;
1175+ expect ( result . output . alt ) . toBe ( 'Friendly alt text' ) ;
1176+ expect ( result . output . label ) . toBe ( 'Friendly alt text' ) ;
11761177 } ) ;
11771178
11781179 // (e) imageUrl absent — src defaults to empty string
@@ -1184,19 +1185,26 @@ describe('returnImageCollector', () => {
11841185 imageUrl : '' ,
11851186 } ;
11861187 const result = returnImageCollector ( mockField , 0 ) ;
1187- expect ( result . output . imageUrl ) . toBe ( '' ) ;
1188+ expect ( result . output . src ) . toBe ( '' ) ;
11881189 } ) ;
11891190
1190- // (f) output.label === '' for any IMAGE payload
1191- it ( 'should set output.label to empty string regardless of payload shape ' , ( ) => {
1192- const mockField : ImageField = {
1191+ // (f) output.label mirrors description
1192+ it ( 'should set output.label to description when present, empty string when absent ' , ( ) => {
1193+ const withDescription : ImageField = {
11931194 type : 'IMAGE' ,
11941195 key : 'image' ,
11951196 description : 'Alt text' ,
11961197 imageUrl : 'https://example.com/test-image.png' ,
11971198 } ;
1198- const result = returnImageCollector ( mockField , 0 ) ;
1199- expect ( result . output . label ) . toBe ( '' ) ;
1199+ expect ( returnImageCollector ( withDescription , 0 ) . output . label ) . toBe ( 'Alt text' ) ;
1200+
1201+ const withoutDescription : ImageField = {
1202+ type : 'IMAGE' ,
1203+ key : 'image' ,
1204+ description : '' ,
1205+ imageUrl : 'https://example.com/test-image.png' ,
1206+ } ;
1207+ expect ( returnImageCollector ( withoutDescription , 0 ) . output . label ) . toBe ( '' ) ;
12001208 } ) ;
12011209} ) ;
12021210
0 commit comments