2091 Commits

Author SHA1 Message Date
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
Henry Zhu
d3b1f502e3 style(*): add rule disallowSpacesInAnonymousFunctionExpression beforeOpeningRoundBrace, including i18n generator 2014-10-23 15:59:26 -04:00
Henry Zhu
7f65f97919 style(*): add rule requireSpacesInFunction beforeOpeningCurlyBrace
This rule enforces a space after the curly brace
for function declarations, anonymous function expressions,
and named function expressions.
2014-10-23 15:59:25 -04:00
Henry Zhu
922162853b style(*): add rule disallowSpacesInFunctionDeclaration beforeOpeningRoundBrace 2014-10-23 15:59:25 -04:00
Gabriel Monteagudo
40bbc98178 feat($compile): allow $watchCollection to be used in bi-directional bindings
an asterisk can be specified in the binding definition to use $watchCollection instead of $watch.
e.g. scope: { prop: '=*' }

Closes #9725
2014-10-23 14:08:55 -04:00
Rouven Weßling
031d4cd2a9 chore($sniffer) remove Opera < 15 vendor prefixes and document it
Closes #9483
2014-10-22 15:38:36 -04:00
Pablo Villoslada Puigcerber
531a8de72c fix($observe): check if the attribute is undefined
Check if the attribute is undefined before manually applying the function because if not an
undefined property is added to the scope of the form controller when the input control does not
have a name.

Closes #9707
Closes #9720
2014-10-22 13:45:37 -04:00
Michal Cieplucha
52ceec2229 fix(templateRequest): allow empty html template
allow empty html template and not throw error

Closes #9581
2014-10-21 06:31:25 -07:00
Caitlin Potter
2240c113f5 chore(tests): implement e2e test harness outside of docs app
Included:

- A sample test fixture
- A sample test
- Server middleware to serve the E2E harness
- Convenient test helpers to simplify loading the right fixture

Closes #9557
Closes #9527
2014-10-20 11:26:09 -04:00
Bastien Caudan
1025f6ebf4 fix(ngMock): $httpBackend should match data containing Date objects correctly
If a response or expectation contained a date object then `$httpBackend.expect`
was not matching correctly.

This commit encodes then decodes the object being matched to ensure consistency.

Closes #5127
2014-10-20 13:06:44 +01:00
Henry Zhu
483ce91da2 style(*): add disallowSpacesInsideParentheses rule to jscs
Closes #9685
2014-10-20 10:39:46 +01:00
Henry Zhu
31ec9f14ef style(*): add validateParameterSeparator rule to jscs
Closes #9685
2014-10-20 10:39:37 +01:00
Henry Zhu
8b921617e9 style(*): add disallowTrailingComma rule for objects and arrays
Closes #9685
2014-10-20 10:39:32 +01:00
Rouven Weßling
ba9d0738cd refact(Angular.js) remove unused functions
This removes the functions size() and isLeafNode().

Closes #9682
2014-10-20 10:21:57 +01:00
Dmytro Yarmak
bf9e7bfb5a fix($rootScope.$on) check listener existense while deregistering
Check that listener is still present in $$listeners before decrease
$$listenerCount. It fixes problem with incorrect $$listenerCount after
call deregistering function multiple times.

Closes #9666
Closes #9667
2014-10-19 11:21:56 +01:00
Henry Zhu
ed3f799b5c style(*): disallow space after object keys, other rules
add `disallowSpaceAfterObjectKeys` and associated changes.
add `disallowMixedSpacesAndTabs` (no files changed)
add `disallowMultipleLineStrings` (no files changed)

Closes #9679
2014-10-19 11:09:16 +01:00
Henry Zhu
accb22d644 style(*): enforce spaces after keywords, add spaces
Closes #9677
2014-10-18 10:15:40 -04:00
Caitlin Potter
1bd473eb45 fix($templateRequest): ignore JSON Content-Type header and content
Normally, if there is a Content-Type header with the string "application/json", or else the content
looks sort of JSON-y, $http will attempt to deserialize the JSON into an object. $templateRequest
is intended to request markup, and as such should never attempt to parse JSON, regardless of the
headers or shape of the content.

