Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Wrong or confusing claim about DebugElement properties #62026

Closed as not planned
Closed as not planned
@tilouage

Description

@tilouage

Describe the problem that you experienced

The documentation of the DebugElement property says:

It does not include:

input property bindings (e.g. [myCustomInput]="value")

But when testing I can get the value of the input just fine using the following code:

const messageElement = fixture.debugElement.query(By.css([data-testid="message-container"]));
const messages = messageElemement.properties['messages'] as Message[];

expect(messages).toEqual(expectedMessages);

This works both when messages is set from using a component property or from within the template itself. The documentation seems to say it won't work, so either its not clear or the information in the docs are wrong.

Enter the URL of the topic with the problem

https://angular.dev/api/core/DebugElement

Describe what you were looking for in the documentation

A way to read the inputs given to child components.

Describe the actions that led you to experience the problem

No response

Describe what you want to experience that would fix the problem

No response

Add a screenshot if that helps illustrate the problem

No response

If this problem caused an exception or error, please paste it here


If the problem is browser-specific, please specify the device, OS, browser, and version


Provide any additional information here in as much as detail as you can


Metadata

Metadata

Assignees

No one assigned

    Labels

    area: docsRelated to the documentationneeds reproductionThis issue needs a reproduction in order for the team to investigate further

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions