emberjs / ember-qunit

QUnit test helpers for Ember
Other
259 stars 154 forks source link

No moduleForHelper #76

Closed tomdale closed 8 years ago

tomdale commented 10 years ago

We should add helpers for testing bound Handlebars helpers.

rwjblue commented 10 years ago

Not to future self, we need to add a moduleForHelper that allows specifying a template (or template name).

Still need to flesh out what that API should look like (do we pass the template to this.subject() or what?)...

ryanflorence commented 10 years ago

my plan was to just be able to provide a snippet of handlebars as the "unit under test" that created a container view and rendered it, this way, you write your tests the same way you write your code. You don't typically call a handlebars helper imperatively, but rather in your templates.

I was going to refactor moduleForComponent, moduleForView, and moduleForSnippet??? to all use the same code to set up and tear down the container. I had this in my original stuff before the deep qunit integration was proposed and implemented (it was lovely).

On Tue, Jul 15, 2014 at 1:51 PM, Robert Jackson notifications@github.com wrote:

Not to future self, we need to add a moduleForHelper that allows specifying a template (or template name).

Still need to flesh out what that API should look like (do we pass the template to this.subject() or what?)...

— Reply to this email directly or view it on GitHub https://github.com/rjackson/ember-qunit/issues/76#issuecomment-49083355.

rwjblue commented 10 years ago

I wrote this demo of how to test the output of a provided template a while back (for plain QUnit):

http://jsbin.com/ECoTIP/1/edit

manuelmitasch commented 10 years ago

Related #5

jasonmit commented 8 years ago

Currently I use ember-legacy-views for testing the helpers in ember-intl, but that's no longer possible as of ember-beta/ember-canary for 2.6.x.

Is there a recommended path forward?

/cc @rwjblue

rwjblue commented 8 years ago

@jasonmit - Support for the legacy addons is no longer present in 2.6.0-beta.1 or above. If someone still needs those addons, they will need to continue using 2.4 LTS (which is supported until 2.8 turns into the next LTS). tldr; no, there is nothing you can do but drop support. Also, I am confused why that question is related to this request for a moduleForHelper...

rwjblue commented 8 years ago

This issue is being addressed by https://github.com/emberjs/rfcs/pull/119.

jasonmit commented 8 years ago

Also, I am confused why that question is related to this request for a moduleForHelper...

I took a similar approach that you mention https://github.com/rwjblue/ember-qunit/issues/76#issuecomment-49085412 here to test the output of my helpers.

rwjblue commented 8 years ago

@jasonmit - With the current tooling, using moduleForComponent is massively simpler. See https://github.com/aptible/dashboard.aptible.com/blob/master/tests/integration/helpers/eq-test.js for an example.

jasonmit commented 8 years ago

Ah, it worked perfectly - thanks!