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

[BUGFIX beta] Mention "computed properties" in the assertion message #16199

Merged
merged 3 commits into from
Feb 2, 2018
Merged
Show file tree
Hide file tree
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
30 changes: 15 additions & 15 deletions packages/ember-metal/lib/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,22 @@ if (EMBER_METAL_ES5_GETTERS) {
// development to aid in development asertions. Production builds of
// ember strip this entire branch out.
let messageFor = function(obj, keyName, property, value) {
return `You attempted to access the \`${keyName}.${String(property)}\` property ` +
`(of ${obj}). Due to certain internal implementation details of Ember, ` +
`the \`${keyName}\` property previously contained an internal "descriptor" ` +
`object (a private API), therefore \`${keyName}.${String(property)}\` would have ` +
`been \`${String(value).replace(/\n/g, ' ')}\`. This internal implementation ` +
`detail was never intended to be a public (or even intimate) API.\n\n` +
`This internal implementation detail has now changed and the (still private) ` +
`"descriptor" object has been relocated to the object's "meta" (also a ` +
`private API). Soon, accessing \`${keyName}\` on this object will ` +
`return the computed value (see RFC #281 for more details).\n\n` +
return `You attempted to access \`${keyName}.${String(property)}\` ` +
`(on \`${obj}\`), but \`${keyName}\` is a computed property.\n\n` +
`Due to certain internal implementation details of Ember, the ` +
`\`${keyName}\` property previously contained a private "descriptor" ` +
`object, therefore \`${keyName}.${String(property)}\` would have been ` +
`\`${String(value).replace(/\n/g, ' ')}\`.\n\n` +
`This implementation detail has now changed and the "descriptor" ` +
`object is no longer present at this location. Soon, accessing ` +
`\`${keyName}\` on this object will return the computed property's ` +
`current value (see RFC #281 for more details).\n\n` +
`If you are seeing this error, you are likely using an addon that ` +
`relies on this now-defunct private implementation detail. If you can, ` +
`find out which addon is doing this from the stack trace below and ` +
`report this bug to the addon authors. If you feel stuck, the Ember ` +
`Community Slack (https://ember-community-slackin.herokuapp.com/) ` +
`may be able to offer some help.\n\n` +
`relies on this now-defunct private implementation detail. If you ` +
`can, identify the addon from the stack trace below and report this ` +
`bug to the addon authors. If you feel stuck, the Ember Community ` +
`Slack (https://ember-community-slackin.herokuapp.com/) may be able ` +
`to offer some help.\n\n` +
`If you are an addon author and need help transitioning your code, ` +
`please get in touch in the #dev-ember channel in the Ember Community ` +
`Slack.`;
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-metal/tests/computed_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ if (EMBER_METAL_ES5_GETTERS) {
return 'computed ' + key;
}));

expectAssertion(() => obj.foo.isDescriptor, /You attempted to access the `foo\.isDescriptor` property \(of obj\)\./);
expectAssertion(() => obj.foo.get(), /You attempted to access the `foo\.get` property \(of obj\)\./);
expectAssertion(() => obj.foo.isDescriptor, /You attempted to access `foo\.isDescriptor` \(on `obj`\)/);
expectAssertion(() => obj.foo.get(), /You attempted to access `foo\.get` \(on `obj`\)/);
assert.strictEqual(count, 0, 'should not have invoked computed property');
});
}
Expand Down