Comparing version 1.4.2 to 1.4.3
{ | ||
"name": "can-diff", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"description": "Diffing helpers for can-reflect", | ||
@@ -5,0 +5,0 @@ "homepage": "http://canjs.com", |
@@ -6,2 +6,3 @@ var DefineList = require("can-define/list/list"); | ||
var SimpleObservable = require("can-simple-observable"); | ||
var canReflect = require("can-reflect"); | ||
@@ -40,1 +41,28 @@ QUnit.module("can-diff/patcher",{ | ||
}); | ||
QUnit.test("unbinding unbinds from the list (#13)", function(){ | ||
// first with a list | ||
var ListType = DefineList.extend("ListType",{}); | ||
var list = new ListType(["a","b"]); | ||
var p1 = new Patcher(list); | ||
var calls = []; | ||
canReflect.onInstanceBoundChange(ListType, function(instance, isBound){ | ||
calls.push([instance, isBound]); | ||
}); | ||
function handler(){} | ||
p1[canSymbol.for("can.onPatches")](handler); | ||
p1[canSymbol.for("can.offPatches")](handler); | ||
QUnit.deepEqual(calls, [[list, true], [list, false]], "bound and unbound"); | ||
calls = []; | ||
var observable = new SimpleObservable(list); | ||
var p2 = new Patcher(observable); | ||
p2[canSymbol.for("can.onPatches")](handler); | ||
p2[canSymbol.for("can.offPatches")](handler); | ||
QUnit.deepEqual(calls, [[list, true], [list, false]], "bound and unbound within observable"); | ||
}); |
@@ -98,2 +98,5 @@ | ||
} | ||
if (this.currentList && this.currentList[offPatchesSymbol]) { | ||
this.currentList[offPatchesSymbol](this.onPatchesNotify, "notify"); | ||
} | ||
}, | ||
@@ -100,0 +103,0 @@ // listen to the list for patches |
65561
1582