anein / angular2-trim-directive

the directive trims whitespaces from the end of an input text value.
MIT License
45 stars 26 forks source link

Use type from the native element instead of using an Input #55

Closed loicgasser closed 4 years ago

loicgasser commented 4 years ago

Usually, we pass the type of the input via [attr.type], currently the code doesn't account for that.

In the tests when you do:

inputElement.type = 'url';

it changes the attribute of the HTML element and therefore this._type was always set to text.

With this pull request I suggest to use directly the value stored in the HTML element.

I added a test that would fail before this pull request.