Skip to content

Commit 201c0c7

Browse files
committed
Updated CHANGELOG.md.
1 parent 5f4b501 commit 201c0c7

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- #167 - Default params argument of bindAll to empty object
1010
- #170 - Global callbacks
1111
- #171 - "not in" query
12+
- #177 - Allow promises to be returned in lifecycle hooks
1213

1314
###### Backwards compatible bug fixes
1415
- #156 - cached findAll pending query doesn't get removed sometimes

dist/angular-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7102,7 +7102,7 @@ module.exports = [function () {
71027102

71037103
try {
71047104
var promise = fn.apply(target || this, args);
7105-
if(promise && promise.then){
7105+
if (promise && promise.then) {
71067106
promise.then(deferred.resolve, deferred.reject);
71077107
}
71087108
} catch (err) {

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272

7373
try {
7474
var promise = fn.apply(target || this, args);
75-
if(promise && promise.then){
75+
if (promise && promise.then) {
7676
promise.then(deferred.resolve, deferred.reject);
7777
}
7878
} catch (err) {

test/integration/index.js renamed to test/integration/index.test.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
describe('$q decorator', function(){
1+
describe('$q decorator', function () {
22
beforeEach(module('angular-data.DS'));
33

4-
it('should decorate $q', inject(function($q){
4+
it('should decorate $q', inject(function ($q) {
55
assert.isFunction($q.promisify);
66
}));
77

8-
it('should resolve with a cb', inject(function($q, $rootScope){
8+
it('should resolve with a cb', inject(function ($q, $rootScope) {
99
var resolveValue = {};
10-
var resolveCb = function(cb){
10+
var resolveCb = function (cb) {
1111
cb(null, resolveValue);
1212
};
1313
var resolveSpy = sinon.spy();
@@ -18,9 +18,9 @@ describe('$q decorator', function(){
1818
assert(resolveSpy.calledWith(resolveValue));
1919
}));
2020

21-
it('should reject with a cb', inject(function($q, $rootScope){
21+
it('should reject with a cb', inject(function ($q, $rootScope) {
2222
var rejectValue = {};
23-
var rejectCb = function(cb){
23+
var rejectCb = function (cb) {
2424
cb(rejectValue);
2525
};
2626
var rejectSpy = sinon.spy();
@@ -31,9 +31,9 @@ describe('$q decorator', function(){
3131
assert(rejectSpy.calledWith(rejectValue));
3232
}));
3333

34-
it('should resolve with a promise', inject(function($q, $rootScope){
34+
it('should resolve with a promise', inject(function ($q, $rootScope) {
3535
var resolveValue = {};
36-
var resolveCb = function(cb){
36+
var resolveCb = function () {
3737
return $q.when(resolveValue);
3838
};
3939
var resolveSpy = sinon.spy();
@@ -44,9 +44,9 @@ describe('$q decorator', function(){
4444
assert(resolveSpy.calledWith(resolveValue));
4545
}));
4646

47-
it('should reject with a promise', inject(function($q, $rootScope){
47+
it('should reject with a promise', inject(function ($q, $rootScope) {
4848
var rejectValue = {};
49-
var rejectCb = function(cb){
49+
var rejectCb = function () {
5050
return $q.reject(rejectValue);
5151
};
5252
var rejectSpy = sinon.spy();
@@ -60,12 +60,12 @@ describe('$q decorator', function(){
6060
//Typically, functions that return a promise will be wrapped with a $q.when, meaning if you were to return nothing, it would execute straight away
6161
//This would mean the cb style would not work at all, as any developer that uses cb would have the function immediately resolve
6262
//This just ensures that doesn't ever happen
63-
it('should not resolve or reject if return value is not a promise', inject(function($q, $rootScope){
63+
it('should not resolve or reject if return value is not a promise', inject(function ($q, $rootScope) {
6464
var resolve;
65-
var cb = function(next){
65+
var cb = function (next) {
6666
resolve = next;
6767
return true;
68-
}
68+
};
6969
var spy = sinon.spy();
7070

7171
$q.promisify(cb)().finally(spy);
@@ -78,4 +78,4 @@ describe('$q decorator', function(){
7878

7979
assert(spy.called);
8080
}));
81-
})
81+
});

0 commit comments

Comments
 (0)