Skip to content

Commit

Permalink
Add support for Ember < 2.8 WRT Ember.Test.registerWaiter.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Oct 7, 2017
1 parent 519fdf5 commit 296953e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/unit/wait-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { registerWaiter, unregisterWaiter } from '@ember/test';
import Ember from 'ember';
import { later, run } from '@ember/runloop';
import Component from '@ember/component';
import $ from 'jquery';
Expand Down Expand Up @@ -123,7 +123,14 @@ module('wait helper tests', function(hooks) {

init() {
this._super.apply(this, arguments);
registerWaiter(this, this.isReady);
// In Ember < 2.8 `registerWaiter` expected to be bound to
// `Ember.Test` 😭
//
// Once we have dropped support for < 2.8 we should swap this to
// use:
//
// import { registerWaiter } from '@ember/test';
Ember.Test.registerWaiter(this, this.isReady);
later(() => {
this.setProperties({
internalValue: 'async value',
Expand All @@ -134,7 +141,8 @@ module('wait helper tests', function(hooks) {

willDestroy() {
this._super.apply(this, arguments);
unregisterWaiter(this, this.isReady);
// must be called with `Ember.Test` as context for Ember < 2.8
Ember.Test.unregisterWaiter(this, this.isReady);
},
})
);
Expand Down

0 comments on commit 296953e

Please sign in to comment.