Socket
Socket
Sign inDemoInstall

angular-mocks

Package Overview
Dependencies
0
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install
Previous1345
11Next

1.7.3

Diff

Changelog

Source

1.7.3 eventful-proposal (2018-08-03)

Bug Fixes

  • $location:
    • fix infinite recursion/digest on URLs with special characters (e68697, #16592, #16611)
    • avoid unnecessary $locationChange* events due to empty hash (1144b1, #16632, #16636)
  • ngMock.$httpBackend:
  • Angular: add workaround for Safari / Webdriver problem (0a1db2, #16645)
  • $animate: avoid memory leak with $animate.enabled(element, enabled) (4bd424, #16649)
  • $compile:
  • ngEventDirs:
    • pass error in handler to $exceptionHandler when event was triggered in a digest (688211)
    • don't wrap the event handler in $apply if already in $digest (535ee3, #14673, #14674)
  • angular.element: do not break on cleanData() if _data() returns undefined (7cf4a2, #16641, #16642)
  • ngAria: do not scroll when pressing spacebar on custom buttons (3a517c, #14665, #16604)

New Features

Performance Improvements

<a name="1.7.2"></a>

angularcore
published 1.7.2 •

Changelog

Source

1.7.2 extreme-compatiplication (2018-06-12)

In the previous release, we removed a private, undocumented API that was no longer used by AngularJS. It turned out that several popular UI libraries (such as AngularJS Material, UI Bootstrap, ngDialog and probably others) relied on that API.

In order to avoid unnecessary pain for developers, this release reverts the removal of the private API and restores compatibility of the aforementioned libraries with the latest AngularJS.

Reverts

<a name="1.7.1"></a>

angularcore
published 1.7.1 •

Changelog

Source

1.7.1 momentum-defiance (2018-06-08)

Bug Fixes

New Features

<a name="1.7.0"></a>

angularcore
published 1.7.0 •

Changelog

Source

1.7.0 nonexistent-physiology (2018-05-11)

Here are the full changes for the release of 1.7.0 that are not already released in the 1.6.x branch, which includes commits from 1.7.0-rc.0 and commits from 1.7.0 directly.

1.7.0 is the last scheduled release of AngularJS that includes breaking changes. 1.7.x patch releases will continue to receive bug fixes and non-breaking features until AngularJS enters Long Term Support mode (LTS) on July 1st 2018.

Bug Fixes

  • input:
  • input[number]: validate min/max against viewValue (aa3f95, #12761, #16325)
  • input[date]: correctly parse 2-digit years (627180, #16537, #16539)
  • jqLite: make removeData() not remove event handlers (b7d396, #15869, #16512)
  • $compile:
    • remove the preAssignBindingsEnabled flag (38f8c9, #15782)
    • add base[href] to the list of RESOURCE_URL context attributes (1cf728, #15597)
  • $interval: throw when trying to cancel non-$interval promise (a8bef9, #16424, #16476)
  • $timeout: throw when trying to cancel non-$timeout promise (336525, #16424, #16476)
  • $cookies: remove the deprecated $cookieStore factory (73c646, #16465)
  • $resource: fix interceptors and success/error callbacks (ea0585, #6731, #9334, #6865, #16446)
  • $templateRequest:
    • give tpload error the correct namespace (c617d6)
    • always return the template that is stored in the cache (fb0099, #16225)
  • $animate: let cancel() reject the runner promise (16b82c, #14204, #16373)
  • ngTouch:
  • ngScenario: completely remove the angular scenario runner (0cd392, #9405)
  • form: set $submitted to true on child forms when parent is submitted (223de5, #10071)
  • $rootScope:
    • provide correct value of one-time bindings in watchGroup (c2b8fa)
    • don't allow explicit digest calls to affect $evalAsync (02c046, #15127, #15494)
  • ngAria: do not set aria attributes on input[type="hidden"] (6d5ef3, #15113, #16367)
  • ngModel, input: improve handling of built-in named parsers (74b04c, #14292, #10076, #16347)
  • $httpParamSerializerJQLike:
  • $parse:
    • do not pass scope/locals to interceptors of one-time bindings (87a586)
    • always pass the intercepted value to watchers (2ee503, #16021)
    • respect the interceptor.$stateful flag (de7403)
  • Angular: remove angular.lowercase and angular.uppercase (1daa4f, #15445)
  • $controller: remove instantiating controllers defined on window (e269c1, #15349, #15762)

New Features

  • angular.isArray: support Array subclasses in angular.isArray() (e3ece2, #15533, #15541)
  • $sce: handle URL sanitization through the $sce service (1e9ead)
  • orderBy: consider null and undefined greater than other values (1d8046, #15294, #16376)
  • $resource: add support for request and requestError interceptors (#15674) (240a3d, #5146)
  • ngModelOptions: add debounce catch-all + allow debouncing 'default' only (55ba44, #15411, #16335)
  • $compile: lower the xlink:href security context for SVG's a and image elements (6ccbfa, #15736)

Performance Improvements

  • $rootScope: allow $watchCollection use of expression input watching (97b00c)
  • ngStyle: use $watchCollection (15bbd3, #15947)
  • $compile: do not use deepWatch in literal one-way bindings (fd4f01, #15301)

Breaking Changes

jqLite due to:

  • b7d396: make removeData() not remove event handlers

Before this commit removeData() invoked on an element removed its event handlers as well. If you want to trigger a full cleanup of an element, change:

elem.removeData();

to:

angular.element.cleanData(elem);

In most cases, though, cleaning up after an element is supposed to be done only when it's removed from the DOM as well; in such cases the following:

elem.remove();

will remove event handlers as well.

$cookies due to:

  • 73c646: remove the deprecated $cookieStore factory

The $cookieStore has been removed. Migrate to the $cookies service. Note that for object values you need to use the putObject & getObject methods as get/put will not correctly save/retrieve them.

Before:

$cookieStore.put('name', {key: 'value'});
$cookieStore.get('name'); // {key: 'value'}
$cookieStore.remove('name');

After:

$cookies.putObject('name', {key: 'value'});
$cookies.getObject('name'); // {key: 'value'}
$cookies.remove('name');

$resource due to:

  • ea0585: fix interceptors and success/error callbacks

If you are not using success or error callbacks with $resource, your app should not be affected by this change.

If you are using success or error callbacks (with or without response interceptors), one (subtle) difference is that throwing an error inside the callbacks will not propagate to the returned $promise. Therefore, you should try to use the promises whenever possible. E.g.:

// Avoid
User.query(function onSuccess(users) { throw new Error(); }).
  $promise.
  catch(function onError() { /* Will not be called. */ });

// Prefer
User.query().
  $promise.
  then(function onSuccess(users) { throw new Error(); }).
  catch(function onError() { /* Will be called. */ });

Finally, if you are using success or error callbacks with response interceptors, the callbacks will now always run after the interceptors (and wait for them to resolve in case they return a promise). Previously, the error callback was called before the responseError interceptor and the success callback was synchronously called after the response interceptor. E.g.:

var User = $resource('/api/users/:id', {id: '@id'}, {
  get: {
    method: 'get',
    interceptor: {
      response: function(response) {
        console.log('responseInterceptor-1');
        return $timeout(1000).then(function() {
          console.log('responseInterceptor-2');
          return response.resource;
        });
      },
      responseError: function(response) {
        console.log('responseErrorInterceptor-1');
        return $timeout(1000).then(function() {
          console.log('responseErrorInterceptor-2');
          return $q.reject('Ooops!');
        });
      }
    }
  }
});
var onSuccess = function(value) { console.log('successCallback', value); };
var onError = function(error) { console.log('errorCallback', error); };

// Assuming the following call is successful...
User.get({id: 1}, onSuccess, onError);
  // Old behavior:
  //   responseInterceptor-1
  //   successCallback, {/* Promise object */}
  //   responseInterceptor-2
  // New behavior:
  //   responseInterceptor-1
  //   responseInterceptor-2
  //   successCallback, {/* User object */}

// Assuming the following call returns an error...
User.get({id: 2}, onSuccess, onError);
  // Old behavior:
  //   errorCallback, {/* Response object */}
  //   responseErrorInterceptor-1
  //   responseErrorInterceptor-2
  // New behavior:
  //   responseErrorInterceptor-1
  //   responseErrorInterceptor-2
  //   errorCallback, Ooops!
  • 240a3d: add support for request and requestError interceptors (#15674)

Previously, calling a $resource method would synchronously call $http. Now, it will be called asynchronously (regardless if a request/requestError interceptor has been defined.

This is not expected to affect applications at runtime, since the overall operation is asynchronous already, but may affect assertions in tests. For example, if you want to assert that $http has been called with specific arguments as a result of a $resource call, you now need to run a $digest first, to ensure the (possibly empty) request interceptor promise has been resolved.

Before:

it('...', function() {
  $httpBackend.expectGET('/api/things').respond(...);
  var Things = $resource('/api/things');
  Things.query();

  expect($http).toHaveBeenCalledWith(...);
});

After:

it('...', function() {
  $httpBackend.expectGET('/api/things').respond(...);
  var Things = $resource('/api/things');
  Things.query();
  $rootScope.$digest();

  expect($http).toHaveBeenCalledWith(...);
});

$templateRequest:

  • due to c617d6: give tpload error the correct namespace

Previously the tpload error was namespaced to $compile. If you have code that matches errors of the form [$compile:tpload] it will no longer run. You should change the code to match [$templateRequest:tpload].

  • due to (fb0099: always return the template that is stored in the cache

The service now returns the result of $templateCache.put() when making a server request to the template. Previously it would return the content of the response directly. This now means if you are decorating $templateCache.put() to manipulate the template, you will now get this manipulated result also on the first $templateRequest rather than only on subsequent calls (when the template is retrived from the cache). In practice this should not affect any apps, as it is unlikely that they rely on the template being different in the first and subsequent calls.

$animate due to:

  • 16b82c: let cancel() reject the runner promise

$animate.cancel(runner) now rejects the underlying promise and calls the catch() handler on the runner returned by $animate functions (enter, leave, move, addClass, removeClass, setClass, animate). Previously it would resolve the promise as if the animation had ended successfully.

Example:

var runner = $animate.addClass('red');
runner.then(function() { console.log('success')});
runner.catch(function() { console.log('cancelled')});

runner.cancel();

Pre-1.7.0, this logs 'success', 1.7.0 and later it logs 'cancelled'. To migrate, add a catch() handler to your animation runners.

angularcore
published 1.7.0-rc.0 •

Changelog

Source

1.7.0-rc.0 maximum-overdrive (2018-04-19)

Bug Fixes

  • input:
  • input[number]: validate min/max against viewValue (aa3f95, #12761, #16325)
  • jqLite: make removeData() not remove event handlers (b7d396, #15869, #16512)
  • $compile:
    • remove the preAssignBindingsEnabled flag (38f8c9, #15782)
    • add base[href] to the list of RESOURCE_URL context attributes (1cf728, #15597)
  • $interval: throw when trying to cancel non-$interval promise (a8bef9, #16424, #16476)
  • $timeout: throw when trying to cancel non-$timeout promise (336525, #16424, #16476)
  • $cookies: remove the deprecated $cookieStore factory (73c646, #16465)
  • $resource: fix interceptors and success/error callbacks (ea0585, #6731, #9334, #6865, #16446)
  • $templateRequest:
    • give tpload error the correct namespace (c617d6)
    • always return the template that is stored in the cache (fb0099, #16225)
  • $animate: let cancel() reject the runner promise (16b82c, #14204, #16373)
  • ngTouch:
  • ngScenario: completely remove the angular scenario runner (0cd392, #9405)
  • form: set $submitted to true on child forms when parent is submitted (223de5, #10071)
  • $rootScope:
    • provide correct value of one-time bindings in watchGroup (c2b8fa)
  • ngAria: do not set aria attributes on input[type="hidden"] (6d5ef3, #15113, #16367)
  • ngModel, input: improve handling of built-in named parsers (74b04c, #14292, #10076, #16347)
  • $httpParamSerializerJQLike:
  • $parse:
    • do not pass scope/locals to interceptors of one-time bindings (87a586)
    • always pass the intercepted value to watchers (2ee503, #16021)
    • respect the interceptor.$stateful flag (de7403)
  • Angular: remove angular.lowercase and angular.uppercase (1daa4f, #15445)
  • $controller: remove instantiating controllers defined on window (e269c1, #15349, #15762)

New Features

  • angular.isArray: support Array subclasses in angular.isArray() (e3ece2, #15533, #15541)
  • $sce: handle URL sanitization through the $sce service (1e9ead)
  • orderBy: consider null and undefined greater than other values (1d8046, #15294, #16376)
  • $resource: add support for request and requestError interceptors (#15674) (240a3d, #5146)
  • ngModelOptions: add debounce catch-all + allow debouncing 'default' only (55ba44, #15411, #16335)
  • $compile: lower the xlink:href security context for SVG's a and image elements (6ccbfa, #15736)

Performance Improvements

  • $rootScope: allow $watchCollection use of expression input watching (97b00c)
  • ngStyle: use $watchCollection (15bbd3, #15947)
  • $compile: do not use deepWatch in literal one-way bindings (fd4f01, #15301)

Breaking Changes

jqLite due to:

  • b7d396: make removeData() not remove event handlers

Before this commit removeData() invoked on an element removed its event handlers as well. If you want to trigger a full cleanup of an element, change:

elem.removeData();

to:

angular.element.cleanData(elem);

In most cases, though, cleaning up after an element is supposed to be done only when it's removed from the DOM as well; in such cases the following:

elem.remove();

will remove event handlers as well.

$cookies due to:

  • 73c646: remove the deprecated $cookieStore factory

The $cookieStore has been removed. Migrate to the $cookies service. Note that for object values you need to use the putObject & getObject methods as get/put will not correctly save/retrieve them.

Before:

$cookieStore.put('name', {key: 'value'});
$cookieStore.get('name'); // {key: 'value'}
$cookieStore.remove('name');

After:

$cookies.putObject('name', {key: 'value'});
$cookies.getObject('name'); // {key: 'value'}
$cookies.remove('name');

$resource due to:

  • ea0585: fix interceptors and success/error callbacks

If you are not using success or error callbacks with $resource, your app should not be affected by this change.

If you are using success or error callbacks (with or without response interceptors), one (subtle) difference is that throwing an error inside the callbacks will not propagate to the returned $promise. Therefore, you should try to use the promises whenever possible. E.g.:

// Avoid
User.query(function onSuccess(users) { throw new Error(); }).
  $promise.
  catch(function onError() { /* Will not be called. */ });

// Prefer
User.query().
  $promise.
  then(function onSuccess(users) { throw new Error(); }).
  catch(function onError() { /* Will be called. */ });

Finally, if you are using success or error callbacks with response interceptors, the callbacks will now always run after the interceptors (and wait for them to resolve in case they return a promise). Previously, the error callback was called before the responseError interceptor and the success callback was synchronously called after the response interceptor. E.g.:

var User = $resource('/api/users/:id', {id: '@id'}, {
  get: {
    method: 'get',
    interceptor: {
      response: function(response) {
        console.log('responseInterceptor-1');
        return $timeout(1000).then(function() {
          console.log('responseInterceptor-2');
          return response.resource;
        });
      },
      responseError: function(response) {
        console.log('responseErrorInterceptor-1');
        return $timeout(1000).then(function() {
          console.log('responseErrorInterceptor-2');
          return $q.reject('Ooops!');
        });
      }
    }
  }
});
var onSuccess = function(value) { console.log('successCallback', value); };
var onError = function(error) { console.log('errorCallback', error); };

// Assuming the following call is successful...
User.get({id: 1}, onSuccess, onError);
  // Old behavior:
  //   responseInterceptor-1
  //   successCallback, {/* Promise object */}
  //   responseInterceptor-2
  // New behavior:
  //   responseInterceptor-1
  //   responseInterceptor-2
  //   successCallback, {/* User object */}

// Assuming the following call returns an error...
User.get({id: 2}, onSuccess, onError);
  // Old behavior:
  //   errorCallback, {/* Response object */}
  //   responseErrorInterceptor-1
  //   responseErrorInterceptor-2
  // New behavior:
  //   responseErrorInterceptor-1
  //   responseErrorInterceptor-2
  //   errorCallback, Ooops!
  • 240a3d: add support for request and requestError interceptors (#15674)

Previously, calling a $resource method would synchronously call $http. Now, it will be called asynchronously (regardless if a request/requestError interceptor has been defined.

This is not expected to affect applications at runtime, since the overall operation is asynchronous already, but may affect assertions in tests. For example, if you want to assert that $http has been called with specific arguments as a result of a $resource call, you now need to run a $digest first, to ensure the (possibly empty) request interceptor promise has been resolved.

Before:

it('...', function() {
  $httpBackend.expectGET('/api/things').respond(...);
  var Things = $resource('/api/things');
  Things.query();

  expect($http).toHaveBeenCalledWith(...);
});

After:

it('...', function() {
  $httpBackend.expectGET('/api/things').respond(...);
  var Things = $resource('/api/things');
  Things.query();
  $rootScope.$digest();

  expect($http).toHaveBeenCalledWith(...);
});

$templateRequest:

  • due to c617d6: give tpload error the correct namespace

Previously the tpload error was namespaced to $compile. If you have code that matches errors of the form [$compile:tpload] it will no longer run. You should change the code to match [$templateRequest:tpload].

  • due to (fb0099: always return the template that is stored in the cache

The service now returns the result of $templateCache.put() when making a server request to the template. Previously it would return the content of the response directly. This now means if you are decorating $templateCache.put() to manipulate the template, you will now get this manipulated result also on the first $templateRequest rather than only on subsequent calls (when the template is retrived from the cache). In practice this should not affect any apps, as it is unlikely that they rely on the template being different in the first and subsequent calls.

$animate due to:

  • 16b82c: let cancel() reject the runner promise

$animate.cancel(runner) now rejects the underlying promise and calls the catch() handler on the runner returned by $animate functions (enter, leave, move, addClass, removeClass, setClass, animate). Previously it would resolve the promise as if the animation had ended successfully.

Example:

var runner = $animate.addClass('red');
runner.then(function() { console.log('success')});
runner.catch(function() { console.log('cancelled')});

runner.cancel();

Pre-1.7.0, this logs 'success', 1.7.0 and later it logs 'cancelled'. To migrate, add a catch() handler to your animation runners.

angularcore
published 1.6.10 •

Changelog

Source

1.6.10 crystalline-persuasion (2018-04-17)

Bug Fixes

New Features

  • $http: support sending XSRF token to whitelisted origins (bc7757, #7862)
  • minErr: strip error url from error parameters (980b69)
  • $sanitize: support enhancing elements/attributes white-lists (ee8e05, #5900, #16326)
  • $rootScope: allow suspending and resuming watchers on scope (efb822c58, #16308)

<a name="1.6.9"></a>

angularcore
published 1.6.9 •

Changelog

Source

1.6.9 fiery-basilisk (2018-02-02)

Bug Fixes

New Features

<a name="1.6.8"></a>

angularcore
published 1.6.8 •

Changelog

Source

1.6.8 beneficial-tincture (2017-12-18)

Bug Fixes

  • $location:
    • always decode special chars in $location.url(value) (2bdf71)
    • decode non-component special chars in Hashbang URLS (57b626)
  • ngModelController: allow $overrideModelOptions to set updateOn (55516d, #16351, #16364)

New Features

<a name="1.6.7"></a>

angularcore
published 1.6.7 •

Changelog

Source

1.6.7 imperial-backstroke (2017-11-24)

Bug Fixes

  • $compile: sanitize special chars in directive name (c4003f, #16314, #16278)
  • $location: do not decode forward slashes in the path in HTML5 mode (e06ebf, #16312)
  • sanitizeUri: sanitize URIs that contain IDEOGRAPHIC SPACE chars (ddeb1d, #16288)
  • $rootScope: fix potential memory leak when removing scope listeners (358a69, #16135, #16161)
  • http: do not allow encoded callback params in jsonp requests (569e90)
  • ngMock: pass unexpected request failures in $httpBackend to the error handler (1555a4, #16150, #15855)
  • ngAnimate: don't close transitions when child transitions close (1391e9, #16210)
  • ngMock.browserTrigger: add 'bubbles' to Transition/Animation Event (7a5f06)

New Features

  • $sanitize, $compileProvider, linky: add support for the "sftp" protocol in links (a675ea, #16102)
  • ngModel.NgModelController: expose $processModelValue to run model -> view pipeline (145194, #3407, #10764, #16237)
  • $injector: ability to load new modules after bootstrapping (6e78fe)

Performance Improvements

  • jqLite:
    • avoid setting class attribute when not changed (9c95f6)
    • avoid repeated add/removeAttribute in jqLiteRemoveClass (cab9eb, #16078, #16131)

<a name="1.6.6"></a>

angularcore
published 1.6.6 •

Changelog

Source

1.6.6 interdimensional-cable (2017-08-18)

Bug Fixes

  • $httpParamSerializer: ignore functions (b51ded, #16133)
  • $resource: do not throw when calling old $cancelRequest() (009ebe, #16037)
  • $parse:
    • do not shallow-watch computed property keys (750465)
    • support constants in computed keys (9d6c3f)
  • $http: do not throw error if Content-Type is not application/json but response is JSON-like (2e1163, #16027, #16075)

New Features

  • $compile: add strictComponentBindingsEnabled() method (3ec181, #16129)
  • $resource: add resource to response for error interceptors (9256db, #16109)
  • $http: allow differentiation between XHR completion, error, abort, timeout (5e2bc5, #15924, #15847)

<a name="1.6.5"></a>

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc