Commit graph

1172 commits

Author SHA1 Message Date
Zach Snow
2a7043fa23 test($parse): improve clarity of ternary tests 2013-05-17 06:46:09 +01:00
Matias Niemelä
c53d4c9430 feat($animator): provide support for custom animation events 2013-05-16 16:17:46 -07:00
Matias Niemelä
24ed61cf5c test($animator): ensure invalid $sniffer.transitions and $sniffer.animations flags are caught in animation spec code 2013-05-16 16:17:46 -07:00
Julie
0401a7f598 fix(jqLite): pass a dummy event into triggerHandler
Previously, anchor elements could not be used with triggerHandler because
triggerHandler passes null as the event, and any anchor element with an empty
href automatically calls event.preventDefault(). Instead, pass a dummy event
when using triggerHandler, similar to what full jQuery does. Modified from
PR #2379.
2013-05-16 16:15:31 -07:00
Zach Snow
6798fec439 feat($parse): add support for ternary operators to parser
Add '?' token to lexer, add ternary rule to parser at
(hopefully) proper precedence and associativity (based
on https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Operator_Precedence).
Since (exp1 && exp2 || exp3) is supported by the parser,
and (exp1 ? exp2 : exp3) works the same way, it seems
reasonable to add this minor form of control to templates
(see #719).
2013-05-16 22:30:37 +01:00
Ryan Schumacher
cefbcd470d fix($resource): null default param results in TypeError
Fixes issue when setting a default param as `null` error
`TypeError: Cannot read property 'charAt' of null`
2013-05-16 14:26:08 -07:00
Daniel Stockton
f9b897de4b feat($http): add a default content type for PATH requests
The default header is now application/json which while not perfect
in all cases is better than the browser default application/xml.

The new headers also makes for better compatibility with Rails 4
2013-05-16 14:05:05 -07:00
Samuel Santos
d551d72924 feat(ngSrcset): add new ngSrcset directive
In line with ngSrc and ngHref, this new directive ensures that the
`srcset` HTML5 attribute does not include a pre-interpolated string.
Without it the browser will fetch from the URL with the literal text
`{{hash}}` until AngularJS replaces the expression inside `{{hash}}`.

Closes #2601
2013-05-14 21:29:21 +01:00
Andreas Marek
629fb37351 feat(scenario): adds mousedown and mouseup event triggers to scenario
Added mousedown and mouseup event triggers to scenadio dsl 'element' expression.
Added mousedown and mouseup to the custom jquery trigger method to generate real events.
2013-05-14 20:50:36 +01:00
Glenn Goodrich
53061363c7 feat($resource): collapse empty suffix parameters correctly
Previously only repeated `/` delimiters were collapsed into a
single `/`.  Now, the sequence `/.` at the end of the template, i.e.
only followed by a sequence of word characters, is collapsed into a single
`.`. This makes it easier to support suffixes on resource URLs.
For example, given a resource template of `/some/path/:id.:format`, if
the `:id` is `""` but format `"json"` then the URL is now
`/some/path.json`, rather than `/some/path/.json`.

BREAKING CHANGE: A `/` followed by a `.`, in the last segment of the
URL template is now collapsed into a single `.` delimiter. For example:
`users/.json` will become `users.json`. If your server relied upon this
sequence then it will no longer work. In this case you can now escape the
`/.` sequence with `/\.`
2013-05-14 20:01:15 +01:00
quazzie
c32a859bdb feat(select): match options by expression other than object identity
Extend ng-options with a new clause, "track by [trackByExpression]", which can be used when
working with objects.  The `trackByExpression` should uniquely identify select options objects.
This solves the problem of previously having to match ng-options objects by identity.
You can now write: `ng-options="obj as obj.name for obj in objects track by obj.id"`
The "track by" expression will be used when checking for equality of objects.

Examples:
<select
    ng-model="user.favMovieStub"
    ng-options="movie as movie.name for movie in movies track by movie.id">
</select>

scope: {
  user: { name: 'Test user', favMovieStub: { id: 1, name: 'Starwars' } }
  movies: [{ id: 1, name: 'Starwars', rating: 5, ... }, { id: 13, ... }]
}

The select input will match user favMovieStub to the first movie in the movies array, and show
"Star Wars" as the selected item.
2013-05-14 19:58:05 +01:00
Matias Niemelä
4acc28a310 feat(ngAnimate): cancel previous incomplete animations when new animations take place 2013-05-13 21:09:43 -07:00
Matias Niemelä
0930d9dfe7 chore($sniffer): replace remaining supportsTransitions/supportsAnimations flags inside tests 2013-05-13 18:12:25 -04:00
Chirayu Krishnappa
3952d35abe fix($browser): should use first value for a cookie.
With this change, $browser.cookies()["foo"] will behave like
docCookies.getItem("foo") where docCookies is defined at
https://developer.mozilla.org/en-US/docs/DOM/document.cookie

This fixes the issue where, if there's a value for the XSRF-TOKEN cookie
value with the path /, then that value is used for all applications in
the domain even if they set path specific values for XSRF-TOKEN.

Closes #2635
2013-05-11 09:28:14 -07:00
Lucas Galfasó
67a4a25b89 fix(ngPluralize): handle the empty string as a valid override
Fix the check for overrides so it is able to handle the empty string

Closes #2575
2013-05-10 20:03:24 +01:00
Matias Niemelä
11f712bc3e chore(ngAnimate): CSS classes X-setup/X-start -> X/X-active
BREAKING CHANGE: css classes foo-setup/foo-start become foo/foo-active

The CSS transition classes have changed suffixes. To migrate rename
.foo-setup {...} to .foo {...}
.foo-start {...} to .foo-active {...}

or for type: enter, leave, move, show, hide

.foo-type-setup {...} to .foo-type {...}
.foo-type-start {...} to .foo-type-active {...}
2013-05-08 16:03:31 -07:00
Matias Niemelä
14757874a7 feat(ngAnimate): Add support for CSS3 Animations with working delays and multiple durations 2013-05-08 15:56:53 -07:00
Matias Niemelä
88c3480aff feat($sniffer): Add support for supportsAnimations flag for detecting CSS Animations browser support 2013-05-08 15:40:37 -07:00
Igor Minar
35adade6ac test(sortedHtml): ignore bogus rowspan=1 and colspan=1 in IE 2013-05-08 07:57:34 -07:00
Igor Minar
86b33eb3f1 test(sortedHtml): fix comment support in sortedHtml helper 2013-05-08 07:57:34 -07:00
R. Merkert
6d0b325f7f fix(angular): do not copy $$hashKey in copy/extend functions.
Copying the $$hashKey as part of copy/extend operations makes little
sense since hashkey is used primarily as an object id, especially in
the context of the ngRepeat directive. This change maintains the
existing $$hashKey of an object that is being copied into (likewise for
extend).
It is not uncommon to take an item in a collection, copy it,
and then append it to the collection. By copying the $$hashKey, this
leads to duplicate object errors with the current ngRepeat.

Closes #1875
2013-05-08 12:45:32 +01:00
Illniyar
cf4729faa3 feat($cookieStore): $cookieStore.get now parses blank string as blank string
closes #1918
2013-05-08 10:04:07 +01:00
Kevin Wells
4f2e360685 fix(date): correctly format dates with more than 3 sub-second digits
This date {{2003-09-10T13:02:03.123456Z | date: yyyy-mm-dd ss} is now
treated as having 123.45ms. Previously it had 123456ms so 123 seconds
were added to the formatted date.
Use local date in unit tests so they work in any time zone
2013-05-07 22:59:46 +01:00
Chad Smith
4622af3f07 fix(select): ensure empty option is not lost in IE9
Fix a check inside render for select elements with ngOptions, which
compares the selected property of an element with it's desired state.
Ensure the placeholder, if available, is explicitly selected if the model
value can not be found in the option list.
Without these fixes it's up to the browser implementation to decide which
option to choose. In most browsers, this has the effect of displaying the
first item in the list. In IE9 however, this causes the select to display
nothing.

Closes #2150, #1826
2013-05-07 21:27:42 +01:00
Misko Hevery
2c69a6735e fix($location): prevent navigation when event isDefaultPrevented 2013-05-06 21:52:53 -07:00
Matthieu Larcher
af0eaa3047 feat(ngInclude): $includeContentRequested event
Adding a $includeContentRequested event in order to better keep track of
how many includes are sent and be able to compare it with how many have
finished.
2013-05-03 19:55:47 +01:00
Misko Hevery
a348e90aa1 fix($location): compare against actual instead of current URL 2013-05-02 18:22:03 -04:00
Misko Hevery
4bd7bedf48 fix($location): prevent navigation if already on the URL 2013-05-02 15:22:17 -04:00
Misko Hevery
fd21c7502f fix(ngAnamite): eval ng-animate expression on each animation 2013-05-02 15:22:16 -04:00
Misko Hevery
80341cb9ba feat(injector): add has method for querying
Closes #2556
2013-05-02 15:22:16 -04:00
Misko Hevery
9956baedd7 fix(ngView): accidentally compiling leaving content
closes: #2304
2013-05-02 15:22:16 -04:00
Gonzalo Ruiz de Villa
1d8e11ddfb fix(ngRepeat): correctly iterate over array-like objects
Check if the object is array-like to iterate over it like it's done with arrays.

Closes #2546
2013-05-02 15:12:37 +01:00
Gonzalo Ruiz de Villa
6452707d40 fix($rootScope) ensure $watchCollection correctly handles arrayLike objects 2013-05-02 15:12:37 +01:00
quazzie
dc9a580617 fix($location): back-button should fire $locationChangeStart
Before $locationChangeStart event is not broadcast when pressing the back-button on the browser.

Closes #2109
2013-05-01 14:42:10 +01:00
Pete Bacon Darwin
660605bdb8 test(ngAnimate): also provide W3C transition property to work on IE10
Closes: #2492
2013-05-01 13:57:44 +01:00
Braden Shepherdson
52a55ec618 feat(ngTap): Add a CSS class while the element is held down. 2013-04-30 16:56:24 -07:00
Vojta Jina
e295eeefaa test(controller): instantiate controller defined on window
Just adding a missing spec.
2013-04-30 14:38:14 -07:00
Vojta Jina
de2cdb0658 fix(ngController): allow dots in a controller name
The issue was introduced in cd38cbf975
2013-04-30 14:38:14 -07:00
David Bennett
cda7b71146 feat($httpBackend): add timeout support for JSONP requests
Documentation implies that timeout works for all requests, though it
only works with XHR. To implement:
- Change $httpBackend to set a timeout for JSONP requests which will
immediately resolve the request when fired.
- Cancel the timeout when requests are completed.
2013-04-30 20:42:34 +01:00
Misko Hevery
400f9360bb fix(ngController): change controllerAlias to controllerAs. 2013-04-29 14:28:54 -04:00
Lucas Galfasó
da8c320bde test(parse): Test for the parsing not invoking twice to get self
New tests to not call twice a function to get self
2013-04-29 19:12:19 +01:00
gockxml
06f2b2a8cf fix(jqLite): correct implementation of mouseenter/mouseleave event
Implement mouseenter/mouseleave event referring to
http://www.quirksmode.org/js/events_mouse.html#link8 and jQuery source
code(not dependent on jQuery).
The old implementation is wrong. When moving mouse from a parent element
into a child element, it would trigger mouseleave event, which should not.
And the old test about mouseenter/mouseleave is wrong too. It just
triggers mouseover and mouseout events, cannot describe the process of mouse
moving from one element to another element, which is important for
mouseenter/mouseleave.

Closes #2131, #1811
2013-04-29 18:26:32 +01:00
Oren Avissar
0985a37376 test(browser/compile): fix calls to Jasmine fail()
The fail() function in Jasmine expects an Error object parameter.
Also, there is no global alias for fail() so it must be accessed using
`this.fail(new Error())`.
2013-04-29 16:56:35 +01:00
Pete Bacon Darwin
0fbf584643 test(location): should not rewrite Html5 deep urls 2013-04-25 19:08:41 +01:00
Laurent Cozic
6605adf6d9 feat($q): add $q.always() method
Add $q.always(callback) method that is always called whether the promise is successful or fails; includes unit tests and updates
documentation.
2013-04-24 20:56:18 +01:00
Misko Hevery
cd38cbf975 feat(controller): support as instance syntax
Support ng-controller="MyController as my" syntax
which publishes the controller instance to the
current scope.

Also supports exporting a controller defined with route:
````javascript
angular.module('routes', [], function($routeProvider) {
  $routeProvider.when('/home', {controller: 'Ctrl as home', templateUrl: '...'});
});
````
2013-04-22 23:28:41 -07:00
Misko Hevery
021bdf3922 fix($animator): remove dependency on window.setTimeout. 2013-04-22 23:13:26 -07:00
Oren Avissar
2f96fbd175 feat(ngIf): add directive to remove and recreate DOM elements
This directive is adapted from ui-if in the AngularUI project and provides a complement
to the ngShow/ngHide directives that only change the visibility of the DOM element and
ngSwitch which does change the DOM but is more verbose.
2013-04-19 21:45:38 +01:00
Igor Minar
5da6b125a7 test(modules): fix module tests which got disabled by ngMobile
When ngMobile was merged in, we accidentaly included angular-scenario.js
in the test file set for modules. Loading this file overrode jasmine's
`it` and `describe` global functions which essentially disabled all of
~200 unit tests for wrapped modules.

This change refactors the code to run the wrapped module tests.

I had to extract browserTrigger from scenario runner in order to achieve
this without code duplication.
2013-04-18 14:34:53 -07:00
Mark Dalgleish
363e4cbf64 fix(ngModel): use paste/cut events in IE to support context menu
In IE the model is not updated when the input value is modified using the context
menu, e.g. pasting from the clipboard, or cutting all or part of the current value.
To capture these changes, we bind to the proprietary 'paste' and 'cut' events.

Closes #1462
2013-04-17 21:20:08 +01:00