Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
Notify on replicate uptodate events
Browse files Browse the repository at this point in the history
  • Loading branch information
tlvince committed Jan 11, 2015
1 parent eed54ed commit 4d0a2e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions angular-pouchdb.js
Expand Up @@ -37,6 +37,9 @@ angular.module('pouchdb', [])
.on('change', function(change) {
return deferred.notify(change);
})
.on('uptodate', function(uptodate) {
return deferred.notify(uptodate);
})
.on('complete', function(response) {
return deferred.resolve(response);
})
Expand Down
15 changes: 15 additions & 0 deletions test/event-emitters.js
Expand Up @@ -70,6 +70,21 @@ describe('Angular-wrapped PouchDB event emitters', function() {
.catch(error)
.finally(done);
});

it('should notify on uptodate events', function(done) {
var opts = {
live: true
};

function notify(notification) {
expect(notification.ok).toBe(true);
done();
}

db.replicate.to('test2', opts).$promise
.then(null, null, notify)
.catch(shouldNotBeCalled);
});
});

afterEach(function(done) {
Expand Down

0 comments on commit 4d0a2e1

Please sign in to comment.