Questions tagged [ember-qunit]

Unit test helpers for Ember applications.

Ember-qunit is a tool design to enhance the ability to write unit tests for Ember applications.

Ember QUnit uses your application's resolver to find and automatically create test subjects for you with the moduleFor and test helpers.

See more:

160 questions
3
votes
1 answer

Ember confused on testing route hooks and actions

I am just starting looking at testing with Ember and I am bit confused on how to test the following: 1 - Route hooks Here's an example what I have, I am not sure if should be done through unit testing or user acceptance testing? How do I triggers…
jpoiri
  • 347
  • 1
  • 8
3
votes
1 answer

In Ember js, how to create or mock hasMany relationship in unit test

I'm unit-testing a model which has properties with DS.hasMany() relationships. Whenever I do the following unit-test, I keep getting this error in my test-runner: Error: Assertion Failed: All elements of a hasMany relationship must be instances of…
Shaoz
  • 10,573
  • 26
  • 72
  • 100
3
votes
1 answer

ember acceptance test error 'assertion failed' because of rootElement

does anyone have experience with acceptance test errors? i am getting the error "Error: Assertion Failed: Unable to add 'ember-application' class to rootElement. Make sure you set rootElement to the body or an element in the body." can't find any…
Micki T
  • 71
  • 5
3
votes
1 answer

Testing Ember.Logger.error assertions

I'm using Ember.Logger.error: if (isInvalid) { Ember.Logger.error('this is invalid'); } I want to test it in qunit: assert.throws(() => myFunction(), /this is invalid/, 'error was thrown'); But assert.throws doesn't catch the error. It does if I…
nullnullnull
  • 8,039
  • 12
  • 55
  • 107
3
votes
1 answer

ember event trigger order is different in app and tests

I have written this simple demo component to demonstrate a problem. The component code is below App.FocusOutComponent = Em.Component.extend({ attributeBindings: ['tabindex'], tagName: 'focus-out', setFocus: function() { …
blessanm86
  • 31,439
  • 14
  • 68
  • 79
3
votes
1 answer

Having trouble unit testing a helper from an addon project

https://github.com/stefanpenner/ember-cli/issues/2421 ember-cli: 1.2 I have a boilerplate addon project that has a title-case helper as follows: My Helper app/helpers/title-case.js import Ember from 'ember'; export default…
jax
  • 37,735
  • 57
  • 182
  • 278
3
votes
2 answers

Ember.js testing: follow link

I'm testing an Ember app and I've got a link inside a table. I can get to the link by the selector: $('tr:nth-child(1) td:nth-child(3) a') In my test I have: click($('tr:nth-child(1) td:nth-child(3) a')); But after doing…
James White
  • 535
  • 10
  • 24
3
votes
0 answers

ember-qunit moduleFor needs ember default controller

According to ember guides testing a controller that has needs is like this: moduleFor('controller:comments', 'Comments Controller', { needs: ['controller:post'] }); In my case I have a custom CommentsController but i don't have a custom…
eguneys
  • 6,028
  • 7
  • 31
  • 63
3
votes
1 answer

Unit testing actions in ember controller that return promises

I have a controller that performs an asynchronous operation, which I would like to test: /*globals Ember, momnent*/ import { raw as icAjaxRaw } from 'ic-ajax'; //... actions: { foo: function() { var req = icAjaxRaw({ …
bguiz
  • 27,371
  • 47
  • 154
  • 243
3
votes
1 answer

Ember.js Unit test computed property on a model with a hasMany relationship produces a TypeError

Using this: DEBUG: ------------------------------- DEBUG: Ember : 1.5.1 DEBUG: Ember Data : 1.0.0-beta.7.f87cba88 DEBUG: Handlebars : 1.3.0 DEBUG: jQuery : 1.10.2 DEBUG: ------------------------------- And testing using Ember-qunit. So I'm…
bfcoder
  • 3,042
  • 2
  • 28
  • 35
3
votes
1 answer

How to use qunit-bdd with ember-qunit?

Originally posted on the mailing list by Andreas Haller, reposting here so that the "qunit-bdd" tag will be available for others to use. ember-qunit adds a handy moduleFor helper which one can use as an alternative to QUnit's module function. Now…
Brian Donovan
  • 8,274
  • 1
  • 26
  • 25
2
votes
1 answer

Ember qunit assert.throws does not work

I installed Ember 2.12 and created new project with a component and a test to ensure it throws an error if required attribute is not provided. I can't get this test to pass. dummy-component.hbs {{value}} {{yield}} dummy-component.js import Ember…
SergPro
  • 23
  • 1
  • 4
2
votes
1 answer

Global beforeEach/afterEach for ember qunit tests

My app stores some information about the current session in localStorage. Therefore I need my tests to clear localStorage before or after each single test throughout all test files. Is there a way to define a beforeEach or afterEach callback…
Ernesto
  • 3,837
  • 6
  • 35
  • 56
2
votes
1 answer

How to stub component's action in ember?

I created a component, whose action uses store service. How can I stub this action from integration test? // app/components/invoice-form.js export default Ember.Component.extend({ actions: { loadPartners() { let self = this; …
Molfar
  • 1,411
  • 3
  • 18
  • 49
2
votes
1 answer

Ember 2.8: Test that a ember-bootstrap modal is open on page load

Since I'm not working with pure Bootstrap modals, I've been having trouble figuring out how to unit test for a modal that opens on page load. Here's the modal in question: {{#bs-modal class="startModal" footer=false open=openModal title="Start Game"…
1 2
3
10 11