-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Failing test for 12475 #12832
Failing test for 12475 #12832
Conversation
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.
adad436
to
ba3d5ff
Compare
* reduces EF4’s case further * move related tests to runtime/computed/chains * adds more thorough tests revealing more related issues
50d7597
to
bef7236
Compare
I have reduced the test cases further, and also identified some related pre-existing issues. |
some more research, will do more (later):
function ok(assertion, message) {
if (assertion) { return; }
console.error(message);
}
var isWatching = Ember.isWatching;
var get = Ember.get;
var set = Ember.set;
var a1 = { foo: true, id: 1 };
var a2 = { foo: true, id: 2 };
var a3 = { foo: false, id: 3 };
var a4 = { foo: false, id: 4 };
var obj = { };
Ember.defineProperty(obj, 'a', Ember.computed('array.@each.foo', function() {}));
set(obj, 'array', Ember.A([a1, a2]));
get(obj, 'a'); // kick CP;
ok( isWatching(a1, 'foo'), 'BEFORE: expected a1.foo to watched');
ok( isWatching(a2, 'foo'), 'BEFORE: expected a2.foo to watched');
ok(!isWatching(a3, 'foo'), 'BEFORE: expected a3.foo to NOT watched');
ok(!isWatching(a4, 'foo'), 'BEFORE: expected a4.foo to NOT watched');
set(obj, 'array', [a3, a4]);
ok(!isWatching(a1, 'foo'), 'AFTER: expected a1.foo to NOT watched');
ok(!isWatching(a2, 'foo'), 'AFTER: expected a2.foo to NOT watched');
ok( isWatching(a3, 'foo'), 'AFTER: expected a3.foo to watched');
ok( isWatching(a4, 'foo'), 'AFTER: expected a4.foo to watched');
/* Failing tests
*
* v1.0.0: http://emberjs.jsbin.com/juluje/edit?html,output
* v1.1.0: http://emberjs.jsbin.com/cofufo/edit?html,output
* v1.2.0: http://jsbin.com/nixiqa/edit?html,output
* v1.3.0: http://jsbin.com/doragu/edit?html,output
* v1.4.0: http://jsbin.com/sevevi/edit?html,output
* v1.5.0: http://jsbin.com/yaduvu/edit?html,output
* v1.6.0: http://jsbin.com/dezacel/edit?html,output
* v1.7.0: http://jsbin.com/jehohov/edit?html,output
* v1.8.0: http://rwjblue.jsbin.com/fovoje/edit?html,output
* v1.9.0: http://rwjblue.jsbin.com/leroku/edit?html,output
* v1.10.0: http://emberjs.jsbin.com/rwjblue/309/edit
* v1.11.0: http://emberjs.jsbin.com/rwjblue/373/edit?html,output
* v1.12.0: http://jsbin.com/nidipe/edit?html,output
* v1.13.0: http://jsbin.com/xovivo/edit?html,output
* v1.13.1 -> 1.13.13 tested in ember-cli
* v1.0.0 -> 2.0.0-beta.4 all share:
* - ok(!isWatching(a1, 'foo'), 'AFTER: expected a1.foo to NOT watched');
* - ok(!isWatching(a2, 'foo'), 'AFTER: expected a2.foo to NOT watched');
*
* 225f24e... fails the first 2
* - ok(!isWatching(a1, 'foo'), 'AFTER: expected a1.foo to NOT watched');
* - ok(!isWatching(a2, 'foo'), 'AFTER: expected a2.foo to NOT watched');
* 03b771... fails the last 2
* ok( isWatching(a3, 'foo'), 'AFTER: expected a3.foo to watched');
* ok( isWatching(a4, 'foo'), 'AFTER: expected a4.foo to watched');
*
* v2.0.0-beta.5
* v2.0.0: http://rwjblue.jsbin.com/zesoni/edit?html,output
* v2.1.0: http://jsbin.com/hiqago/edit?html,output
* v2.2.0: http://jsbin.com/hiqago/edit?html,output
* v2.3.0: http://jsbin.com/zulacu/edit?html,js,output
* v2.0.0 -> 2.3.0 all share:
* ok( isWatching(a3, 'foo'), 'AFTER: expected a3.foo to watched');
* ok( isWatching(a4, 'foo'), 'AFTER: expected a4.foo to watched');
*/ |
deepEqual(get(obj, 'a'), 3, 'value is correct initially'); | ||
set(a1, 'foo', false); | ||
deepEqual(get(obj, 'a'), 2, 'responds to change of property on element'); | ||
set(obj, 'array', [a1, a2, a3]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ef4 when EXTENDS_PROTOTYPE
is off, this must be an Ember.A(
Yes it is very bad that this fails silently, but it indicates this isn't the test failure we are looking for.
…l scenarios were the array is potentially observable.
scenarios with: * object proxy * array proxy
Although this does demonstrate some issues, I don't believe it demonstrates the primary issue outline din #12475. It is clear their are several compounding issues at play, I will (as time permits) continue to expand these tests, narrowing in on a reproduction of #12475. My time has been pretty split lately, so I haven't been able to dedicate long stretches of time which is slowing down my research. But incrementally building a test suite of assumption is allowing me to pause/resume my efforts. I hope to pin down the various issues, from their we can work on fixing them. I hope the increased test coverage will help keep this code in-check in the future. As I have been working through this code, I have been noticing many places were we could improve performance. So that is a positive of this whole exercise. |
aa11ed7
to
64a970c
Compare
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 tofoo
are ignored.