Closes #5756
Closes #9619
2014-10-17 18:07:35 -04:00
Shahar Talmi
6e5e76e4b1 refactor(Angular): removed redundant test 2014-10-17 22:50:53 +03:00
Shahar Talmi
45252c3a54 fix($sce): use msie instead of $document[0].documentMode
this is important so that people can mock $window without having to add stuff that angular uses internally into it

Closes #9661
2014-10-17 22:35:31 +03:00
Georgios Kalpakas
c2fb4b6986 test($resource): enhance test-case to verify correct behaviour
Previously, the test-case verified that calling `toJson()`, would remove
the `$promise` and `$resolved`, but not that other `$`-prefixed properties
would not be removed.

Closes #9628
2014-10-17 00:30:37 -07:00
Julie Ralph
02aa4f4b85 fix(testability): escape regex chars in findBindings if using exactMatch
Move the function to escape regexps to Angular.js, fix the link, and use it in
the $$testability service.

Closes #9595
Closes #9600
2014-10-14 10:42:13 +01:00
HeberLZ
28661d1a8c fix($parse): support dirty-checking objects with null prototype
Objects created with `Object.create(null);` do not have a `valueOf` method unless
they supply one themselves. To accomodate these, Object.prototype.valueOf is
used when the type of the value is "object", and the `valueOf` property is not
a function (E.G. it's not in the object at all).

Closes #9568
2014-10-13 23:09:19 -04:00
Matias Niemelä
02be700bda feat($animate): introduce the $animate.animate() method 2014-10-13 12:11:52 -07:00
Matias Niemelä
e5f4d7b10a feat($animate): allow $animate to pass custom styles into animations
$animate now supports an optional parameter which provides CSS styling
which will be provided into the CSS-based animations as well as any
custom animation functions. Once the animation is complete then the
styles will be applied directly to the element. If no animation is
detected or the `ngAnimate` module is not active then the styles
will be applied immediately.

BREAKING CHANGE: staggering animations that use transitions will now
always block the transition from starting (via `transition: 0s none`)
up until the stagger step kicks in. The former behaviour was that the
block was removed as soon as the pending class was added. This fix
allows for styles to be applied in the pending class without causing
an animation to trigger prematurely.
2014-10-13 12:11:52 -07:00
Michał Gołębiowski
4a85512174 refactor($browser): more test coverage around history.state manipulation
Check that pushState is not invoked if $browser.url() and $browser.state()
is passed to $browser.url setter.

Also, a minor refactor in $browser.url code and $browser specs.

Refs #9587
2014-10-13 10:46:09 -07:00
Michał Gołębiowski
1efaf3dc13 fix($browser): account for IE deserializing history.state on each read
IE 10-11+ deserialize history.state on every read, causing simple comparisons
against history.state always return false. Account for that caching
`history.state` on every hashchange or popstate event.

Also:
1. Prevent firing onUrlChange callbacks twice if both popstate and hashchange
event were fired.
2. Fix the issue of routes sometimes not firing the URL change in all browsers.

Closes #9587
Fixes #9545
2014-10-13 09:00:54 -07:00
Michał Gołębiowski
393c1c7c20 chore(jqLite): remove leftover attachEvent/detachEvent from tests 2014-10-13 16:44:22 +02:00
Tero Parviainen
874cac825b fix($parse): stabilize one-time literal expressions correctly
Change `oneTimeLiteralWatchDelegate` to use the last value in the
digest cycle to check if the literal value is stable
2014-10-13 10:51:30 +02:00
Peter Bacon Darwin
09c39d2ce6 feat($anchorScroll): support a configurable vertical scroll offset
Add support for a configurable vertical scroll offset to `$anchorScroll`.

The offset can be defined by a specific number of pixels, a callback function
that returns the number of pixels on demand or a jqLite/JQuery wrapped DOM
element whose height and position are used if it has fixed position.

The offset algorithm takes into account items that are near the bottom of
the page preventing over-zealous offset correction.

Closes #9368
Closes #2070
Closes #9360
2014-10-12 17:55:43 +01:00