feat(ngMaxlength): disable maxlength when not set to a non-negative integer

1. Previously, setting the maxlength to a negative number, would make all input values invalid (since their length should be less than maxlength, which is impossible).
2. Furthermore, supplying a non-numeric value would set maxlength to 0 (effectively only allowing empty values - although this is not very likely the intended behaviour).

The 1st commit fixes (1): Adds support for disabling the max length limit by setting maxlength to a negative number.

The 2nd commit "fixes" (2): When specifying a non-numeric value for maxlength (e.g. `""`, `null`, `"abc"`), the max length limit is disabled (i.e. the validator will return `true` for any input).

Note that the behaviour implemented in these 2 commits is more inline with how the HTML5 `maxlength` attribute works (both in browsers and according to [the spec](http://dev.w3.org/html5/spec-preview/attributes-common-to-form-controls.html#attr-fe-maxlength)).

Closes #9874
Closes #9995
Yep, sounds good to me 

----- Ursprüngliche Nachricht -----
Von: "Georgios Kalpakas" <notifications@github.com>
Gesendet: ‎11.‎11.‎2014 18:34
An: "angular/angular.js" <angular.js@noreply.github.com>
Cc: "Narretz" <mjstaffa@googlemail.com>
Betreff: Re: [angular.js] feat(ngMaxlength): disable maxlength when not set toa non-negative integer (#9998)

In test/ng/directive/inputSpec.js:
> +      expect(inputElm).toBeInvalid();
> +    });
> +
> +    it('should accept values of any length when maxlength is negative', function() {
> +      compileInput('<input type="text" ng-model="value" ng-maxlength="-1" />');
> +
> +      changeInputValueTo('');
> +      expect(inputElm).toBeValid();
> +
> +      changeInputValueTo('aaaaaaaaaa');
> +      expect(inputElm).toBeValid();
> +    });
> +
> +    it('should accept values of any length when maxlength is non-numeric', function() {
> +      compileInput('<input type="text" ng-model="value" ng-maxlength="{{maxlength}}" />');
> +      changeInputValueTo(new Array(1001).join('a'));
@Narretz, @pkozlowski-opensource: Do you think I should get rid of new Array(...).join(...) here and just use a string (say 10 chars long) ?
—
Reply to this email directly or view it on GitHub.=