Skip to content

Commit

Permalink
adds a failing test for 12475
Browse files Browse the repository at this point in the history
This adds a failing test for #12475. It appears that `obj.set('array', [a1, a2, a3])` fails to install contentKey observers on the new array value so that the subsequent changes to `foo` are ignored.
  • Loading branch information
ef4 committed Jan 18, 2016
1 parent 4ce4cb6 commit adad436
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,26 @@ QUnit.test('properties values can be replaced', function() {
deepEqual(obj.get('a1bs').mapBy('name'), ['item1'], 'properties can be filtered by matching value');
});

QUnit.test('responds to change of property value on element after replacing array', function() {
let a1 = { foo: true };
let a2 = { foo: true };
let a3 = { foo: true };

obj = EmberObject.extend({
a: filterBy('array', 'foo')
}).create({
array: emberA([a1, a2])
});

deepEqual(obj.get('a'), [a1, a2], 'value is correct initially');
set(a1, 'foo', false);
deepEqual(obj.get('a'), [a2], 'responds to change of property on element');
obj.set('array', [a1, a2, a3]);
deepEqual(obj.get('a'), [a2, a3], 'responds to content array change');
set(a1, 'foo', true);
deepEqual(obj.get('a'), [a1, a2, a3], 'still responds to change of property on element');
});

[
['uniq', uniq],
['union', union]
Expand Down

0 comments on commit adad436

Please sign in to comment.