Skip to content

bug(MatInputHarness): Numeric values are not supported on <input type="number" /> #23894

Open
@undsoft

Description

@undsoft

Reproduction

Use StackBlitz to reproduce your issue:
https://stackblitz.com/edit/harness-issue-7whdxy?devtoolsheight=33&file=src/app/button-harness-example.spec.ts

Steps to reproduce:

  1. Have an input with type = "number"
  2. Try to set input value to a numeric value via matInputHarness.setValue(24)
    or try to read a numeric value via matInputHarness.getValue().

Expected Behavior

I can read and set values as numbers (not strings), as numbers would appear in FormControl when user interacts with <input type="number">.

Actual Behavior

I can only set and read values as strings.

Environment

  • Angular: 12
  • CDK/Material: 12
  • Browser(s): Firefox
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: cdk/testingneeds: discussionFurther discussion with the team is needed before proceeding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions