29 Commits

Author SHA1 Message Date
Peter Bacon Darwin
0f9fd2f642 test(input): split tests into smaller files
This is complement to the previous commit.
It also refactors the input compile helpers to make it cleaner and more
consistent.
2014-12-24 23:19:39 +00: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
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
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
483ce91da2 style(*): add disallowSpacesInsideParentheses rule to jscs
Closes #9685
2014-10-20 10:39:46 +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
35049be9d9 test(matchers.js): make toHaveClass matcher work better for SVG+jQuery 2014-10-08 14:56:49 -04:00
Rouven Weßling
a591e8b8d3 perf(map): use Array.prototype.map
Replace helper functions with the native ES5 method
2014-09-22 14:09:48 -07:00
Igor Minar
f33a938545 chore(testabilityPatch): fix the dump fn so that it works with karma's debug.html 2014-09-09 16:19:47 +02:00
Rouven Weßling
3471fedfbc refactor(indexOf) Remove a now unused copy of the indexOf function
This was missed in 300bffc4fe

Closes #8939
2014-09-05 10:23:52 +01:00
Rouven Weßling
300bffc4fe refactor(indexOf) use Array.prototype.indexOf exclusively
Replace helper functions with the native ES5 method

Closes #8847
2014-09-03 13:37:03 +01:00
Matias Niemelä
bf0f5502b1 feat($animate): use promises instead of callbacks for animations
The $animate service (both the service inside of ng and ngAnimate) now
makes use of promises instead of callback functions.

BREAKING CHANGE

Both the API for the cancallation method and the done callback for
$animate animations is different. Instead of using a callback function
for each of the $animate animation methods, a promise is used instead.

```js
//before
$animate.enter(element, container, null, callbackFn);

//after
$animate.enter(element, container).then(callbackFn);
```

The animation can now be cancelled via `$animate.cancel(promise)`.

```js
//before
var cancelFn = $animate.enter(element, container);
cancelFn(); //cancels the animation

//after
var promise = $animate.enter(element, container);
$animate.cancel(promise); //cancels the animation
```
2014-08-26 11:44:25 -04:00
Igor Minar
1a2caad922 chore(mocks): remove helper fn angular.mocks.clearData
we don't need this any more because Karma reloads the iframe after each test run

Related to #8532
Closes #8618
2014-08-22 15:30:34 -07:00
Michał Gołębiowski
b9389b26ba fix(jQuery): cooperate with other libraries monkey-patching jQuery.cleanData
Some libraries (like jQuery UI) patch jQuery.cleanData as well. This commit
makes Angular work correctly even if such external patching was done after
the Angular one.

Fixes #8471
2014-08-14 21:09:13 +02:00
Michał Gołębiowski
9e7cb3c375 feat(jQuery): upgrade to jQuery to 2.1.1
The data jQuery method was re-implemented in 2.0 in a secure way. This made
current hacky Angular solution to move data between elements via changing the
value of the internal node[jQuery.expando] stop working. Instead, just copy the
data from the first element to the other one.

Testing cache leaks on jQuery 2.x is not possible in the same way as it's done
in jqLite or in jQuery 1.x as there is no publicly exposed data storage. One
way to test it would be to intercept all places where a jQuery object is created
to save a reference to the underlaying node but there is no single place in the
jQuery code through which all element creation passes (there are various
shortcuts for performance reasons). Instead we rely on jqLite.cache testing
to find potential data leaks.

BREAKING CHANGE: Angular no longer supports jQuery versions below 2.1.1.
2014-07-31 22:20:31 +02:00
Michał Gołębiowski
e8e0750277 fix(testabilityPatch): fix invocations of angular.mock.dump 2014-06-23 23:38:15 +02:00
Igor Minar
8c6a8171f9 perf(Scope): change Scope#id to be a simple number
In apps that create lots of scopes (apps with large tables) the uid generation
shows up in the profiler and adds a few milliseconds. Using simple counter
doesn't have this overhead.

I think the initial fear of overflowing and thus using string alphanum sequence
is unjustified because even if an app was to create lots of scopes non-stop,
you could create about 28.6 million scopes per seconds for 10 years before
you would reach a number that can't be accurately represented in JS

BREAKING CHANGE: Scope#$id is now of time number rather than string. Since the
id is primarily being used for debugging purposes this change should not affect
anyone.
2014-06-13 11:35:26 -07:00
Arturo Guzman
adcc5a00bf feat(input): add $touched and $untouched states
Sets the ngModel controller property $touched to True and $untouched to False whenever a 'blur' event is triggered over a control with the ngModel directive.
Also adds the $setTouched and $setUntouched methods to the NgModelController.

References #583
2014-06-10 23:06:31 -04:00
rodyhaddad
ee8fae8c0f test(jqLite): adapt tests to new expando name 2014-06-05 14:14:48 -07:00
Shahar Talmi
accd35b747 chore(jshint): enforce jshint for tests
Closes #7264
2014-04-27 21:20:31 +01:00
Igor Minar
c5e41a0325 chore(log): add log.empty() method to the testing logger
`log.empty()` is the same as `log.reset()`, except thati `empty()`  also returns the current array with messages

instead of:

```
// do work
expect(log).toEqual(['bar']);
log.reset();
```

do:

```
// do work
expect(log.empty()).toEqual(['bar']);
```
2014-03-18 12:00:50 -07:00
Michał Gołębiowski
3410f65e79 perf(jqLite): implement and use the empty method in place of html(‘’)
jQuery's elem.html('') is way slower than elem.empty(). As clearing
element contents happens quite often in certain scenarios, switching
to using .empty() provides a significant performance boost when using
Angular with jQuery.

Closes #4457
2013-12-13 02:07:11 -08:00
Pete Bacon Darwin
07272608d8 fix(modules): stop leaking global variables in tests
The routeUtils.js file was declaring a number of functions that were
leaking into other modules such as ngMocks causing tests to pass
incorrectly.

Closes #4360
2013-10-10 11:58:15 -07:00
jankuca
9efa46ae64 feat(ngRepeat): use block separator comments
Issue: multi-elements ng-repeat (ng-repeat-start, ng-repeat-end) can contain elements with a trancluding directive. This directive changes content of the row (template) and ng-repeat does not work correctly (when removing/moving rows), because ng-repeat works with the original template (elements).

This changes ng-repeat behavior to traverse the DOM to find current elements everytime we are moving/removing rows (if the template has multiple elements).

Closes #3104
2013-10-09 15:19:10 -07:00
Brian Ford
c785267eb8 fix(jqLite): use get/setAttribute so that jqLite works on SVG nodes
jqLite previously used `elt.className` to add and remove classes from a DOM Node, but
because the className property is not writable on SVG elements, it doesn't work with
them. This patch replaces accesses to `className` with `get/setAttribute`.

`classList` was also considered as a solution, but because only IE10+ supports it, we
have to wait. :'(

The JqLiteAddClass/JQLiteRemoveClass methods are now also used directly by $animate
to work around the jQuery not being able to handle class modifications on SVG elements.

Closes #3858
2013-09-27 12:38:27 -07:00
Igor Minar
1d06a94385 chore: reorganize test helper files under test/helpers 2013-08-23 15:46:11 -07:00