< mockra >

EmberJS Component Testing - 27 Aug 2014


Testing components in EmberJS is much more straight forward than you might expect. Here’s an example test for the Gravtar component I wrote a post about.

In this test, we’re setting up our component inside an Ember.run block, so that the setup happens before we run our tests. After the setup, we’re appending our rendered component to the DOM by calling this.append();.

Once the component is added to the DOM, we can use our selector methods to ensure that the image source has been correctly set by our component.