Skip to content

Commit

Permalink
Merge pull request intercom#89 from locks/rfc176
Browse files Browse the repository at this point in the history
Convert to new modules API
  • Loading branch information
GavinJoyce authored Oct 20, 2017
2 parents 4b00f96 + 38d94df commit 0e8745c
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 33 deletions.
7 changes: 3 additions & 4 deletions addon/helpers/href-to.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Em from 'ember';

const { getOwner } = Em;
import Helper from '@ember/component/helper';
import { getOwner } from '@ember/application';

function hrefTo(context, targetRouteName, ...rest) {
let router = getOwner(context).lookup('router:main');
Expand All @@ -25,7 +24,7 @@ function hrefTo(context, targetRouteName, ...rest) {

export { hrefTo };

export default Em.Helper.extend({
export default Helper.extend({
compute([targetRouteName, ...rest], namedArgs) {
if(namedArgs.params) {
return hrefTo(this, ...namedArgs.params);
Expand Down
4 changes: 2 additions & 2 deletions addon/href-to.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Em from 'ember';
import LinkComponent from '@ember/routing/link-component';

export default class {

Expand Down Expand Up @@ -64,7 +64,7 @@ export default class {
let id = this.target.id;
if (id) {
let componentInstance = this._getContainer(this.applicationInstance).lookup('-view-registry:main')[id];
isLinkComponent = componentInstance && componentInstance instanceof Em.LinkComponent;
isLinkComponent = componentInstance && componentInstance instanceof LinkComponent;
}

return !isLinkComponent;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"ember-addon"
],
"dependencies": {
"ember-cli-babel": "^6"
"ember-cli-babel": "^6.8.2"
},
"ember-addon": {
"configPath": "tests/dummy/config"
Expand Down
6 changes: 2 additions & 4 deletions tests/dummy/app/app.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import Ember from 'ember';
import Application from '@ember/application';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

let App;

Ember.MODEL_FACTORY_INJECTIONS = true;

App = Ember.Application.extend({
App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/app/components/a-link.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from 'ember';
import LinkComponent from '@ember/routing/link-component';

export default Ember.LinkComponent.extend({
export default LinkComponent.extend({
});
4 changes: 2 additions & 2 deletions tests/dummy/app/components/link-button.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Ember from 'ember';
import Component from '@ember/component';

export default Ember.Component.extend({
export default Component.extend({

tagName: 'a',

Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/app/components/not-a-link.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from 'ember';
import Component from '@ember/component';

export default Ember.Component.extend({
export default Component.extend({
});
4 changes: 2 additions & 2 deletions tests/dummy/app/controllers/about.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Em from 'ember';
import Controller from '@ember/controller';

export default Em.Controller.extend({
export default Controller.extend({
queryParams: ['section'],
section: 'one',
dynamic: 'hello',
Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/app/controllers/application.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Em from 'ember';
import Controller from '@ember/controller';

export default Em.Controller.extend({
export default Controller.extend({
dynamicParams: ['pages.second']
});
4 changes: 2 additions & 2 deletions tests/dummy/app/router.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ember from 'ember';
import EmberRouter from '@ember/routing/router';
import config from './config/environment';

const Router = Ember.Router.extend({
const Router = EmberRouter.extend({
location: config.locationType,
rootURL: config.rootURL
});
Expand Down
4 changes: 2 additions & 2 deletions tests/helpers/destroy-app.js
Original file line number Diff line number Diff line change
@@ -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');
}
4 changes: 1 addition & 3 deletions tests/helpers/module-for-acceptance.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Promise } from 'rsvp';
import { module } from 'qunit';
import Ember from 'ember';
import startApp from '../helpers/start-app';
import destroyApp from '../helpers/destroy-app';

const { RSVP: { Promise } } = Ember;

export default function(name, options = {}) {
module(name, {
beforeEach() {
Expand Down
9 changes: 5 additions & 4 deletions tests/helpers/start-app.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import Ember from 'ember';
import { run } from '@ember/runloop';
import { assign } from '@ember/polyfills';
import Application from '../../app';
import config from '../../config/environment';

export default function startApp(attrs) {
let application;

let attributes = Ember.assign({}, config.APP);
attributes = Ember.assign(attributes, attrs); // use defaults, but you can override;
let attributes = assign({}, config.APP);
attributes = assign(attributes, attrs); // use defaults, but you can override;

Ember.run(() => {
run(() => {
application = Application.create(attributes);
application.setupForTesting();
application.injectTestHelpers();
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1970,7 +1970,7 @@ ember-cli-babel@^5.1.5, ember-cli-babel@^5.2.1:
ember-cli-version-checker "^1.0.2"
resolve "^1.1.2"

ember-cli-babel@^6, ember-cli-babel@^6.0.0, ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6.8.1:
ember-cli-babel@^6.0.0, ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6.8.1, ember-cli-babel@^6.8.2:
version "6.8.2"
resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-6.8.2.tgz#eac2785964f4743f4c815cd53c6288f00cc087d7"
dependencies:
Expand Down

0 comments on commit 0e8745c

Please sign in to comment.