Skip to content

feat(cdk/testing): Consider adding a TestElementPromise class #21183

Open
@mmalerba

Description

@mmalerba

Feature Description

@yjaaidi proposed this idea in #20871. We could create a subclass of Promise that would allow calling TestElement methods directly on the Promise. Example: https://stackblitz.com/edit/test-element-promise

Use Case

This would allow people to write cleaner test code, e.g.

await harness.host().getText();

Instead of:

await (await harness.host()).getText();
// or
await harness.host().then(host => host.getText());

The idea would need a design doc and discussion with the team before proceeding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/testingfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions