-
-
Notifications
You must be signed in to change notification settings - Fork 31
How to use this in combination with coffeescript? #17
Comments
Sorry, my Coffeescript skills are very limited so I don't really know if there is a way. I tried using embedded JavaScript functionality but this doesn't work since the backtick is used for escaping ... One possible way I could think of is defining the templates in an ES6 file and import them in your Coffeescript, but the advantage of seeing the template in the test is lost. Something like the following (untested): // tests/templates.js
import hbs from 'htmlbars-inline-precompile';
export var testTemplate = hbs`
{{#my-component}}
hello
{{/my-component}}
`; // tests/unit/component/my-component.coffee
import { testTemplate } from '../../../templates';
test "it works", (assert) ->
@render testTemplate
assert.equals @$().html().text().trim(), "hello" |
I think your idea should work but as you stated it makes the tests considerably less readable. It's too bad there isn't a way to escape backticks so I could do something like |
I have another idea: `import hbs from 'ember-cli-htmlbars-inline-precompile';`
test "it works", (assert) ->
@render '
{{#my-component}}
hello
{{/my-component}}
'
assert.equals @$().html().text().trim(), "hello" |
I released Thanks for opening the issue and giving me the idea to enhance this addon! 🍻 I am going to close this issue. Feel free to comment if you have any issues. Cheers! |
Works a charm, if you're ever in NY I owe you a beer! |
Great, glad it works. Happy testing! |
Back ticks escaping to pure js in ember-cli-coffeescript. Any suggestions on how to get past this.
The text was updated successfully, but these errors were encountered: