ember.js,ember-cli,ember-qunit
You'll need to the latest version of ember-qunit, v.0.4.4 as of today, as ember-2.0.0-beta.3 compatibility was added in this commit. The version of ember-cli you are using does not come with this version of ember-qunit.
javascript,ember.js,qunit,ember-qunit
Initializers are not run in unit tests componentForModel, therefore this.convertPercentage is undefined (as the error suggests). So my suggestion is to import the function from your model and just attach it: import convertPercentage from "../utils/convert-percentage"; export default DS.Model.extend({ salesTaxPercent: function(key, value, previousValue) { return this.convertPercentage.apply(this, arguments); }.property('salesTax') }); https://github.com/rwjblue/ember-qunit/issues/149#event-261578363...
ember.js,ember-cli,ember-qunit
Your setup and teardown looks fine. They are commonly used and are properly defined. However, there is (still) open issue on ember-qunit about not tearing down the app properly - take a look here to see the progress. As you said, it does not happen in Ember 1.13....
javascript,unit-testing,ember.js,ember-cli,ember-qunit
You need to inform the test of the controller dependencies. In order to do this, change your moduleFor method to the following: moduleFor('controller:order', { needs: ['controller:orders']}); ...
authentication,ember.js,ember-app-kit,ember-qunit,ember-simple-auth
With the help of @marcoow and a few other SO questions and GitHub issues I've been able to resolve all my problems: 1. Devise Authenticator & Ephemeral Storage I was using an outdated API option in my code. Updating to use the newer API's storeFactory option resolved my session localStorage...
javascript,ember.js,ember-cli,qunit,ember-qunit
The assert object is a singleton instance which you can gain access with QUnit.assert. So the following should work import QUnit from 'qunit'; QUnit.assert.controlDisabled = function(selector, message) { return this.ok(findWithAssert(selector).attr('disabled'), message); }; ...
ember.js,ember-cli,source-maps,ember-qunit,testem
I'm on ember-cli 0.2.2. I ran across this problem as well and found this Chrome issue with processing sourcemaps. People commenting on the issue suggest using the Chrome Canary build for now: I'm currently using the Canary build to put breakpoints in and debug my ember code. Get it here:...
javascript,ember.js,ember-cli,ember-qunit
You can access class methods for testing like this: var location = this.subject.constructor.findByPlaceId('whatever'); Why class methods, though? Shouldn’t the service be instantiated?...
twitter-bootstrap,unit-testing,ember.js,ember-cli,ember-qunit
I had the same problem. I’m not sure this is the best solution, but I solved it by registering an async test helper before calling App.injectTestHelpers(): Ember.Test.registerAsyncHelper 'waitForModalOpen', (app, modal) -> # If using QUnit < 1.16, you need to add stop(). #stop() Ember.Test.promise (resolve, reject) -> modal.on 'shown.bs.modal', ->...
ember.js,qunit,ember-qunit,ember-testing
the click event doesn't set focus (being a back door route). You'll need to manually set focus then click if you want the same results. Ember's Click Helper (sends mousedown/mouseup, then click) function click(app, selector, context) { var $el = app.testHelpers.findWithAssert(selector, context); run($el, 'mousedown'); if ($el.is(':input')) { var type =...
javascript,ember.js,coffeescript,ember-qunit
Your problem could be that your test model has not been registered in the container, so it cannot be resolved. You could register manually during your test module callbacks: container.register('model:test', TestModel) Or use the needs property of the moduleFor impl: moduleForComponent('controller:test', 'My Controller', { // specify the other units that...
ember.js,ember-cli,ember-qunit
I updated our app from ember-cli 0.1.12 and ember 1.8.1 to ember-cli 0.2.0 and ember 1.10.0. I also updated Pretender to 0.6.0 (the ember-cli-pretender package installed 0.1.0). This didn't solve anything by itself, but it did lead to a telling change in how the integration test failed. Now, Pretender was...
I got this working by starting a new branch off development (our default branch) and re-running the update. Here are the differences between my original pass and what worked: More component updates, I think just because some time has passed since my first attempt. ember-resolver, loader.js, ember-cli-app-version and ember-cli-dependency-checker had...
unit-testing,ember.js,ember-cli,qunit,ember-qunit
Something along these lines maybe? import { moduleFor, test } from 'ember-qunit'; import Ember from 'ember'; var products = [ Ember.Object.create({ name: 'shoe', subTotal: 10 }), Ember.Object.create({ name: 'shirt', subTotal: 20 })]; var model = Ember.ArrayProxy.create({ content: Ember.A(products) }); moduleFor('controller:cart', { beforeEach() { this.controller = this.subject(); } }); test('cartTotal', function(assert)...
unit-testing,ember.js,ecmascript-6,ember-qunit
I'm not really sure where your problem is, but I can paste you relevant parts of my index.html (I'm using Ember App Kit here): <!-- @if tests=true --> <script src="/vendor/ember-shim.js"></script> <link rel="stylesheet" href="/vendor/qunit/qunit/qunit.css"> <script src="/vendor/qunit/qunit/qunit.js"></script> <script src="/vendor/qunit-shim.js"></script> <script src="/vendor/ember-qunit/dist/named-amd/main.js"></script> <div id="qunit"></div> <!-- @endif --> and...