Skip to content

triggerEventHandler does not recognize signal outputs/models #669

Open
@skyleguy

Description

@skyleguy

Is this a regression?

No

Description

angular: ^18.2.0
spectator: ^19.0.0

Not sure if this is a bug or a missing feature but essentially when using spectator.triggerEventHandler with a component as the first argument (not just the html selector of the component), when you attempt to give the name of the output as the second argument it only knows about outputs decorated with the @Output decorator and not any outputs that use output or model.

As an example assume we have a Component that is using this component:

@Component({
  selector: 'signal-output-test',
  standalone: true,
  template: `some cool ui here`,
})
export class SignalOutputComponent {
  @Output()
  decoratorOutput = new EventEmitter<string>();

  signalOutput = output<string>();

  signalModel = model<string>();
}

when my component goes to try and test how it reacts to outputs from that component we would most likely try to use triggerEventHandler like so:

Screenshot 2024-09-06 at 2 11 36 PM

as you can see it only knows about the decoratorOutput field even though it should know about the signalOutput and signalModel fields as well. You can work around this by doing:

spectator.triggerEventHandler('signal-output-test', 'signalOutput', 'someValue')

but this isnt as helpful and it doesnt have the same type safety that the other approach does

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

No response

Anything else?

No response

Do you want to create a pull request?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions