Skip to content

bug(MatInputHarness): error setting decimal value on input with type="number" #19561

Closed
@mischkl

Description

@mischkl

Reproduction

Steps to reproduce:

  1. Create a matInput with type="number" and step="0.01"
  2. Get MatInputHarness for the input and attempt to set a decimal value on it, e.g.
await input.setValue('22.45');

Expected Behavior

The value is set to 22.45

Actual Behavior

What behavior did you actually see?

Chrome gives the error The specified value "22." is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?

The actual set value is only the decimal part of the number, i.e. 45.

Environment

  • Angular: 9.1.9
  • CDK/Material: 9.2.4
  • Browser(s): Chrome 80.0.3987.149
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS 10.15.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions