MAINT: Upgrade to ember 2.16 LTS (#66)
This commit is contained in:
parent
39f4789a61
commit
eb4537afb1
45 changed files with 129 additions and 151 deletions
|
@ -1,5 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
import { run } from '@ember/runloop';
|
||||
|
||||
export default function destroyApp(application) {
|
||||
Ember.run(application, 'destroy');
|
||||
run(application, 'destroy');
|
||||
}
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import Ember from 'ember';
|
||||
import FlashObject from 'ember-cli-flash/flash/object';
|
||||
|
||||
const { K } = Ember;
|
||||
|
||||
FlashObject.reopen({ init: K });
|
||||
FlashObject.reopen({ init() {} });
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import { module } from 'qunit';
|
||||
import Ember from 'ember';
|
||||
import { resolve } from 'rsvp';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
|
||||
const { RSVP: { resolve } } = Ember;
|
||||
|
||||
export default function(name, options = {}) {
|
||||
module(name, {
|
||||
beforeEach() {
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
import Ember from 'ember';
|
||||
import { registerAsyncHelper } from '@ember/test';
|
||||
import { A } from '@ember/array';
|
||||
import { computed } from '@ember/object';
|
||||
import { classify } from '@ember/string';
|
||||
import { getOwner } from '@ember/application';
|
||||
import MediaService from 'ember-responsive/media';
|
||||
|
||||
const {
|
||||
getOwner
|
||||
} = Ember;
|
||||
const { classify } = Ember.String;
|
||||
|
||||
MediaService.reopen({
|
||||
// Change this if you want a different default breakpoint in tests.
|
||||
_defaultBreakpoint: 'desktop',
|
||||
|
||||
_breakpointArr: Ember.computed('breakpoints', function() {
|
||||
return Object.keys(this.get('breakpoints')) || Ember.A([]);
|
||||
_breakpointArr: computed('breakpoints', function() {
|
||||
return Object.keys(this.get('breakpoints')) || A([]);
|
||||
}),
|
||||
|
||||
_forceSetBreakpoint(breakpoint) {
|
||||
|
@ -45,7 +44,7 @@ MediaService.reopen({
|
|||
}
|
||||
});
|
||||
|
||||
export default Ember.Test.registerAsyncHelper('setBreakpoint', function(app, breakpoint) {
|
||||
export default registerAsyncHelper('setBreakpoint', function(app, breakpoint) {
|
||||
// this should use getOwner once that's supported
|
||||
const mediaService = app.__deprecatedInstance__.lookup('service:media');
|
||||
mediaService._forceSetBreakpoint(breakpoint);
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import Ember from 'ember';
|
||||
import Application from '../../app';
|
||||
import config from '../../config/environment';
|
||||
import { merge } from '@ember/polyfills';
|
||||
import { run } from '@ember/runloop';
|
||||
|
||||
export default function startApp(attrs) {
|
||||
let attributes = Ember.merge({}, config.APP);
|
||||
attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
|
||||
let attributes = merge({}, config.APP);
|
||||
attributes = merge(attributes, attrs); // use defaults, but you can override;
|
||||
|
||||
return Ember.run(() => {
|
||||
return run(() => {
|
||||
let application = Application.create(attributes);
|
||||
application.setupForTesting();
|
||||
application.injectTestHelpers();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import $ from 'jquery';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
import sinon from 'sinon';
|
||||
import Ember from 'ember';
|
||||
|
||||
moduleFor('authenticator:application', 'Unit | application', {
|
||||
unit: true,
|
||||
|
@ -35,28 +35,28 @@ test('`invalidate` should invalidate the session', function(assert) {
|
|||
|
||||
test('`makeRequest` should make a request', function(assert) {
|
||||
assert.expect(2);
|
||||
const stub = sinon.stub(Ember.$, 'ajax');
|
||||
const stub = sinon.stub($, 'ajax');
|
||||
stub.resolves(42);
|
||||
const authenticator = this.subject();
|
||||
authenticator.set('serverTokenEndpoint', 'foo')
|
||||
const promise = authenticator.makeRequest({bar: 'baz'}).then((d) => {
|
||||
assert.equal(d, 42);
|
||||
});
|
||||
assert.ok(Ember.$.ajax.calledWithMatch({url: 'foo', data: {bar: 'baz'}}));
|
||||
Ember.$.ajax.restore();
|
||||
assert.ok($.ajax.calledWithMatch({url: 'foo', data: {bar: 'baz'}}));
|
||||
$.ajax.restore();
|
||||
return promise;
|
||||
});
|
||||
|
||||
test('authenticate should craft a nice payload', function(assert) {
|
||||
assert.expect(2);
|
||||
const stub = sinon.stub(Ember.$, 'ajax');
|
||||
const stub = sinon.stub($, 'ajax');
|
||||
stub.resolves(42);
|
||||
const authenticator = this.subject();
|
||||
authenticator.set('serverTokenEndpoint', 'foo')
|
||||
const promise = authenticator.authenticate('myusername', 'mypassword').then((d) => {
|
||||
assert.equal(d, 42);
|
||||
});
|
||||
assert.ok(Ember.$.ajax.calledWithMatch({url: 'foo', data: {username: 'myusername', password: 'mypassword'}}));
|
||||
Ember.$.ajax.restore();
|
||||
assert.ok($.ajax.calledWithMatch({url: 'foo', data: {username: 'myusername', password: 'mypassword'}}));
|
||||
$.ajax.restore();
|
||||
return promise;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue