Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add failing test for filterBy #12622

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,23 @@ 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', function() {
let a1 = { foo: true };
let a2 = { foo: true };

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test fails because we do not use prototype extensions by default in the test suite, so this use of a plain array is not supported. If you switch it to Ember.A([a1, a2]), the test passes.

});

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');
});

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