@@ -309,14 +309,16 @@ describe('ComponentHelper', () => {
309309 } ) ;
310310
311311 it ( 'should parse InputOptionsWithTransform with union types without hanging (issue #1654)' , ( ) => {
312- // This case caused catastrophic backtracking in the old regex
312+ // This case caused catastrophic backtracking in the old regex.
313+ // The options object { transform: ... } is the sole argument and must not
314+ // leak into defaultValue — it should be treated as the options object.
313315 const defaultValue = `input.required<string[], string | string[]>({ transform: v => (Array.isArray(v) ? v : [v]) })` ;
314316 const result = componentHelper [ 'getSignalConfig' ] ( 'input' , defaultValue ) ;
315317
316318 expect ( result ) . to . deep . equal ( {
317319 required : true ,
318320 type : 'string[], string | string[]' ,
319- defaultValue : '{ transform: v => (Array.isArray(v) ? v : [v]) }'
321+ defaultValue : undefined
320322 } ) ;
321323 } ) ;
322324
@@ -339,7 +341,8 @@ describe('ComponentHelper', () => {
339341 expect ( result ) . to . deep . equal ( {
340342 required : false ,
341343 type : undefined ,
342- defaultValue : 'null'
344+ defaultValue : 'null' ,
345+ name : 'aliasedInSignal'
343346 } ) ;
344347 } ) ;
345348
@@ -353,6 +356,98 @@ describe('ComponentHelper', () => {
353356 defaultValue : 'false'
354357 } ) ;
355358 } ) ;
359+
360+ // Alias regression tests (issue: signal aliases not detected)
361+ it ( 'should extract alphanumeric alias from input signal options' , ( ) => {
362+ const defaultValue = `input<string>('Lorem ipsum', { alias: 'myUnhyphenatedInput' })` ;
363+ const result = componentHelper [ 'getSignalConfig' ] ( 'input' , defaultValue ) ;
364+
365+ expect ( result ) . to . deep . equal ( {
366+ required : false ,
367+ type : 'string' ,
368+ defaultValue : "'Lorem ipsum'" ,
369+ name : 'myUnhyphenatedInput'
370+ } ) ;
371+ } ) ;
372+
373+ it ( 'should extract hyphenated alias from input signal options' , ( ) => {
374+ const defaultValue = `input<string>('sit amet', { alias: 'my-hyphenated-input' })` ;
375+ const result = componentHelper [ 'getSignalConfig' ] ( 'input' , defaultValue ) ;
376+
377+ expect ( result ) . to . deep . equal ( {
378+ required : false ,
379+ type : 'string' ,
380+ defaultValue : "'sit amet'" ,
381+ name : 'my-hyphenated-input'
382+ } ) ;
383+ } ) ;
384+
385+ it ( 'should extract alias from required input signal options' , ( ) => {
386+ const defaultValue = `input.required<string>({ alias: 'requiredAlias' })` ;
387+ const result = componentHelper [ 'getSignalConfig' ] ( 'input' , defaultValue ) ;
388+
389+ expect ( result ) . to . deep . equal ( {
390+ required : true ,
391+ type : 'string' ,
392+ defaultValue : undefined ,
393+ name : 'requiredAlias'
394+ } ) ;
395+ } ) ;
396+
397+ it ( 'should extract alphanumeric alias from output signal options' , ( ) => {
398+ const defaultValue = `output<string>({ alias: 'myUnhyphenatedOutput' })` ;
399+ const result = componentHelper [ 'getSignalConfig' ] ( 'output' , defaultValue ) ;
400+
401+ expect ( result ) . to . deep . equal ( {
402+ required : false ,
403+ type : 'string' ,
404+ defaultValue : undefined ,
405+ name : 'myUnhyphenatedOutput'
406+ } ) ;
407+ } ) ;
408+
409+ it ( 'should extract hyphenated alias from output signal options' , ( ) => {
410+ const defaultValue = `output<string>({ alias: 'my-hyphenated-output' })` ;
411+ const result = componentHelper [ 'getSignalConfig' ] ( 'output' , defaultValue ) ;
412+
413+ expect ( result ) . to . deep . equal ( {
414+ required : false ,
415+ type : 'string' ,
416+ defaultValue : undefined ,
417+ name : 'my-hyphenated-output'
418+ } ) ;
419+ } ) ;
420+
421+ it ( 'should extract alias from model signal options' , ( ) => {
422+ const defaultValue = `model<string>('Lorem ipsum', { alias: 'myUnhyphenatedModel' })` ;
423+ const result = componentHelper [ 'getSignalConfig' ] ( 'model' , defaultValue ) ;
424+
425+ expect ( result ) . to . deep . equal ( {
426+ required : false ,
427+ type : 'string' ,
428+ defaultValue : "'Lorem ipsum'" ,
429+ name : 'myUnhyphenatedModel'
430+ } ) ;
431+ } ) ;
432+
433+ it ( 'should extract hyphenated alias from model signal options' , ( ) => {
434+ const defaultValue = `model<string>('sit amet', { alias: 'my-hyphenated-Model' })` ;
435+ const result = componentHelper [ 'getSignalConfig' ] ( 'model' , defaultValue ) ;
436+
437+ expect ( result ) . to . deep . equal ( {
438+ required : false ,
439+ type : 'string' ,
440+ defaultValue : "'sit amet'" ,
441+ name : 'my-hyphenated-Model'
442+ } ) ;
443+ } ) ;
444+
445+ it ( 'should not set name when options object has no alias' , ( ) => {
446+ const defaultValue = `input<boolean>(false, { transform: booleanAttribute })` ;
447+ const result = componentHelper [ 'getSignalConfig' ] ( 'input' , defaultValue ) ;
448+
449+ expect ( result ) . to . not . have . property ( 'name' ) ;
450+ } ) ;
356451 } ) ;
357452
358453 describe ( 'getInputSignal' , ( ) => {
@@ -368,6 +463,18 @@ describe('ComponentHelper', () => {
368463 } ) ;
369464 } ) ;
370465
466+ it ( 'should override prop name with alias from signal options' , ( ) => {
467+ const prop = { name : 'myInput' , defaultValue : `input<string>('hello', { alias: 'my-aliased-input' })` } ;
468+ const result = componentHelper . getInputSignal ( prop ) ;
469+
470+ expect ( result ) . to . deep . equal ( {
471+ name : 'my-aliased-input' ,
472+ defaultValue : "'hello'" ,
473+ required : false ,
474+ type : 'string'
475+ } ) ;
476+ } ) ;
477+
371478 it ( 'should return undefined when no input signal found' , ( ) => {
372479 const prop = { defaultValue : 'someOtherValue' } ;
373480 const result = componentHelper . getInputSignal ( prop ) ;
@@ -389,6 +496,18 @@ describe('ComponentHelper', () => {
389496 } ) ;
390497 } ) ;
391498
499+ it ( 'should override prop name with alias from output signal options' , ( ) => {
500+ const prop = { name : 'myOutput' , defaultValue : `output<string>({ alias: 'my-aliased-output' })` } ;
501+ const result = componentHelper . getOutputSignal ( prop ) ;
502+
503+ expect ( result ) . to . deep . equal ( {
504+ name : 'my-aliased-output' ,
505+ defaultValue : undefined ,
506+ required : false ,
507+ type : 'string'
508+ } ) ;
509+ } ) ;
510+
392511 it ( 'should return undefined when no output signal found' , ( ) => {
393512 const prop = { defaultValue : 'someOtherValue' } ;
394513 const result = componentHelper . getOutputSignal ( prop ) ;
0 commit comments