Commit Graph

2120 Commits

Author SHA1 Message Date
Pawel Kozlowski
aa01be8b2c test($http): parsing headers with multiple values
Closes #9473

Closes #10176
2014-11-22 22:11:59 +01:00
Brian Ford
bb4d3b73a1 fix(ngModelOptions): preserve context of getter/setters
Many thanks to @NevilleS and @jbedard for collaborating with me on a solution to this!

Closes #9394
Closes #9865

BREAKING CHANGE: previously, ngModel invoked getter/setters in the global context.

For example:

```js
<input ng-model="model.value" ng-model-options="{ getterSetter: true }">
```

would previously invoke `model.value()` in the global context.

Now, ngModel invokes `value` with `model` as the context.

It's unlikely that real apps relied on this behavior. If they did they can use `.bind` to explicilty
bind a getter/getter to the global context, or just reference globals normally without `this`.
2014-11-22 12:36:12 -08:00
Wesley Cho
6dbd606ad7 fix($locale): Allow currency filter to fall back to maxFrac from locale
- Modify default fallback to `NUMBER_FORMATS.PATTERNS[1].maxFrac`

- Remove unnecessary resetting

Closes #10179
2014-11-22 12:29:06 -08:00
thorn0
764fa869dd fix($browser): allow chaining url() calls in setter mode
Closes #10157
2014-11-22 16:48:54 +01:00
Neville Samuell
7812dfcee8 fix($location): allow empty string URLs to reset path, search, and hash
Currently, providing '' to $location#url will only reset the hash, but otherwise has no effect. This
change brings the behaviour of $location#url more inline with window.location.href, which when
assigned to an empty string loads the page's base href.

Before:
$location.url() // http://www.example.com/path
$location.url('') // http://www.example.com/path

After:
$location.url() // http://www.example.com/path
$location.url('') // http://www.example.com

Fixes #10063

Closes #10064
2014-11-22 16:30:41 +01:00
Georgios Kalpakas
92f87b1142 fix(ngMaxlength): ignore maxlength when not set to a non-negative integer
This makes the behaviour of maxlength/ngMaxlength more inline with the
spec.

Closes #9874
2014-11-22 16:00:44 +01:00
Georgios Kalpakas
5c1fdff691 feat(ngMaxlength): add support for disabling max length limit
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).
This commit changes the behaviour of maxlength/ngMaxlength, effectively
disabling the maxlength validation (always returning true) when maxlength
is set to a negative number. This is more inline to 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).

Related to #9874
Closes #9995
2014-11-22 16:00:43 +01:00
Georgios Kalpakas
891acf4c20 fix($route): fix redirection with optional/eager params
Previously, when (automatically) redirecting from path that fetured a
trailing slash and optional or "eager" parameters, the resulting path
would (incorrectly) contain the special characters (`?`,`*`) along with
the parameter values.

Closes #9819

Closes #9827
2014-11-22 15:34:16 +01:00
Georgios Kalpakas
93552fed1c test($route): fix test names 2014-11-22 15:34:16 +01:00
AlexChan
eab271876c fix(input): call $setTouched in blur asynchronously if necessary
If the model is blurred during an apply it should trigger
$setTouched asynchronously.

Fixes #8762
Fixes #9808
Closes #10014
2014-11-20 23:01:43 +01:00
IShotTheSheriff
e8941c0fe5 feat(ngModelController): add $setDirty method
- extract existing functionality to public method: $setDirty
- add tests to corresponding changes
- refactor code to use extracted method

Closes #10038
Closes #10049
2014-11-19 20:07:07 +01:00
Georgios Kalpakas
2b41a5868a feat(ngPluralize): add support for count to be a one-time expression
Closes #10004
2014-11-18 23:49:24 +01:00
Jamshid Afshar
637c020f82 fix($http): return empty headers, ignore properties in Object prototype
Fix response headers with an empty value Empty response header values are legal
(http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html).

The headers getter fn will now only return null if the header property is not an own property.

Closes #7779
Closes #10113
Closes #10091
2014-11-18 16:37:38 -05:00
Martin Staffa
e3764e30a3 fix(ngModel): don't run parsers when executing $validate
Previously, $validate would execute the parsers to obtain a
modelValue for validation. This was necessary, because a validator
that is called outside of model / view update (e.g. from an observer)
otherwise might only an undefined modelValue, because a previous
view update has found a validation $error and set the model
to undefined (as is tradition in angular)

This is problematic as validators that are run immediately after
the ngModelController initializes would parse the modelValue
and replace the model, even though there had been no user input.

The solution is to go back to an older design: the ngModelController
will now internally record the $$rawModelValue. This means a model
or view update will store the set / parsed modelValue regardless
of validity, that is, it will never set it to undefined because of
validation errors.

When $validate is called, the $$rawModelValue will passed to the
validators. If the validity has changed, the usual behavior is kept:
if it became invalid, set the model to undefined, if valid,
restore the last available modelValue - the $$rawModelValue.

Additionally, $validate will only update the model when the validity
changed. This is to prevent setting initially invalid models other
than undefined to undefined (see #9063)

Fixes: #9063
Fixes: #9959
Fixes: #9996
Fixes: #10025

Closes: #9890
Closes: #9913
Closes: #9997
Closes: #10048
2014-11-17 20:26:27 +01:00
Martin Staffa
c9899c53ac test(ngModel): group validation tests 2014-11-17 20:26:17 +01:00
Peter Bacon Darwin
e80053d91f fix($rootScope): handle cyclic references in scopes when creating error messages
Use the new private function `stringify` to convert scope values to strings,
since this can cope with cyclic references and other oddities.

Closes #10085
2014-11-17 13:38:04 +00:00
Peter Bacon Darwin
cf43ccdf9b fix(minErr): stringify non-JSON compatible objects in error messages
Fix the JSON stringification to output a more meaningful string when an
object cannot be normally converted to a JSON string, such as when the
object contains cyclic references that would cause `JSON.stringify()`
to throw an error.

Closes #10085
2014-11-17 13:37:52 +00:00
Shahar Talmi
a9352c19ce feat($location): allow to location to be changed during $locationChangeStart
Closes #9607
Closes #9678
2014-11-15 23:25:21 +00:00
Jakub Hampl
6f19a6fd33 fix($http): don't parse single space responses as JSON
Closes #9907
2014-11-15 12:43:24 +01:00
Peter Bacon Darwin
6604c23614 fix(select): ensure the label attribute is updated in Internet Explorer
Only changing the `<option>` text value is not enough to trigger a render
change in IE. We need to explicit update the `label` property too.

Closes #9621
Closes #10042
2014-11-14 21:17:28 +00:00
Peter Bacon Darwin
195deca6e2 test(select): refactor option elements expectations to use toEqualOption matcher
By using a new matcher our tests become less brittle with respect to unimportant
extra attributes.
2014-11-14 21:16:42 +00:00
Caitlin Potter
85eb9660ef fix(ngPattern): match behaviour of native HTML pattern attribute
From https://html.spec.whatwg.org/multipage/forms.html#attr-input-pattern

> The compiled pattern regular expression, when matched against a string, must have its start
anchored to the start of the string and its end anchored to the end of the string.

Closes #9881
Closes #9888
2014-11-14 20:18:57 +00:00
David Stensland
d81ff8885b fix(ngMock): call $interval callbacks even when invokeApply is false
Make ngMock.$interval behave like ng.$interval

Closes #10032
2014-11-14 11:42:24 -05:00
Caitlin Potter
be6920b356 test(orderBy): add test cases for ordering array-like objects
Closes #10060
2014-11-14 10:02:23 -05:00
Jason Bedard
fbad280570 refactor($parse): separate tokenizing vs parsing more
Fixes `a.b` and `a .b` generating different getterFns
Fixes `{'': ...}` turning into `{"''": ...}`
Fixes `{.: ...}` parsing as `{'.': ...}` instead of throwing
Fixes #9131
2014-11-12 23:36:23 +01:00
Pawel Kozlowski
0db573b749 feat($routeProvider): allow setting caseInsensitiveMatch on the provider
Fixes #6477

Closes #9873
2014-11-11 20:20:16 +01:00
Rouven Weßling
77d8ae1d45 refactor($location) Remove unused variables
These were left around in 736c8fbbae

Closes #9482
2014-11-09 16:18:00 +01:00
Henry Zhu
e21b6ff3ff style(*): add rule requireSpacesInConditionalExpression
Closes #9973
2014-11-09 15:51:01 +01:00
Henry Zhu
06016bb12c style(*): add rules requireSpace(After|Before)BinaryOperators 2014-11-09 15:51:01 +01:00
Martin Staffa
9e305948e4 fix(select): use strict comparison for isSelected with selectAs
Closes #9639
Closes #9949
2014-11-07 13:22:01 -05:00
Lucas Galfaso
ed99821e4d fix($parse): stateful interceptors override an undefined expression
When using `$parse` with a stateful interceptor and the expression
is `undefined`, then return the result from the interceptor

NOTE from Igor: this is not the best solution. We need to refactor
this and one-time + $interpolate code to properly fix this. @caitp
is on it. See discussion in the PR.

Closes #9821
Closes #9825
2014-11-07 10:17:32 -08:00
Chirayu Krishnappa
e057a9aa39 fix($parse, events): prevent accidental misuse of properties on $event 2014-11-06 19:30:48 -08:00
Chirayu Krishnappa
e676d642f5 fix($parse): add quick check for Function constructor in fast path 2014-11-06 19:30:48 -08:00
Marcy Sutton
187e43185d feat(ngAria): announce ngMessages with aria-live
By including the `ngAria` module, `ngMessages` will automatically include the aria-live
attribute with an assertive voice, allowing validation messages to be spoken throuhg a
screenreader.

Closes #9834
2014-11-05 17:50:18 -05:00
Peter Bacon Darwin
91834bcf37 test($compile): use ngMock.Scope.$countChildScopes() 2014-11-05 20:41:51 +00:00
Dave Longley
841c090755 fix($compile): do not rebind parent bound transclude functions
The `$compile` public API documentation indicates that
a transclude function may be passed as a second parameter, but
it was not clear that this is **not** the same function that is given
to directive link functions as the `transcludeFn` parameter.

We would like to be able to pass in a transclude function the public
linking function that is returned from `$compile` if we wish to, for
example, use lazy compilation inside a directive.

Doing so, however, highlighted two bugs:

* First, the transclude function would get rebound, incorrectly, changing
its scope from its original binding.
* Second, the `containingScope` would not be updated and the wrong
`$parent` would be assigned to the `transcludedScope` resulting in a
memory leak.

This patch fixes both of these issues.

It also converts various private optional positional parameters on `publicLinkFn`
into an `options` parameter, which is an object hash. The new `options`
parameter is documented as part of the public API.

Thanks to @lgalfaso, @tbosch, and @petebacondarwin.

Closes #9413
2014-11-05 20:41:51 +00:00
Igor Minar
74981c9f20 feat(ngMock): decorator that adds Scope#$countChildScopes and Scope#$countWatchers
When writing tests it's often useful to check the number of child scopes
or watchers within the current current scope subtree. Common use-case for advanced
directives is to test that the directive is properly cleaning up after itself. These
new methods simplify writing assertions that verify that child scopes were properly
destroyed or that watchers were deregistered.

Closes #9926
Closes #9871
2014-11-05 13:23:19 -05:00
Caitlin Potter
e69c1806a8 style(routeSpec.js): make jshint happy 2014-11-01 18:11:51 -04:00
cmichal
b4770582f8 fix(ngRoute): allow proto inherited properties in route params object
copy route params with angular.copy before using angular.extend which looks only for enumerable own
properties

Closes #8181
Closes #9731
2014-11-01 18:08:24 -04:00
Henry Zhu
030101a43a style(*): add numerous JSCS rules to unify code-styles in the tree
Changes:

  - add rule requireSpaceBeforeBlockStatements (require space before brace when opening block statement)
  - add operators to rule disallowSpaceAfterPrefixUnaryOperators (no space after prefix inc/dec ops)
  - add rule disallowSpaceBeforePostfixUnaryOperators (no space before postfix inc/dec ops)
  - add rule disallowSpacesInsideArrayBrackets (array literals no longer padded with spaces)
  - add rule requireCommaBeforeLineBreak (line can't start with comma token)
  - add rule validateLineBreaks (require LF linebreaks)

Closes #9792
2014-10-31 11:27:16 -04:00
Juan Gabriel Jimenez Campos
4b4098bfca fix(select): assign result of track exp to element value
Fixes a regression where the option/select values would always be set to
the key or index of a value within the corresponding collection. Prior to
some 1.3.0 refactoring, the result of the track expression would be bound
to the value, but this behavior was not documented or explicitly tested. A
cache was added in order to improve performance getting the associated
value for a given track expression.

This commit adds one explicit test for this behavior, and changes several
other trackBy tests to reflect the desired behavior as well.

Closes #9718
Fixes #9592
2014-10-29 11:37:48 -07:00
Christian Liebel
875f8f6557 test(ngSanitize): fix test descriptions
SVG attribute test splitted, descriptions changed accordingly

Related to #9770
Closes #9787
2014-10-25 14:03:26 +02:00
Kent C. Dodds
2cd5b4ec44 fix($compile): returning null when an optional controller is not found
Currently, `undefined` is returned. However, the desired behavior is to
return `null` when the controller is optional and not found.

(If this breaks your app, it really shouldn't .v.)

Closes #9404
Closes #9392
2014-10-24 15:14:31 -04:00
Kent C. Dodds
4bf254c155 test($compile): add test for optional require in directives with ^ operator
The directive property `require` allows optional requirement via
the `?` before or after the `^` operator. Add tests to ensure this
functionality is not lost inadvertently.

Closes #9391
Closes #9392
2014-10-24 15:14:20 -04:00
Shahar Talmi
4d12812bb4 refactor(tests): remove some duplicate conditions
Closes #9706
2014-10-24 15:08:56 -04:00
Shahar Talmi
42f7c80bb6 chore(tests): remove redundant file
Closes #9706
2014-10-24 15:08:43 -04:00
Georgios Kalpakas
7574dd25d9 style(filterSpec): fix white-space and newline inconsistencies
Closes #9765
2014-10-24 14:51:34 -04:00
Georgios Kalpakas
e780eeee27 test(ngSanitize): enhance test regarding the xlink:href attribute
Closes #9770
2014-10-23 21:13:07 -04:00
Christian Liebel
a54b25d779 feat(ngSanitize): accept SVG elements and attributes
SVG elements and attributes are now accepted and sanitized by ngSanitize.

Closes #9578
Closes #9751
2014-10-23 16:40:34 -04:00
Caitlin Potter
36666f6fad chore(compileSpec): make jscs happy
Broke because 40bbc98178 landed before d3b1f502e3
2014-10-23 16:29:52 -04:00