Skip to content

Commit

Permalink
Add unlinkPath tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Sep 5, 2015
1 parent ab85884 commit bee110b
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions test/unit/notify-path.html
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,10 @@
el.set('a.foo', 1);
assert.equal(aChanged, 1);
assert.equal(bChanged, 1);
el.unlinkPaths('b');
el.set('a.foo', 2);
assert.equal(aChanged, 2);
assert.equal(bChanged, 1);
});

test('link three objects', function() {
Expand All @@ -1179,6 +1183,11 @@
assert.equal(aChanged, 1);
assert.equal(bChanged, 1);
assert.equal(cChanged, 1);
el.unlinkPaths('b');
el.set('a.foo', 2);
assert.equal(aChanged, 2);
assert.equal(bChanged, 1);
assert.equal(cChanged, 2);
});

test('link two arrays', function() {
Expand All @@ -1188,9 +1197,14 @@
el.linkPaths('b', 'a');
el.aChanged = function() { aChanged++; };
el.bChanged = function() { bChanged++; };
el.set('a.foo', 1);
assert.equal(aChanged, 1);
assert.equal(bChanged, 1);
el.push('a', {});
// 2 changes for arrays (splices & length)
assert.equal(aChanged, 2);
assert.equal(bChanged, 2);
el.unlinkPaths('b');
el.push('a', {});
assert.equal(aChanged, 4);
assert.equal(bChanged, 2);
});

test('link three arrays', function() {
Expand All @@ -1208,6 +1222,11 @@
assert.equal(aChanged, 2);
assert.equal(bChanged, 2);
assert.equal(cChanged, 2);
el.unlinkPaths('b');
el.push('a', {});
assert.equal(aChanged, 4);
assert.equal(bChanged, 2);
assert.equal(cChanged, 4);
});

});
Expand Down

0 comments on commit bee110b

Please sign in to comment.