Can't find anything in documentation that actually works. Annoying!


#1

I am trying to test my component. I am following this article.

http://guides.emberjs.com/v2.0.0/testing/testing-components/

I followed all the steps mentioned, but figured out that the API given is article either doesn’t exists or changed. This is just one example. This is happening for almost any EMber feature(router, controllers, components). Can find documentation that works.

I am using the latest 2.0.2 Ember with Ember CLI. Can anyone recommend me where I can get to see the documentation or article?

I am new to Ember. Is anyone else facing this issue?

Thank You


#2

Where did you get stuck? Can you show your code? The 2.0.0 docs for Components, Routes, etc do reflect Ember 2.0.0 - I’m curious to know what has caused you to think the API has changed.


#3

I am trying to follow this tutorial here:

http://alisdair.mcdiarmid.org/ember-component-integration-tests/

It say, don’t use create , instead use store.createModel()

I paste in my code in some time. I changed it now :smiley:

Thanks


#4

Here is another example: Doc say:

Each test following the moduleForComponent call has access to the subject() function, which lets us create a new instance of the component, as well as provide any initial values we want it to have.

and i get

component integration tests do not support subject()

Any idea?

  • Suraj

#5

There are now two types of component tests: integration and unit

In unit tests you will have access to subject() but in integration tests you don’t. Unfortunately the docs only describe unit tests but the ember-cli default is now to generate integration tests.

To generate a unit test you need to run ember generate component-test {component-name} --test-type=unit

For an article with a good description of integration tests and their usage try http://alisdair.mcdiarmid.org/ember-component-integration-tests/


#6

Thank you soooooo much.


#7

Adding to this, the 2.1.0 docs now detail integration tests for components rather than the older unit tests :smile: http://guides.emberjs.com/v2.1.0/testing/testing-components/