Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update blueprints and tests to RFC #176 #15552

Merged
merged 1 commit into from
Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, beforeEach, afterEach } from 'mocha';
import { expect } from 'chai';
import startApp from '<%= dasherizedPackageName %>/tests/helpers/start-app';
<% if (destroyAppExists) { %>import destroyApp from '<%= dasherizedPackageName %>/tests/helpers/destroy-app';<% } else { %>import Ember from 'ember';<% } %>
<% if (destroyAppExists) { %>import destroyApp from '<%= dasherizedPackageName %>/tests/helpers/destroy-app';<% } else { %>import { run } from '@ember/runloop';<% } %>

describe('<%= friendlyTestName %>', function() {
let application;
Expand All @@ -11,7 +11,7 @@ describe('<%= friendlyTestName %>', function() {
});

afterEach(function() {
<% if (destroyAppExists) { %>destroyApp(application);<% } else { %>Ember.run(application, 'destroy');<% } %>
<% if (destroyAppExists) { %>destroyApp(application);<% } else { %>run(application, 'destroy');<% } %>
});

it('can visit /<%= dasherizedModuleName %>', function() {
Expand Down
4 changes: 2 additions & 2 deletions blueprints/component/files/__root__/__path__/__name__.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from 'ember';
import Component from '@ember/component';
<%= importTemplate %>
export default Ember.Component.extend({<%= contents %>
export default Component.extend({<%= contents %>
});
4 changes: 2 additions & 2 deletions blueprints/controller/files/__root__/__path__/__name__.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from 'ember';
import Controller from '@ember/controller';

export default Ember.Controller.extend({
export default Controller.extend({
});
4 changes: 2 additions & 2 deletions blueprints/helper/files/__root__/helpers/__name__.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ember from 'ember';
import { helper } from '@ember/component/helper';

export function <%= camelizedModuleName %>(params/*, hash*/) {
return params;
}

export default Ember.Helper.helper(<%= camelizedModuleName %>);
export default helper(<%= camelizedModuleName %>);
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { expect } from 'chai';
import { describe, it, beforeEach, afterEach } from 'mocha';
import Ember from 'ember';
import { run } from '@ember/runloop';
import Application from '@ember/application';
import { initialize } from '<%= dasherizedModulePrefix %>/initializers/<%= dasherizedModuleName %>';
import destroyApp from '../../helpers/destroy-app';

describe('<%= friendlyTestName %>', function() {
let application;

beforeEach(function() {
Ember.run(function() {
application = Ember.Application.create();
run(function() {
application = Application.create();
application.deferReadiness();
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import Ember from 'ember';
import Application from '@ember/application';
import { run } from '@ember/runloop';

import { initialize } from '<%= dasherizedModulePrefix %>/initializers/<%= dasherizedModuleName %>';
import { module, test } from 'qunit';
import destroyApp from '../../helpers/destroy-app';

module('<%= friendlyTestName %>', {
beforeEach() {
Ember.run(() => {
this.application = Ember.Application.create();
run(() => {
this.application = Application.create();
this.application.deferReadiness();
});
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import { expect } from 'chai';
import { describe, it, beforeEach } from 'mocha';
import Ember from 'ember';
import Application from '@ember/application';
import { run } from '@ember/runloop';
import { initialize } from '<%= dasherizedModulePrefix %>/instance-initializers/<%= dasherizedModuleName %>';
import destroyApp from '../../helpers/destroy-app';

describe('<%= friendlyTestName %>', function() {
let application, appInstance;

beforeEach(function() {
Ember.run(function() {
application = Ember.Application.create();
run(function() {
application = Application.create();
appInstance = application.buildInstance();
});
});

afterEach(function() {
Ember.run(appInstance, 'destroy');
run(appInstance, 'destroy');
destroyApp(application);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import Ember from 'ember';
import Application from '@ember/application';
import { run } from '@ember/runloop';
import { initialize } from '<%= dasherizedModulePrefix %>/instance-initializers/<%= dasherizedModuleName %>';
import { module, test } from 'qunit';
import destroyApp from '../../helpers/destroy-app';

module('<%= friendlyTestName %>', {
beforeEach() {
Ember.run(() => {
this.application = Ember.Application.create();
run(() => {
this.application = Application.create();
this.appInstance = this.application.buildInstance();
});
},
afterEach() {
Ember.run(this.appInstance, 'destroy');
run(this.appInstance, 'destroy');
destroyApp(this.application);
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import Ember from 'ember';
import EmberObject from '@ember/object';
import <%= classifiedModuleName %>Mixin from '<%= dasherizedPackageName %>/mixins/<%= dasherizedModuleName %>';

describe('<%= friendlyTestName %>', function() {
// Replace this with your real tests.
it('works', function() {
let <%= classifiedModuleName %>Object = Ember.Object.extend(<%= classifiedModuleName %>Mixin);
let <%= classifiedModuleName %>Object = EmberObject.extend(<%= classifiedModuleName %>Mixin);
let subject = <%= classifiedModuleName %>Object.create();
expect(subject).to.be.ok;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Ember from 'ember';
import EmberObject from '@ember/object';
import <%= classifiedModuleName %>Mixin from '<%= projectName %>/mixins/<%= dasherizedModuleName %>';
import { module, test } from 'qunit';

module('<%= friendlyTestName %>');

// Replace this with your real tests.
test('it works', function(assert) {
let <%= classifiedModuleName %>Object = Ember.Object.extend(<%= classifiedModuleName %>Mixin);
let <%= classifiedModuleName %>Object = EmberObject.extend(<%= classifiedModuleName %>Mixin);
let subject = <%= classifiedModuleName %>Object.create();
assert.ok(subject);
});
4 changes: 2 additions & 2 deletions blueprints/mixin/files/__root__/mixins/__name__.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from 'ember';
import Mixin from '@ember/object/mixin';

export default Ember.Mixin.create({
export default Mixin.create({
});
4 changes: 2 additions & 2 deletions blueprints/route/files/__root__/__path__/__name__.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from 'ember';
import Route from '@ember/routing/route';

export default Ember.Route.extend({
export default Route.extend({
});
4 changes: 2 additions & 2 deletions blueprints/service/files/__root__/__path__/__name__.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ember from 'ember';
import Service from '@ember/service';

export default Ember.Service.extend({
export default Service.extend({
});
4 changes: 2 additions & 2 deletions blueprints/test-helper/files/tests/helpers/__name__.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ember from 'ember';
import { registerAsyncHelper } from '@ember/test';

export default Ember.Test.registerAsyncHelper('<%= camelizedModuleName %>', function(app) {
export default registerAsyncHelper('<%= camelizedModuleName %>', function(app) {

});
2 changes: 1 addition & 1 deletion broccoli/minify.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = function _minify(tree, name) {
},
mangle: true,
compress: {
// this is adversely affects heuristics for IIFE eval
// this adversely affects heuristics for IIFE eval
negate_iife: false,
// limit sequences because of memory issues during parsing
sequences: 30
Expand Down
Loading