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

Failing test for 12475 #12832

Closed
wants to merge 10 commits into from
Closed

Failing test for 12475 #12832

wants to merge 10 commits into from

Conversation

ef4
Copy link
Contributor

@ef4 ef4 commented Jan 18, 2016

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.

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.
@ef4 ef4 force-pushed the failing-test-12475 branch from adad436 to ba3d5ff Compare January 18, 2016 22:25
* reduces EF4’s case further
* move related tests to runtime/computed/chains
* adds more thorough tests revealing more related issues
@stefanpenner
Copy link
Member

I have reduced the test cases further, and also identified some related pre-existing issues.
About to jump on a plane, plan to bisect more at another time. (Unless someone is helpful and beats me to it)

@stefanpenner
Copy link
Member

some more research, will do more (later):

  • test individual 1.13.x
  • also test other the high level assertion across versions, as we may actually have more issues.
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]);
Copy link
Member

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.

@stefanpenner
Copy link
Member

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.

@rwjblue
Copy link
Member

rwjblue commented Apr 11, 2016

#12475 was fixed by #12908.

Closing this PR...

@rwjblue rwjblue closed this Apr 11, 2016
@rwjblue rwjblue deleted the failing-test-12475 branch April 11, 2016 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants