Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Unobserved->closed
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelw committed Aug 24, 2013
1 parent d2b20c2 commit 058d172
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/observe.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@
close: function() {
if (this.closed)
return;
if (this.object && typeof this.object.unobserved === 'function')
this.object.unobserved();
if (this.object && typeof this.object.close === 'function')
this.object.close();

this.disconnect();
this.object = undefined;
Expand Down
12 changes: 6 additions & 6 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ suite('PathObserver Tests', function() {
callbackInvoked = false;
}

test('Close Invokes Unobserved', function() {
test('Close Invokes Close', function() {
var called = false;
var obj = { foo: 1, unobserved: function() { called = true }};
var obj = { foo: 1, close: function() { called = true }};
var observer = new PathObserver(obj, 'foo', function() {});
observer.close();
assert.isTrue(called);
Expand Down Expand Up @@ -775,10 +775,10 @@ suite('ArrayObserver Tests', function() {
observer.close();
}

test('Close Invokes Unobserved', function() {
test('Close Invokes Close', function() {
var called = false;
var obj = [];
obj.unobserved = function() { called = true };
obj.close = function() { called = true };
var observer = new ArrayObserver(obj, function() {});
observer.close();
assert.isTrue(called);
Expand Down Expand Up @@ -1354,10 +1354,10 @@ suite('ObjectObserver Tests', function() {
callbackInvoked = false;
}

test('Close Invokes Unobserved', function() {
test('Close Invokes Close', function() {
var called = false;
var obj = {};
obj.unobserved = function() { called = true };
obj.close = function() { called = true };
var observer = new ObjectObserver(obj, function() {});
observer.close();
assert.isTrue(called);
Expand Down

0 comments on commit 058d172

Please sign in to comment.