-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
extend models in acceptance tests #5451
Comments
@Leooo To explain the underlying issue, we add |
Thanks for giving some background it may help
…On Tue, 21 Aug 2018, 7:34 pm Chris Thoburn, ***@***.***> wrote:
@Leooo <https://github.com/Leooo> To explain the underlying issue, we add
modelName as a static property of the underlying class. What you've
observed here is #5406 <#5406>
wherein recent versions of Ember which have true inheritance cause the
modelName to be inherited. When we see a modelName is already present, we
don't overwrite it (part of our support for polymorphism); however, we
needed to upgrade our check to use hasOwnProperty due to the change in
inheritance, which we will backport (tracking in #5577
<#5577>).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5451 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACT4mO0LdZsb2AIYZ0Qj3ouZKKG3hBVyks5uTFKogaJpZM4TjHR3>
.
|
Our apps use a common repo, where models are defined together with model mixins that can be plugged in inside each app as suited. For example we would have inside the commons repo:
premise.js
modelpremise-services-mixin.js
mixin, to be optionally added topremise.js
in an app if neededpremise-energy-mixin.js
mixin, to be optionally added topremise.js
in an app if neededin the commons repo, we want to run an acceptance test for
premise.js
model extended withpremiseEnergyMixin
current code below breaks (sorry old test API) when we don't add the
delete premiseModel.superclass.modelName;
line, when run after any previous acceptance test module wherepremise
model is used:This breaks because of this line:
data/addon/-private/system/model/model.js
Line 49 in 87be9b7
I understand, as per #5000 (comment), that we should normally try to "ensure that classes are correct prior to application instantiation".
But how can we do that for acceptance tests? I wouldn't know how to extend the model above without access to
application.__container__
, that comes fromstartApp
?This doesn't seem to be an easy problem to solve (though correspond to real world cases for modularized Ember applications).
Would this be an accepted fix to add a PR to ensure that in
data/addon/-private/system/model/model.js
Line 49 in 87be9b7
Thanks
@runspired @rwjblue
The text was updated successfully, but these errors were encountered: