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

Toggle readonly state in tests #291

Open
Turbo87 opened this issue Apr 20, 2017 · 4 comments
Open

Toggle readonly state in tests #291

Turbo87 opened this issue Apr 20, 2017 · 4 comments

Comments

@Turbo87
Copy link
Collaborator

Turbo87 commented Apr 20, 2017

Currently the macros in this addon all produce readonly CPs unless wrapped with writable(). For unit testing certain CPs it can make sense to overwrite the CP inputs/dependent keys with static values, but when using these macros we can't because the CPs are not writeable. It would be awesome to have some sort of toggle mechanism in testing mode that enables us to overwrite the CP with a static value.

@kellyselden
Copy link
Owner

It seems to me that this should be a feature of Ember's read-only computed properties, then we can just piggy-back on them here. I don't think this is a problem unique to this library, and perhaps shouldn't be solved here.

@Turbo87
Copy link
Collaborator Author

Turbo87 commented Apr 21, 2017

@kellyselden seems fine to me, but I guess it would take quite a bit longer 😉

@kellyselden
Copy link
Owner

Just brainstorming, but could you reopen the component class in a test helper, and do this.x = 'static val'; or defineProperty(this, 'x', 'static val');?

@bartocc
Copy link

bartocc commented Sep 18, 2017

faced the same issue today.
Has anyone found a workaround this ?

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

No branches or pull requests

3 participants