Last active
December 17, 2015 11:09
-
-
Save H1D/5600198 to your computer and use it in GitHub Desktop.
Ember.js autoclass for testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#adds class '<fieldname>' or '<relatedmodel__fieldname>' based on valueBinding | |
Em.View.reopen | |
init: -> | |
@_super.apply(@, arguments) | |
if Em.testing | |
testing_class = this.valueBinding?._from?.match(/[\w|\d]+\.[\w|\d]+$/)?[0] | |
if testing_class | |
testing_class = testing_class.replace('context.','').replace('.','__') | |
classes = @get('classNames') || [] | |
classes.push testing_class | |
@set('classNames', classes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment