mainmatter/ember-test-selectors

Incoming private API breakage

ef4 opened this issue · 7 comments

ef4 commented

Accessing anything on a ComputedProperty instance is private API and is likely to break in the future (possibly the very soon future). This addon is accessing isDescriptor:

https://github.com/simplabs/ember-test-selectors/blob/master/addon/utils/bind-data-test-attributes.js#L30

The tl;dr is that everybody wants to make Ember.get optional and just use real ES5 getters for computed properties. As soon as we do that, component.attributeBindings will stop giving you a ComputedProperty instance with an isDescriptor, and would always return the value directly, even when it is implemented as computed property.

@ef4 any idea how we can figure out if attributeBindings is writable within that code?

ef4 commented

It seems that this code just warns and gives up when it can't write to attrributeBindings, so perhaps you can just try to set and catch the error if it's a computed property without a setter, so as to convert the error into a pleasant warning.

guess I'll wait until this code actually breaks in canary and then we'll see how to fix/work around it

ef4 commented

Yeah, that's reasonable. The relevant RFC is emberjs/rfcs#281

This issue is causing a test to fail in #172

indeed, I'm just surprised that it works without issues in one of our apps that is running 3.0 🤔

ef4 commented

It will only break if you happen to have attributesBindings as a computed property. It's not a common thing to do.