language
stringclasses 1
value | owner
stringlengths 2
15
| repo
stringlengths 2
21
| sha
stringlengths 45
45
| message
stringlengths 7
36.3k
| path
stringlengths 1
199
| patch
stringlengths 15
102k
| is_multipart
bool 2
classes |
---|---|---|---|---|---|---|---|
Other
|
emberjs
|
ember.js
|
3aace9b6fee8da49c1e7672647fd42ef0309c0e8.json
|
Use inner tag for dirtying
|
packages/ember-glimmer/lib/helper.ts
|
@@ -2,8 +2,8 @@
@module @ember/component
*/
-import { Dict, Opaque } from '@glimmer/util';
import { DirtyableTag } from '@glimmer/reference';
+import { Dict, Opaque } from '@glimmer/util';
import { FrameworkObject } from 'ember-runtime';
import { symbol } from 'ember-utils';
@@ -87,7 +87,7 @@ let Helper = FrameworkObject.extend({
@since 1.13.0
*/
recompute() {
- this[RECOMPUTE_TAG].dirty();
+ this[RECOMPUTE_TAG].inner.dirty();
},
/**
| true |
Other
|
emberjs
|
ember.js
|
3aace9b6fee8da49c1e7672647fd42ef0309c0e8.json
|
Use inner tag for dirtying
|
packages/ember-metal/lib/tags.js
|
@@ -47,7 +47,7 @@ export function markObjectAsDirty(meta, propertyKey) {
let propertyTag = tags !== undefined ? tags[propertyKey] : undefined;
if (propertyTag !== undefined) {
- propertyTag.dirty();
+ propertyTag.inner.dirty();
}
if (propertyKey === 'content' && meta.isProxy()) {
| true |
Other
|
emberjs
|
ember.js
|
40bc56ca3c87edc9f0b9ae63772a1b706e67cfaf.json
|
Remove arity check from initializer
|
packages/ember-application/lib/system/engine.js
|
@@ -12,7 +12,7 @@ import {
privatize as P
} from 'container';
import DAG from 'dag-map';
-import { assert, deprecate } from 'ember-debug';
+import { assert } from 'ember-debug';
import { get, set } from 'ember-metal';
import DefaultResolver from './resolver';
import EngineInstance from './engine-instance';
@@ -124,18 +124,7 @@ const Engine = Namespace.extend(RegistryProxyMixin, {
runInitializers() {
this._runInitializer('initializers', (name, initializer) => {
assert(`No application initializer named '${name}'`, !!initializer);
- if (initializer.initialize.length === 2) {
- deprecate(`The \`initialize\` method for Application initializer '${name}' should take only one argument - \`App\`, an instance of an \`Application\`.`,
- false, {
- id: 'ember-application.app-initializer-initialize-arguments',
- until: '3.0.0',
- url: 'https://emberjs.com/deprecations/v2.x/#toc_initializer-arity'
- });
-
- initializer.initialize(this.__registry__, this);
- } else {
- initializer.initialize(this);
- }
+ initializer.initialize(this);
});
},
@@ -474,7 +463,7 @@ function resolverFor(namespace) {
}
function buildInitializerMethod(bucketName, humanName) {
- return function(initializer) {
+ return function (initializer) {
// If this is the first initializer being added to a subclass, we are going to reopen the class
// to make sure we have a new `initializers` object, which extends from the parent class' using
// prototypal inheritance. Without this, attempting to add initializers to the subclass would
| true |
Other
|
emberjs
|
ember.js
|
40bc56ca3c87edc9f0b9ae63772a1b706e67cfaf.json
|
Remove arity check from initializer
|
packages/ember-application/tests/system/initializers_test.js
|
@@ -18,7 +18,7 @@ moduleFor('Ember.Application initializers', class extends AutobootApplicationTes
});
}
- createSecondApplication(options, MyApplication=Application) {
+ createSecondApplication(options, MyApplication = Application) {
let myOptions = assign(this.applicationOptions, {
rootElement: '#two'
}, options);
@@ -42,7 +42,7 @@ moduleFor('Ember.Application initializers', class extends AutobootApplicationTes
});
expectAssertion(() => {
- MyApplication.initializer({ initialize() {} });
+ MyApplication.initializer({ initialize() { } });
});
}
@@ -329,20 +329,20 @@ moduleFor('Ember.Application initializers', class extends AutobootApplicationTes
FirstApp.initializer({
name: 'abc',
- initialize() {}
+ initialize() { }
});
expectAssertion(() => {
FirstApp.initializer({
name: 'abc',
- initialize() {}
+ initialize() { }
});
});
let SecondApp = Application.extend();
SecondApp.instanceInitializer({
name: 'abc',
- initialize() {}
+ initialize() { }
});
assert.ok(true, 'Two apps can have initializers named the same.');
@@ -362,20 +362,4 @@ moduleFor('Ember.Application initializers', class extends AutobootApplicationTes
this.runTask(() => this.createApplication({}, MyApplication));
}
-
- [`@test initializers throw a deprecation warning when receiving a second argument`](assert) {
- assert.expect(1);
-
- let MyApplication = Application.extend();
-
- MyApplication.initializer({
- name: 'deprecated',
- initialize(registry, application) { // eslint-disable-line no-unused-vars
- }
- });
-
- expectDeprecation(() => {
- this.runTask(() => this.createApplication({}, MyApplication));
- }, /The `initialize` method for Application initializer 'deprecated' should take only one argument - `App`, an instance of an `Application`./);
- }
});
| true |
Other
|
emberjs
|
ember.js
|
27a8df9c5916795c869e985fafcab69bb67af01e.json
|
Add 2.18.0-beta.4 to the Changelog
[ci skip]
(cherry picked from commit 2d0923c6d1d05d432d07769cdc14d77a94b96115)
|
CHANGELOG.md
|
@@ -1,5 +1,8 @@
# Ember Changelog
+### 2.18.0-beta.4 (December 19, 2017)
+- [#15982](https://github.com/emberjs/ember.js/pull/15982) [BUGFIX] Fix issue with unchaining ChainNodes (again)
+
### 2.18.0-beta.3 (December 12, 2017)
- [#15924](https://github.com/emberjs/ember.js/pull/15924) / [#15940](https://github.com/emberjs/ember.js/pull/15940) [BUGFIX] Assert that `classNameBinding` items are non-empty strings
| false |
Other
|
emberjs
|
ember.js
|
9ee5e9cb327b716fe7b83c6daa1a6d215c79f1cc.json
|
remove unneeded `OVERRIDE_CONTAINER_KEY`
|
packages/ember-runtime/lib/system/object.js
|
@@ -9,7 +9,6 @@ import Observable from '../mixins/observable';
import { assert } from 'ember-debug';
import { DEBUG } from 'ember-env-flags';
-let OVERRIDE_CONTAINER_KEY = symbol('OVERRIDE_CONTAINER_KEY');
let OVERRIDE_OWNER = symbol('OVERRIDE_OWNER');
/**
@@ -26,10 +25,6 @@ const EmberObject = CoreObject.extend(Observable, {
_debugContainerKey: descriptor({
enumerable: false,
get() {
- if (this[OVERRIDE_CONTAINER_KEY]) {
- return this[OVERRIDE_CONTAINER_KEY];
- }
-
let meta = peekMeta(this);
let { factory } = meta;
| false |
Other
|
emberjs
|
ember.js
|
c1eb8fe1ab717ac49ddd4d15d7abddc3e8d6ada6.json
|
remove IE9 test fallback
|
packages/ember-glimmer/tests/integration/helpers/input-test.js
|
@@ -638,17 +638,6 @@ moduleFor(`Helpers test: {{input type='text'}}`, class extends InputRenderingTes
this.render(`{{input ${ attrs.replace("%x", value) }}}`);
}
- assertValue(expected) {
- let type = this.$input().attr('type');
-
- if (type !== 'range') {
- this.assert.ok(true, 'IE9 does not support range items');
- return;
- }
-
- super.assertValue(expected);
- }
-
['@test value over default max but below set max is kept']() {
this.renderInput("25");
this.assertValue("25");
| false |
Other
|
emberjs
|
ember.js
|
1f9869a1aeb35e194b901739f8880f9315593a1f.json
|
enforce typechecker in CI
|
bin/run-tests.js
|
@@ -243,11 +243,10 @@ function runChecker(bin, args) {
function codeQualityChecks() {
var checkers = [
- // TODO: Uncomment this to enable TS checker too
- // runChecker('node', [
- // require.resolve('typescript/bin/tsc'),
- // '--noEmit'
- // ]),
+ runChecker('node', [
+ require.resolve('typescript/bin/tsc'),
+ '--noEmit'
+ ]),
runChecker('node', [
require.resolve('tslint/bin/tslint'),
'-p',
| false |
Other
|
emberjs
|
ember.js
|
a8d8c9ad00d34d1b1f461212942def6b0c528933.json
|
remove IE9 testing checks
|
packages/ember-glimmer/tests/integration/helpers/custom-helper-test.js
|
@@ -591,79 +591,27 @@ moduleFor('Helpers test: custom helpers', class extends RenderingTest {
}
});
-// these feature detects prevent errors in these tests
-// on platforms (*cough* IE9 *cough*) that do not
-// property support `Object.freeze`
-let pushingIntoFrozenArrayThrows = (() => {
- let array = [];
- Object.freeze(array);
-
- try {
- array.push('foo');
-
- return false;
- } catch (e) {
- return true;
- }
-})();
-
-let assigningExistingFrozenPropertyThrows = (() => {
- let obj = { foo: 'asdf' };
- Object.freeze(obj);
-
- try {
- obj.foo = 'derp';
-
- return false;
- } catch (e) {
- return true;
- }
-})();
-
-let addingPropertyToFrozenObjectThrows = (() => {
- let obj = { foo: 'asdf' };
- Object.freeze(obj);
-
- try {
- obj.bar = 'derp';
-
- return false;
- } catch (e) {
- return true;
- }
-})();
-
-if (!EmberDev.runningProdBuild && (
- pushingIntoFrozenArrayThrows ||
- assigningExistingFrozenPropertyThrows ||
- addingPropertyToFrozenObjectThrows
-)) {
+if (!EmberDev.runningProdBuild) {
class HelperMutatingArgsTests extends RenderingTest {
buildCompute() {
return (params, hash) => {
- if (pushingIntoFrozenArrayThrows) {
- this.assert.throws(() => {
- params.push('foo');
+ this.assert.throws(() => {
+ params.push('foo');
- // cannot assert error message as it varies by platform
- });
- }
+ // cannot assert error message as it varies by platform
+ });
- if (assigningExistingFrozenPropertyThrows) {
- this.assert.throws(() => {
- hash.foo = 'bar';
+ this.assert.throws(() => {
+ hash.foo = 'bar';
- // cannot assert error message as it varies by platform
- });
- }
+ // cannot assert error message as it varies by platform
+ });
- if (addingPropertyToFrozenObjectThrows) {
- this.assert.throws(() => {
- hash.someUnusedHashProperty = 'bar';
+ this.assert.throws(() => {
+ hash.someUnusedHashProperty = 'bar';
- // cannot assert error message as it varies by platform
- });
- }
+ // cannot assert error message as it varies by platform
+ });
};
}
| false |
Other
|
emberjs
|
ember.js
|
5157c06e7ba3bb14f67fc3a75fe402b7e258c7f6.json
|
enforce eslint and tslint in CI
|
.travis.yml
|
@@ -66,4 +66,4 @@ env:
- TEST_SUITE=blueprints
- TEST_SUITE=travis-browsers DISABLE_JSCS=true DISABLE_JSHINT=true
- TEST_SUITE=each-package-tests BUILD_TYPE=alpha PUBLISH=true
-
+ - TEST_SUITE=code-quality
| true |
Other
|
emberjs
|
ember.js
|
5157c06e7ba3bb14f67fc3a75fe402b7e258c7f6.json
|
enforce eslint and tslint in CI
|
bin/run-tests.js
|
@@ -3,10 +3,12 @@
/* eslint-disable no-console */
var RSVP = require('rsvp');
+var execFile = require('child_process').execFile;
var chalk = require('chalk');
var FEATURES = require('../broccoli/features');
var getPackages = require('../lib/packages');
var runInSequence = require('../lib/run-in-sequence');
+var path = require('path');
var finalhandler = require('finalhandler');
var http = require('http');
@@ -227,6 +229,49 @@ function generateExtendPrototypeTests() {
});
}
+function runChecker(bin, args) {
+ return new RSVP.Promise(function(resolve) {
+ execFile(bin, args, {}, function(error, stdout, stderr) {
+ // I'm buffering instead of inheriting these so that each
+ // checker doesn't interleave its output
+ process.stdout.write(stdout.toString('utf8'));
+ process.stderr.write(stderr.toString('utf8'));
+ resolve({ name: path.basename(args[0]), ok: !error });
+ });
+ });
+}
+
+function codeQualityChecks() {
+ var checkers = [
+ // TODO: Uncomment this to enable TS checker too
+ // runChecker('node', [
+ // require.resolve('typescript/bin/tsc'),
+ // '--noEmit'
+ // ]),
+ runChecker('node', [
+ require.resolve('tslint/bin/tslint'),
+ '-p',
+ 'tsconfig.json'
+ ]),
+ runChecker('node', [
+ require.resolve('eslint/bin/eslint'),
+ '.'
+ ])
+ ];
+ return RSVP.Promise.all(checkers).then(function(results) {
+ results.forEach(result => {
+ if (result.ok) {
+ console.log(result.name + ': ' + chalk.green('OK'));
+ } else {
+ console.log(result.name + ': ' + chalk.red('Failed'));
+ }
+ });
+ if (!results.every(result => result.ok)) {
+ throw new Error("Some quality checks failed");
+ }
+ });
+}
+
switch (process.env.TEST_SUITE) {
case 'built-tests':
console.log('suite: built-tests');
@@ -265,6 +310,9 @@ switch (process.env.TEST_SUITE) {
require('./run-sauce-tests');
process.exit(0);
break;
+ case 'code-quality':
+ testFunctions.push(codeQualityChecks);
+ break;
default:
console.log('suite: default (generate each package)');
generateEachPackageTests();
| true |
Other
|
emberjs
|
ember.js
|
1c58c8d1fd87b9c2b888274e5ac2801e1744f164.json
|
fix tslint errors
|
node-tests/.eslintrc.js
|
@@ -3,6 +3,9 @@ module.exports = {
mocha: true,
node: true,
},
+ parserOptions: {
+ ecmaVersion: 8,
+ },
rules: {
},
};
| true |
Other
|
emberjs
|
ember.js
|
1c58c8d1fd87b9c2b888274e5ac2801e1744f164.json
|
fix tslint errors
|
packages/ember-glimmer/lib/component-managers/abstract.ts
|
@@ -14,7 +14,7 @@ import { IArguments } from '@glimmer/runtime/dist/types/lib/vm/arguments';
import {
Destroyable,
Opaque,
- Option
+ Option
} from '@glimmer/util';
import { DEBUG } from 'ember-env-flags';
import DebugStack from '../utils/debug-stack';
| true |
Other
|
emberjs
|
ember.js
|
1c58c8d1fd87b9c2b888274e5ac2801e1744f164.json
|
fix tslint errors
|
packages/ember-glimmer/lib/helpers/if-unless.ts
|
@@ -14,7 +14,7 @@ import {
Arguments,
PrimitiveReference,
VM
-} from '@glimmer/runtime'
+} from '@glimmer/runtime';
import { assert } from 'ember-debug';
import {
CachedReference,
| true |
Other
|
emberjs
|
ember.js
|
1c58c8d1fd87b9c2b888274e5ac2801e1744f164.json
|
fix tslint errors
|
packages/ember-glimmer/lib/helpers/loc.ts
|
@@ -41,4 +41,3 @@ import { String as StringUtils } from 'ember-runtime';
export default helper(function (params) {
return StringUtils.loc.apply(null, params);
});
-
| true |
Other
|
emberjs
|
ember.js
|
1c58c8d1fd87b9c2b888274e5ac2801e1744f164.json
|
fix tslint errors
|
packages/ember-glimmer/lib/template_registry.ts
|
@@ -3,7 +3,7 @@ import { WrappedTemplateFactory } from './template';
// to support Ember.TEMPLATES but shield ember internals from this legacy
// global API.
interface TemplatesRegistry {
- [name: string]: WrappedTemplateFactory
+ [name: string]: WrappedTemplateFactory;
}
let TEMPLATES: TemplatesRegistry = {};
| true |
Other
|
emberjs
|
ember.js
|
3be6ce4c2900ec377560056236e79f8a9c2fea7f.json
|
remove IE9 soft-fails check
|
packages/ember-metal/tests/descriptor_test.js
|
@@ -5,35 +5,6 @@ import {
descriptor
} from '..';
-// IE9 soft-fails when trying to delete a non-configurable property
-const hasCompliantDelete = (function() {
- let obj = {};
-
- Object.defineProperty(obj, 'zomg', { configurable: false, value: 'zomg' });
-
- try {
- delete obj.zomg;
- } catch (e) {
- return true;
- }
-
- return false;
-})();
-
-// IE9 soft-fails when trying to assign to a non-writable property
-const hasCompliantAssign = (function() {
- let obj = {};
-
- Object.defineProperty(obj, 'zomg', { writable: false, value: 'zomg' });
-
- try {
- obj.zomg = 'lol';
- } catch (e) {
- return true;
- }
-
- return false;
-})();
class DescriptorTest {
@@ -239,11 +210,7 @@ classes.forEach(TestClass => {
let source = factory.source();
- if (hasCompliantDelete) {
- assert.throws(() => delete source.foo, TypeError);
- } else {
- delete source.foo;
- }
+ assert.throws(() => delete source.foo, TypeError);
assert.throws(() => Object.defineProperty(source, 'foo', { configurable: true, value: 'baz' }), TypeError);
@@ -301,13 +268,8 @@ classes.forEach(TestClass => {
let source = factory.source();
- if (hasCompliantAssign) {
- assert.throws(() => source.foo = 'baz', TypeError);
- assert.throws(() => obj.foo = 'baz', TypeError);
- } else {
- source.foo = 'baz';
- obj.foo = 'baz';
- }
+ assert.throws(() => source.foo = 'baz', TypeError);
+ assert.throws(() => obj.foo = 'baz', TypeError);
assert.equal(obj.foo, 'bar');
});
@@ -391,11 +353,7 @@ classes.forEach(TestClass => {
assert.equal(obj.fooBar, 'FOO-BAR');
- if (hasCompliantAssign) {
- assert.throws(() => obj.fooBar = 'foobar', TypeError);
- } else {
- obj.fooBar = 'foobar';
- }
+ assert.throws(() => obj.fooBar = 'foobar', TypeError);
assert.equal(obj.fooBar, 'FOO-BAR');
});
| false |
Other
|
emberjs
|
ember.js
|
ac10de2953edf070d12f229070a857b8bbb11a5d.json
|
Fix unbalanced chaining
When mutating the chains (`remove()` here) we must call `writableChains()`
to "fork" it from the parent.
|
packages/ember-metal/lib/watch_path.js
|
@@ -29,7 +29,7 @@ export function unwatchPath(obj, keyPath, meta) {
if (counter === 1) {
m.writeWatching(keyPath, 0);
- m.readableChains().remove(keyPath);
+ m.writableChains(makeChainNode).remove(keyPath);
} else if (counter > 1) {
m.writeWatching(keyPath, counter - 1);
}
| false |
Other
|
emberjs
|
ember.js
|
aa36194eb06daf5a2e62108993ed90fb836de4b3.json
|
Fix broken test
Previously this was passing in a computed property descriptor into
`lastIndexOf`, which only conincidentally worked. It did `desc > get(this, 'length')`
which was always false which causes it to reassign the value and
avoided any problems and appeared to "work".
|
packages/ember-runtime/tests/suites/array/lastIndexOf.js
|
@@ -1,3 +1,4 @@
+import { get } from 'ember-metal';
import { SuiteModuleBuilder } from '../suite';
const suite = SuiteModuleBuilder.create();
@@ -45,14 +46,14 @@ suite.test('should return -1 when no match is found even startAt search location
let obj = this.newObject(this.newFixture(3));
let foo = {};
- equal(obj.lastIndexOf(foo, obj.length), -1, 'obj.lastIndexOf(foo) should be -1');
+ equal(obj.lastIndexOf(foo, get(obj, 'length')), -1, 'obj.lastIndexOf(foo) should be -1');
});
suite.test('should return -1 when no match is found even startAt search location is greater than length', function() {
let obj = this.newObject(this.newFixture(3));
let foo = {};
- equal(obj.lastIndexOf(foo, obj.length + 1), -1, 'obj.lastIndexOf(foo) should be -1');
+ equal(obj.lastIndexOf(foo, get(obj, 'length') + 1), -1, 'obj.lastIndexOf(foo) should be -1');
});
export default suite;
| false |
Other
|
emberjs
|
ember.js
|
028f0e672a611339357484e1c9be1e7d51097004.json
|
correct variable declaration
|
packages/ember-runtime/lib/computed/reduce_computed_macros.js
|
@@ -782,6 +782,7 @@ function propertySort(itemsKey, sortPropertiesKey) {
this.notifyPropertyChange(key);
}
+ let itemsKeyIsAtThis = (itemsKey === '@this');
let normalizedSortProperties = normalizeSortProperties(sortProperties);
activeObservers = normalizedSortProperties.map(([prop]) => {
let path = itemsKeyIsAtThis ? `@each.${prop}` : `${itemsKey}.@each.${prop}`;
@@ -791,7 +792,6 @@ function propertySort(itemsKey, sortPropertiesKey) {
activeObserversMap.set(this, activeObservers);
- let itemsKeyIsAtThis = (itemsKey === '@this');
let items = itemsKeyIsAtThis ? this : get(this, itemsKey);
if (!isArray(items)) { return emberA(); }
| false |
Other
|
emberjs
|
ember.js
|
1ce33af5a79e71a24597fbc8035c0560c4876bb7.json
|
fix tag in action modifier
|
packages/ember-glimmer/lib/modifiers/action.ts
|
@@ -2,7 +2,7 @@ import {
Simple
} from '@glimmer/interfaces';
import {
- TagWrapper
+ TagWrapper, RevisionTag
} from '@glimmer/reference';
import {
Arguments,
@@ -11,7 +11,7 @@ import {
DynamicScope,
ModifierManager,
} from '@glimmer/runtime';
-import {
+import {
Destroyable
} from '@glimmer/util';
import { assert } from 'ember-debug';
@@ -78,8 +78,9 @@ export class ActionState {
public implicitTarget: any;
public dom: any;
public eventName: any;
+ public tag: TagWrapper<RevisionTag | null>;
- constructor(element: Simple.Element, actionId: number, actionName: any, actionArgs: any[], namedArgs: CapturedNamedArguments, positionalArgs: CapturedPositionalArguments, implicitTarget: any, dom: any) {
+ constructor(element: Simple.Element, actionId: number, actionName: any, actionArgs: any[], namedArgs: CapturedNamedArguments, positionalArgs: CapturedPositionalArguments, implicitTarget: any, dom: any, tag: TagWrapper<RevisionTag | null>) {
this.element = element;
this.actionId = actionId;
this.actionName = actionName;
@@ -89,6 +90,7 @@ export class ActionState {
this.implicitTarget = implicitTarget;
this.dom = dom;
this.eventName = this.getEventName();
+ this.tag = tag;
}
getEventName() {
@@ -182,7 +184,7 @@ export class ActionState {
// implements ModifierManager<Action>
export default class ActionModifierManager implements ModifierManager<ActionState> {
create(element: Simple.Element, args: Arguments, _dynamicScope: DynamicScope, dom: any) {
- let { named, positional } = args.capture();
+ let { named, positional, tag } = args.capture();
let implicitTarget;
let actionName;
let actionNameRef: any;
@@ -223,6 +225,7 @@ export default class ActionModifierManager implements ModifierManager<ActionStat
positional,
implicitTarget,
dom,
+ tag,
);
}
@@ -246,9 +249,8 @@ export default class ActionModifierManager implements ModifierManager<ActionStat
actionState.eventName = actionState.getEventName();
}
- getTag() {
- // TODO: ModifierManager needs a getTag method. Where does this tag come from?
- return new TagWrapper();
+ getTag(actionState: ActionState) {
+ return actionState.tag;
}
getDestructor(modifier: Destroyable) {
| false |
Other
|
emberjs
|
ember.js
|
cd19c1420c91a8c5090805fa6ae87fe350f7f65c.json
|
fix wrapper in top level outlet
|
packages/ember-glimmer/lib/component-managers/outlet.ts
|
@@ -3,6 +3,7 @@ import {
Option,
Unique
} from '@glimmer/interfaces';
+import { WrappedBuilder, ParsedLayout } from '@glimmer/opcode-compiler';
import {
Tag, VersionedPathReference
} from '@glimmer/reference';
@@ -128,6 +129,25 @@ class TopLevelOutletComponentManager extends OutletComponentManager
return 'div';
}
+ getLayout(state: OutletComponentDefinitionState, resolver: RuntimeResolver): Invocation {
+ // The router has already resolved the template
+ const template = state.template;
+ const compileOptions = Object.assign({},
+ resolver.templateOptions,
+ { asPartial: false, referrer: template.referrer});
+ // TODO fix this getting private
+ const parsed: ParsedLayout<OwnedTemplateMeta> = (template as any).parsedLayout;
+ const layout = new WrappedBuilder(
+ compileOptions,
+ parsed,
+ TOP_CAPABILITIES,
+ );
+ return {
+ handle: layout.compile(),
+ symbolTable: layout.symbolTable
+ };
+ }
+
create(environment: Environment, definition: TopOutletComponentDefinitionState, _args: Arguments, dynamicScope: DynamicScope) {
if (DEBUG) {
this._pushToDebugStack(`template:${definition.template.referrer.moduleName}`, environment);
| false |
Other
|
emberjs
|
ember.js
|
6fe5504e2fd50e4e70756e7c035d2b60160efd46.json
|
Remove redundant registrations
These are already handled in `buildOwner()`
|
packages/ember-glimmer/tests/integration/helpers/input-test.js
|
@@ -1,17 +1,10 @@
import { assign } from 'ember-utils';
import { set } from 'ember-metal';
-import { TextField, Checkbox, Component } from '../../utils/helpers';
+import { Component } from '../../utils/helpers';
import { RenderingTest, moduleFor } from '../../utils/test-case';
import { runDestroy } from 'internal-test-helpers';
class InputRenderingTest extends RenderingTest {
- constructor() {
- super();
-
- this.registerComponent('-text-field', { ComponentClass: TextField });
- this.registerComponent('-checkbox', { ComponentClass: Checkbox });
- }
-
$input() {
return this.$('input');
}
| true |
Other
|
emberjs
|
ember.js
|
6fe5504e2fd50e4e70756e7c035d2b60160efd46.json
|
Remove redundant registrations
These are already handled in `buildOwner()`
|
packages/ember-glimmer/tests/integration/helpers/text-area-test.js
|
@@ -1,17 +1,10 @@
import { assign } from 'ember-utils';
import { set } from 'ember-metal';
-import { TextArea } from '../../utils/helpers';
import { RenderingTest, moduleFor } from '../../utils/test-case';
import { classes } from '../../utils/test-helpers';
import { applyMixins } from '../../utils/abstract-test-case';
class TextAreaRenderingTest extends RenderingTest {
- constructor() {
- super();
-
- this.registerComponent('-text-area', { ComponentClass: TextArea });
- }
-
assertTextArea({ attrs, value } = {}) {
let mergedAttrs = assign({ 'class': classes('ember-view ember-text-area') }, attrs);
this.assertComponentElement(this.firstChild, { tagName: 'textarea', attrs: mergedAttrs });
| true |
Other
|
emberjs
|
ember.js
|
6fe5504e2fd50e4e70756e7c035d2b60160efd46.json
|
Remove redundant registrations
These are already handled in `buildOwner()`
|
packages/ember-glimmer/tests/utils/helpers.js
|
@@ -8,9 +8,7 @@ export {
Helper,
helper,
Component,
- TextArea,
LinkComponent,
- TextField,
InteractiveRender,
InertRenderer,
htmlSafe,
| true |
Other
|
emberjs
|
ember.js
|
27204b0188e20ea9f7c9825376e9d2c587737adf.json
|
Update CHANGELOG for 2.18.0-beta.3
[ci skip]
(cherry picked from commit 7a5e3a8de8f95b7a9bd01ebb49059f7b2298257f)
|
CHANGELOG.md
|
@@ -1,5 +1,11 @@
# Ember Changelog
+### 2.18.0-beta.3 (December 12, 2017)
+
+- [#15924](https://github.com/emberjs/ember.js/pull/15924) / [#15940](https://github.com/emberjs/ember.js/pull/15940) [BUGFIX] Assert that `classNameBinding` items are non-empty strings
+- [#15927](https://github.com/emberjs/ember.js/pull/15927) [BUGFIX] Extend test framework detection to `ember-qunit` and `ember-mocha`
+- [#15935](https://github.com/emberjs/ember.js/pull/15935) [BUGFIX] Fix framework detection in blueprints to work with prerelease versions of ember-cli-mocha
+
### 2.18.0-beta.2 (December 4, 2017)
- [#15902](https://github.com/emberjs/ember.js/pull/15902) [BUGFIX] Fix link-to throwing in integration tests
| false |
Other
|
emberjs
|
ember.js
|
4c235ae09445fe76f430dcbaf3f86cf9339d38d1.json
|
remove binding param in `changeProperties`
|
packages/ember-metal/lib/property_events.js
|
@@ -235,13 +235,12 @@ function endPropertyChanges() {
@method changeProperties
@param {Function} callback
- @param [binding]
@private
*/
-function changeProperties(callback, binding) {
+function changeProperties(callback) {
beginPropertyChanges();
try {
- callback.call(binding);
+ callback();
} finally {
endPropertyChanges();
}
| false |
Other
|
emberjs
|
ember.js
|
8f8709a8f58cdf40a6f2c61542da9524ee21ce5e.json
|
use lookup instead of create
|
blueprints/controller-test/qunit-rfc-232-files/tests/unit/__path__/__test__.js
|
@@ -6,7 +6,7 @@ module('<%= friendlyTestDescription %>', function(hooks) {
// Replace this with your real tests.
test('it exists', function(assert) {
- let controller = this.owner.factoryFor('controller:<%= controllerPathName %>').create();
+ let controller = this.owner.lookup('controller:<%= controllerPathName %>');
assert.ok(controller);
});
});
| true |
Other
|
emberjs
|
ember.js
|
8f8709a8f58cdf40a6f2c61542da9524ee21ce5e.json
|
use lookup instead of create
|
node-tests/fixtures/controller-test/rfc232.js
|
@@ -6,7 +6,7 @@ module('Unit | Controller | foo', function(hooks) {
// Replace this with your real tests.
test('it exists', function(assert) {
- let controller = this.owner.factoryFor('controller:foo').create();
+ let controller = this.owner.lookup('controller:foo');
assert.ok(controller);
});
});
| true |
Other
|
emberjs
|
ember.js
|
afa52d11bcebe84976d0402a189440d7a92bf84e.json
|
blueprints/util-test: Add RFC232 variants
|
blueprints/util-test/qunit-rfc-232-files/tests/unit/utils/__name__-test.js
|
@@ -0,0 +1,13 @@
+import <%= camelizedModuleName %> from '<%= dasherizedModulePrefix %>/utils/<%= dasherizedModuleName %>';
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('<%= friendlyTestName %>', function(hooks) {
+ setupTest(hooks);
+
+ // Replace this with your real tests.
+ test('it works', function(assert) {
+ let result = <%= camelizedModuleName %>();
+ assert.ok(result);
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
afa52d11bcebe84976d0402a189440d7a92bf84e.json
|
blueprints/util-test: Add RFC232 variants
|
node-tests/blueprints/util-test-test.js
|
@@ -9,6 +9,7 @@ const modifyPackages = blueprintHelpers.modifyPackages;
const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;
+const generateFakePackageManifest = require('../helpers/generate-fake-package-manifest');
const fixture = require('../helpers/fixture');
describe('Blueprint: util-test', function() {
@@ -26,6 +27,19 @@ describe('Blueprint: util-test', function() {
});
});
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ generateFakePackageManifest('ember-cli-qunit', '4.1.1');
+ });
+
+ it('util-test foo-bar', function() {
+ return emberGenerateDestroy(['util-test', 'foo-bar'], _file => {
+ expect(_file('tests/unit/utils/foo-bar-test.js'))
+ .to.equal(fixture('util-test/rfc232.js'));
+ });
+ });
+ });
+
describe('with ember-cli-mocha', function() {
beforeEach(function() {
modifyPackages([
| true |
Other
|
emberjs
|
ember.js
|
afa52d11bcebe84976d0402a189440d7a92bf84e.json
|
blueprints/util-test: Add RFC232 variants
|
node-tests/fixtures/util-test/rfc232.js
|
@@ -0,0 +1,13 @@
+import fooBar from 'my-app/utils/foo-bar';
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('Unit | Utility | foo bar', function(hooks) {
+ setupTest(hooks);
+
+ // Replace this with your real tests.
+ test('it works', function(assert) {
+ let result = fooBar();
+ assert.ok(result);
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
81568674fdbfdf26221708b94c08340f97279c9a.json
|
blueprints/instance-initializer-test: Add RFC232 variants
|
blueprints/instance-initializer-test/qunit-rfc-232-files/tests/unit/instance-initializers/__name__-test.js
|
@@ -0,0 +1,29 @@
+import Application from '@ember/application';
+import { run } from '@ember/runloop';
+
+import { initialize } from '<%= dasherizedModulePrefix %>/initializers/<%= dasherizedModuleName %>';
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+import destroyApp from '../../helpers/destroy-app';
+
+module('<%= friendlyTestName %>', function(hooks) {
+ setupTest(hooks);
+
+ hooks.beforeEach(function() {
+ run(() => {
+ this.application = Application.create();
+ this.application.deferReadiness();
+ });
+ });
+ hooks.afterEach(function() {
+ destroyApp(this.application);
+ });
+
+ // Replace this with your real tests.
+ test('it works', function(assert) {
+ initialize(this.application);
+
+ // you would normally confirm the results of the initializer here
+ assert.ok(true);
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
81568674fdbfdf26221708b94c08340f97279c9a.json
|
blueprints/instance-initializer-test: Add RFC232 variants
|
node-tests/blueprints/instance-initializer-test-test.js
|
@@ -9,6 +9,7 @@ const modifyPackages = blueprintHelpers.modifyPackages;
const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;
+const generateFakePackageManifest = require('../helpers/generate-fake-package-manifest');
const fixture = require('../helpers/fixture');
describe('Blueprint: instance-initializer-test', function() {
@@ -26,6 +27,19 @@ describe('Blueprint: instance-initializer-test', function() {
});
});
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ generateFakePackageManifest('ember-cli-qunit', '4.1.1');
+ });
+
+ it('instance-initializer-test foo', function() {
+ return emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
+ expect(_file('tests/unit/instance-initializers/foo-test.js'))
+ .to.equal(fixture('instance-initializer-test/rfc232.js'));
+ });
+ });
+ });
+
describe('with ember-cli-mocha', function() {
beforeEach(function() {
modifyPackages([
| true |
Other
|
emberjs
|
ember.js
|
81568674fdbfdf26221708b94c08340f97279c9a.json
|
blueprints/instance-initializer-test: Add RFC232 variants
|
node-tests/fixtures/instance-initializer-test/rfc232.js
|
@@ -0,0 +1,29 @@
+import Application from '@ember/application';
+import { run } from '@ember/runloop';
+
+import { initialize } from 'my-app/initializers/foo';
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+import destroyApp from '../../helpers/destroy-app';
+
+module('Unit | Instance Initializer | foo', function(hooks) {
+ setupTest(hooks);
+
+ hooks.beforeEach(function() {
+ run(() => {
+ this.application = Application.create();
+ this.application.deferReadiness();
+ });
+ });
+ hooks.afterEach(function() {
+ destroyApp(this.application);
+ });
+
+ // Replace this with your real tests.
+ test('it works', function(assert) {
+ initialize(this.application);
+
+ // you would normally confirm the results of the initializer here
+ assert.ok(true);
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
345ba248495abb105def1722b834882b1fc5e85d.json
|
blueprints/controller-test: Add RFC232 variants
|
blueprints/controller-test/index.js
|
@@ -2,14 +2,18 @@
/* eslint-env node */
+const stringUtil = require('ember-cli-string-utils');
const testInfo = require('ember-cli-test-info');
const useTestFrameworkDetector = require('../test-framework-detector');
module.exports = useTestFrameworkDetector({
description: 'Generates a controller unit test.',
locals: function(options) {
+ let dasherizedModuleName = stringUtil.dasherize(options.entity.name);
+ let controllerPathName = dasherizedModuleName;
return {
+ controllerPathName: controllerPathName,
friendlyTestDescription: testInfo.description(options.entity.name, 'Unit', 'Controller')
};
}
| true |
Other
|
emberjs
|
ember.js
|
345ba248495abb105def1722b834882b1fc5e85d.json
|
blueprints/controller-test: Add RFC232 variants
|
blueprints/controller-test/qunit-rfc-232-files/tests/unit/__path__/__test__.js
|
@@ -0,0 +1,12 @@
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('<%= friendlyTestDescription %>', function(hooks) {
+ setupTest(hooks);
+
+ // Replace this with your real tests.
+ test('it exists', function(assert) {
+ let controller = this.owner.factoryFor('controller:<%= controllerPathName %>').create();
+ assert.ok(controller);
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
345ba248495abb105def1722b834882b1fc5e85d.json
|
blueprints/controller-test: Add RFC232 variants
|
node-tests/blueprints/controller-test-test.js
|
@@ -27,6 +27,19 @@ describe('Blueprint: controller-test', function() {
});
});
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ generateFakePackageManifest('ember-cli-qunit', '4.1.1');
+ });
+
+ it('controller-test foo', function() {
+ return emberGenerateDestroy(['controller-test', 'foo'], _file => {
+ expect(_file('tests/unit/controllers/foo-test.js'))
+ .to.equal(fixture('controller-test/rfc232.js'));
+ });
+ });
+ });
+
describe('with [email protected]', function() {
beforeEach(function() {
modifyPackages([
| true |
Other
|
emberjs
|
ember.js
|
345ba248495abb105def1722b834882b1fc5e85d.json
|
blueprints/controller-test: Add RFC232 variants
|
node-tests/fixtures/controller-test/rfc232.js
|
@@ -0,0 +1,12 @@
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('Unit | Controller | foo', function(hooks) {
+ setupTest(hooks);
+
+ // Replace this with your real tests.
+ test('it exists', function(assert) {
+ let controller = this.owner.factoryFor('controller:foo').create();
+ assert.ok(controller);
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
4fc1370b6eec39a0dd3b98ca1bb3e002b061500a.json
|
blueprints/initializer-test: Add RFC232 variants
|
blueprints/initializer-test/qunit-rfc-232-files/tests/unit/initializers/__name__-test.js
|
@@ -0,0 +1,29 @@
+import Application from '@ember/application';
+import { run } from '@ember/runloop';
+
+import { initialize } from '<%= dasherizedModulePrefix %>/initializers/<%= dasherizedModuleName %>';
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+import destroyApp from '../../helpers/destroy-app';
+
+module('<%= friendlyTestName %>', function(hooks) {
+ setupTest(hooks);
+
+ hooks.beforeEach(function() {
+ run(() => {
+ this.application = Application.create();
+ this.application.deferReadiness();
+ });
+ });
+ hooks.afterEach(function() {
+ destroyApp(this.application);
+ });
+
+ // Replace this with your real tests.
+ test('it works', function(assert) {
+ initialize(this.application);
+
+ // you would normally confirm the results of the initializer here
+ assert.ok(true);
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
4fc1370b6eec39a0dd3b98ca1bb3e002b061500a.json
|
blueprints/initializer-test: Add RFC232 variants
|
node-tests/blueprints/initializer-test-test.js
|
@@ -9,6 +9,7 @@ const modifyPackages = blueprintHelpers.modifyPackages;
const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;
+const generateFakePackageManifest = require('../helpers/generate-fake-package-manifest');
const fixture = require('../helpers/fixture');
describe('Blueprint: initializer-test', function() {
@@ -26,6 +27,19 @@ describe('Blueprint: initializer-test', function() {
});
});
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ generateFakePackageManifest('ember-cli-qunit', '4.1.1');
+ });
+
+ it('initializer-test foo', function() {
+ return emberGenerateDestroy(['initializer-test', 'foo'], _file => {
+ expect(_file('tests/unit/initializers/foo-test.js'))
+ .to.equal(fixture('initializer-test/rfc232.js'));
+ });
+ });
+ });
+
describe('with ember-cli-mocha', function() {
beforeEach(function() {
modifyPackages([
| true |
Other
|
emberjs
|
ember.js
|
4fc1370b6eec39a0dd3b98ca1bb3e002b061500a.json
|
blueprints/initializer-test: Add RFC232 variants
|
node-tests/fixtures/initializer-test/rfc232.js
|
@@ -0,0 +1,29 @@
+import Application from '@ember/application';
+import { run } from '@ember/runloop';
+
+import { initialize } from 'my-app/initializers/foo';
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+import destroyApp from '../../helpers/destroy-app';
+
+module('Unit | Initializer | foo', function(hooks) {
+ setupTest(hooks);
+
+ hooks.beforeEach(function() {
+ run(() => {
+ this.application = Application.create();
+ this.application.deferReadiness();
+ });
+ });
+ hooks.afterEach(function() {
+ destroyApp(this.application);
+ });
+
+ // Replace this with your real tests.
+ test('it works', function(assert) {
+ initialize(this.application);
+
+ // you would normally confirm the results of the initializer here
+ assert.ok(true);
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
308fec5ce8ed29bf85cd390966d02a4c834a9937.json
|
remove leftovers from leveraging native `WeakMap`s
|
packages/ember-metal/lib/index.js
|
@@ -23,7 +23,6 @@ export {
getDispatchOverride
} from './error_handler';
export {
- META_DESC,
meta,
peekMeta,
deleteMeta
| true |
Other
|
emberjs
|
ember.js
|
308fec5ce8ed29bf85cd390966d02a4c834a9937.json
|
remove leftovers from leveraging native `WeakMap`s
|
packages/ember-metal/lib/meta.js
|
@@ -411,18 +411,6 @@ for (let name in listenerMethods) {
Meta.prototype[name] = listenerMethods[name];
}
-export const META_DESC = {
- writable: true,
- configurable: true,
- enumerable: false,
- value: null
-};
-
-const EMBER_META_PROPERTY = {
- name: META_FIELD,
- descriptor: META_DESC
-};
-
if (MANDATORY_SETTER) {
Meta.prototype.readInheritedValue = function(key, subkey) {
let internalKey = `_${key}`;
@@ -455,9 +443,8 @@ if (MANDATORY_SETTER) {
};
}
-
-let getPrototypeOf = Object.getPrototypeOf;
-let metaStore = new WeakMap();
+const getPrototypeOf = Object.getPrototypeOf;
+const metaStore = new WeakMap();
export function setMeta(obj, meta) {
if (DEBUG) {
| true |
Other
|
emberjs
|
ember.js
|
308fec5ce8ed29bf85cd390966d02a4c834a9937.json
|
remove leftovers from leveraging native `WeakMap`s
|
packages/ember/lib/index.js
|
@@ -68,7 +68,6 @@ Ember.Instrumentation = {
};
Ember.Error = EmberDebug.Error;
-Ember.META_DESC = metal.META_DESC;
Ember.meta = metal.meta;
Ember.get = metal.get;
Ember.getWithDefault = metal.getWithDefault;
| true |
Other
|
emberjs
|
ember.js
|
308fec5ce8ed29bf85cd390966d02a4c834a9937.json
|
remove leftovers from leveraging native `WeakMap`s
|
packages/ember/tests/reexports_test.js
|
@@ -53,7 +53,6 @@ QUnit.module('ember reexports');
['FEATURES', 'ember/features'],
['FEATURES.isEnabled', 'ember-debug', 'isFeatureEnabled'],
['Error', 'ember-debug'],
- ['META_DESC', 'ember-metal'],
['meta', 'ember-metal'],
['get', 'ember-metal'],
['set', 'ember-metal'],
| true |
Other
|
emberjs
|
ember.js
|
cd6b8d423790b27170a7ef31b92cddcb3141b292.json
|
blueprints/helper-test: Add RFC232 variants
|
blueprints/helper-test/qunit-rfc-232-files/tests/__testType__/helpers/__name__-test.js
|
@@ -0,0 +1,29 @@
+<% if (testType === 'integration') { %>import { module, test } from 'qunit';
+import { setupRenderingTest } from 'ember-qunit';
+import { render } from '@ember/test-helpers';
+import hbs from 'htmlbars-inline-precompile';
+
+module('<%= friendlyTestName %>', function(hooks) {
+ setupRenderingTest(hooks);
+
+ // Replace this with your real tests.
+ test('it renders', async function(assert) {
+ this.set('inputValue', '1234');
+
+ await render(hbs`{{<%= dasherizedModuleName %> inputValue}}`);
+
+ assert.equal(this.element.textContent.trim(), '1234');
+ });
+});<% } else if (testType === 'unit') { %>import { <%= camelizedModuleName %> } from '<%= dasherizedModulePrefix %>/helpers/<%= dasherizedModuleName %>';
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('<%= friendlyTestName %>', function(hooks) {
+ setupTest(hooks);
+
+ // Replace this with your real tests.
+ test('it works', function(assert) {
+ let result = <%= camelizedModuleName %>([42]);
+ assert.ok(result);
+ });
+});<% } %>
| true |
Other
|
emberjs
|
ember.js
|
cd6b8d423790b27170a7ef31b92cddcb3141b292.json
|
blueprints/helper-test: Add RFC232 variants
|
node-tests/blueprints/helper-test-test.js
|
@@ -34,6 +34,26 @@ describe('Blueprint: helper-test', function() {
});
});
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ generateFakePackageManifest('ember-cli-qunit', '4.1.1');
+ });
+
+ it('helper-test foo/bar-baz', function() {
+ return emberGenerateDestroy(['helper-test', 'foo/bar-baz'], _file => {
+ expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
+ .to.equal(fixture('helper-test/rfc232.js'));
+ });
+ });
+
+ it('helper-test foo/bar-baz --unit', function() {
+ return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--unit'], _file => {
+ expect(_file('tests/unit/helpers/foo/bar-baz-test.js'))
+ .to.equal(fixture('helper-test/rfc232-unit.js'));
+ });
+ });
+ });
+
describe('with [email protected]', function() {
beforeEach(function() {
modifyPackages([
| true |
Other
|
emberjs
|
ember.js
|
cd6b8d423790b27170a7ef31b92cddcb3141b292.json
|
blueprints/helper-test: Add RFC232 variants
|
node-tests/fixtures/helper-test/rfc232-unit.js
|
@@ -0,0 +1,13 @@
+import { fooBarBaz } from 'my-app/helpers/foo/bar-baz';
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('Unit | Helper | foo/bar baz', function(hooks) {
+ setupTest(hooks);
+
+ // Replace this with your real tests.
+ test('it works', function(assert) {
+ let result = fooBarBaz([42]);
+ assert.ok(result);
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
cd6b8d423790b27170a7ef31b92cddcb3141b292.json
|
blueprints/helper-test: Add RFC232 variants
|
node-tests/fixtures/helper-test/rfc232.js
|
@@ -0,0 +1,17 @@
+import { module, test } from 'qunit';
+import { setupRenderingTest } from 'ember-qunit';
+import { render } from '@ember/test-helpers';
+import hbs from 'htmlbars-inline-precompile';
+
+module('Integration | Helper | foo/bar baz', function(hooks) {
+ setupRenderingTest(hooks);
+
+ // Replace this with your real tests.
+ test('it renders', async function(assert) {
+ this.set('inputValue', '1234');
+
+ await render(hbs`{{foo/bar-baz inputValue}}`);
+
+ assert.equal(this.element.textContent.trim(), '1234');
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
e8e4593bc06ac92081a1c68cafb14f5debbf4544.json
|
tests/blueprints/util-test: Use fixture files
|
node-tests/blueprints/util-test-test.js
|
@@ -9,6 +9,8 @@ const modifyPackages = blueprintHelpers.modifyPackages;
const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;
+const fixture = require('../helpers/fixture');
+
describe('Blueprint: util-test', function() {
setupTestHooks(this);
@@ -20,7 +22,7 @@ describe('Blueprint: util-test', function() {
it('util-test foo-bar', function() {
return emberGenerateDestroy(['util-test', 'foo-bar'], _file => {
expect(_file('tests/unit/utils/foo-bar-test.js'))
- .to.contain("import fooBar from 'my-app/utils/foo-bar';");
+ .to.equal(fixture('util-test/default.js'));
});
});
@@ -35,9 +37,7 @@ describe('Blueprint: util-test', function() {
it('util-test foo-bar', function() {
return emberGenerateDestroy(['util-test', 'foo-bar'], _file => {
expect(_file('tests/unit/utils/foo-bar-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("import fooBar from 'my-app/utils/foo-bar';")
- .to.contain("describe('Unit | Utility | foo bar', function() {");
+ .to.equal(fixture('util-test/mocha.js'));
});
});
});
@@ -51,7 +51,7 @@ describe('Blueprint: util-test', function() {
it('util-test foo-bar', function() {
return emberGenerateDestroy(['util-test', 'foo-bar'], _file => {
expect(_file('tests/unit/utils/foo-bar-test.js'))
- .to.contain("import fooBar from 'dummy/utils/foo-bar';");
+ .to.equal(fixture('util-test/dummy.js'));
});
});
});
| true |
Other
|
emberjs
|
ember.js
|
e8e4593bc06ac92081a1c68cafb14f5debbf4544.json
|
tests/blueprints/util-test: Use fixture files
|
node-tests/fixtures/util-test/default.js
|
@@ -0,0 +1,10 @@
+import fooBar from 'my-app/utils/foo-bar';
+import { module, test } from 'qunit';
+
+module('Unit | Utility | foo bar');
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ let result = fooBar();
+ assert.ok(result);
+});
| true |
Other
|
emberjs
|
ember.js
|
e8e4593bc06ac92081a1c68cafb14f5debbf4544.json
|
tests/blueprints/util-test: Use fixture files
|
node-tests/fixtures/util-test/dummy.js
|
@@ -0,0 +1,10 @@
+import fooBar from 'dummy/utils/foo-bar';
+import { module, test } from 'qunit';
+
+module('Unit | Utility | foo bar');
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ let result = fooBar();
+ assert.ok(result);
+});
| true |
Other
|
emberjs
|
ember.js
|
e8e4593bc06ac92081a1c68cafb14f5debbf4544.json
|
tests/blueprints/util-test: Use fixture files
|
node-tests/fixtures/util-test/mocha.js
|
@@ -0,0 +1,11 @@
+import { expect } from 'chai';
+import { describe, it } from 'mocha';
+import fooBar from 'my-app/utils/foo-bar';
+
+describe('Unit | Utility | foo bar', function() {
+ // Replace this with your real tests.
+ it('works', function() {
+ let result = fooBar();
+ expect(result).to.be.ok;
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
ad9fbf96b2226c8d2598c137060a368bd75f0f55.json
|
tests/blueprints/service-test: Use fixture files
|
node-tests/blueprints/service-test-test.js
|
@@ -10,6 +10,7 @@ const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;
const generateFakePackageManifest = require('../helpers/generate-fake-package-manifest');
+const fixture = require('../helpers/fixture');
describe('Blueprint: service-test', function() {
setupTestHooks(this);
@@ -22,8 +23,7 @@ describe('Blueprint: service-test', function() {
it('service-test foo', function() {
return emberGenerateDestroy(['service-test', 'foo'], _file => {
expect(_file('tests/unit/services/foo-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('service:foo'");
+ .to.equal(fixture('service-test/default.js'));
});
});
@@ -39,16 +39,14 @@ describe('Blueprint: service-test', function() {
it('service-test foo', function() {
return emberGenerateDestroy(['service-test', 'foo'], _file => {
expect(_file('tests/unit/services/foo-test.js'))
- .to.contain("import { describeModule, it } from 'ember-mocha';")
- .to.contain("describeModule('service:foo', 'Unit | Service | foo'");
+ .to.equal(fixture('service-test/mocha.js'));
});
});
it('service-test foo --pod', function() {
return emberGenerateDestroy(['service-test', 'foo', '--pod'], _file => {
expect(_file('tests/unit/foo/service-test.js'))
- .to.contain("import { describeModule, it } from 'ember-mocha';")
- .to.contain("describeModule('service:foo', 'Unit | Service | foo'");
+ .to.equal(fixture('service-test/mocha.js'));
});
});
});
@@ -65,20 +63,14 @@ describe('Blueprint: service-test', function() {
it('service-test foo', function() {
return emberGenerateDestroy(['service-test', 'foo'], _file => {
expect(_file('tests/unit/services/foo-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("import { setupTest } from 'ember-mocha';")
- .to.contain("describe('Unit | Service | foo', function() {")
- .to.contain("setupTest('service:foo',");
+ .to.equal(fixture('service-test/mocha-0.12.js'));
});
});
it('service-test foo --pod', function() {
return emberGenerateDestroy(['service-test', 'foo', '--pod'], _file => {
expect(_file('tests/unit/foo/service-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("import { setupTest } from 'ember-mocha';")
- .to.contain("describe('Unit | Service | foo', function() {")
- .to.contain("setupTest('service:foo',");
+ .to.equal(fixture('service-test/mocha-0.12.js'));
});
});
});
@@ -92,8 +84,7 @@ describe('Blueprint: service-test', function() {
it('service-test foo', function() {
return emberGenerateDestroy(['service-test', 'foo'], _file => {
expect(_file('tests/unit/services/foo-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('service:foo'");
+ .to.equal(fixture('service-test/default.js'));
expect(_file('app/service-test/foo.js'))
.to.not.exist;
| true |
Other
|
emberjs
|
ember.js
|
ad9fbf96b2226c8d2598c137060a368bd75f0f55.json
|
tests/blueprints/service-test: Use fixture files
|
node-tests/fixtures/service-test/default.js
|
@@ -0,0 +1,12 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('service:foo', 'Unit | Service | foo', {
+ // Specify the other units that are required for this test.
+ // needs: ['service:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let service = this.subject();
+ assert.ok(service);
+});
| true |
Other
|
emberjs
|
ember.js
|
ad9fbf96b2226c8d2598c137060a368bd75f0f55.json
|
tests/blueprints/service-test: Use fixture files
|
node-tests/fixtures/service-test/mocha-0.12.js
|
@@ -0,0 +1,16 @@
+import { expect } from 'chai';
+import { describe, it } from 'mocha';
+import { setupTest } from 'ember-mocha';
+
+describe('Unit | Service | foo', function() {
+ setupTest('service:foo', {
+ // Specify the other units that are required for this test.
+ // needs: ['service:foo']
+ });
+
+ // Replace this with your real tests.
+ it('exists', function() {
+ let service = this.subject();
+ expect(service).to.be.ok;
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
ad9fbf96b2226c8d2598c137060a368bd75f0f55.json
|
tests/blueprints/service-test: Use fixture files
|
node-tests/fixtures/service-test/mocha.js
|
@@ -0,0 +1,16 @@
+import { expect } from 'chai';
+import { describeModule, it } from 'ember-mocha';
+
+describeModule('service:foo', 'Unit | Service | foo',
+ {
+ // Specify the other units that are required for this test.
+ // needs: ['service:foo']
+ },
+ function() {
+ // Replace this with your real tests.
+ it('exists', function() {
+ let service = this.subject();
+ expect(service).to.be.ok;
+ });
+ }
+);
| true |
Other
|
emberjs
|
ember.js
|
6fb0e24adddb2c00e6d5a7efd2fb97fac2c34e2f.json
|
tests/blueprints/route-test: Use fixture files
|
node-tests/blueprints/route-test-test.js
|
@@ -10,6 +10,7 @@ const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;
const generateFakePackageManifest = require('../helpers/generate-fake-package-manifest');
+const fixture = require('../helpers/fixture');
describe('Blueprint: route-test', function() {
setupTestHooks(this);
@@ -22,8 +23,7 @@ describe('Blueprint: route-test', function() {
it('route-test foo', function() {
return emberGenerateDestroy(['route-test', 'foo'], (_file) => {
expect(_file('tests/unit/routes/foo-test.js'))
- .to.contain('import { moduleFor, test } from \'ember-qunit\';')
- .to.contain('moduleFor(\'route:foo\'');
+ .to.equal(fixture('route-test/default.js'));
});
});
@@ -39,8 +39,7 @@ describe('Blueprint: route-test', function() {
it('route-test foo', function() {
return emberGenerateDestroy(['route-test', 'foo'], (_file) => {
expect(_file('tests/unit/routes/foo-test.js'))
- .to.contain('import { describeModule, it } from \'ember-mocha\';')
- .to.contain('describeModule(\'route:foo\', \'Unit | Route | foo\'');
+ .to.equal(fixture('route-test/mocha.js'));
});
});
});
@@ -57,10 +56,7 @@ describe('Blueprint: route-test', function() {
it('route-test foo', function() {
return emberGenerateDestroy(['route-test', 'foo'], (_file) => {
expect(_file('tests/unit/routes/foo-test.js'))
- .to.contain('import { describe, it } from \'mocha\';')
- .to.contain('import { setupTest } from \'ember-mocha\';')
- .to.contain('describe(\'Unit | Route | foo\', function() {')
- .to.contain('setupTest(\'route:foo\',');
+ .to.equal(fixture('route-test/mocha-0.12.js'));
});
});
});
@@ -74,8 +70,7 @@ describe('Blueprint: route-test', function() {
it('route-test foo', function() {
return emberGenerateDestroy(['route-test', 'foo'], (_file) => {
expect(_file('tests/unit/routes/foo-test.js'))
- .to.contain('import { moduleFor, test } from \'ember-qunit\';')
- .to.contain('moduleFor(\'route:foo\'');
+ .to.equal(fixture('route-test/default.js'));
});
});
});
| true |
Other
|
emberjs
|
ember.js
|
6fb0e24adddb2c00e6d5a7efd2fb97fac2c34e2f.json
|
tests/blueprints/route-test: Use fixture files
|
node-tests/fixtures/route-test/default.js
|
@@ -0,0 +1,11 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:foo', 'Unit | Route | foo', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+test('it exists', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+});
| true |
Other
|
emberjs
|
ember.js
|
6fb0e24adddb2c00e6d5a7efd2fb97fac2c34e2f.json
|
tests/blueprints/route-test: Use fixture files
|
node-tests/fixtures/route-test/mocha-0.12.js
|
@@ -0,0 +1,15 @@
+import { expect } from 'chai';
+import { describe, it } from 'mocha';
+import { setupTest } from 'ember-mocha';
+
+describe('Unit | Route | foo', function() {
+ setupTest('route:foo', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+ });
+
+ it('exists', function() {
+ let route = this.subject();
+ expect(route).to.be.ok;
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
6fb0e24adddb2c00e6d5a7efd2fb97fac2c34e2f.json
|
tests/blueprints/route-test: Use fixture files
|
node-tests/fixtures/route-test/mocha.js
|
@@ -0,0 +1,15 @@
+import { expect } from 'chai';
+import { describeModule, it } from 'ember-mocha';
+
+describeModule('route:foo', 'Unit | Route | foo',
+ {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+ },
+ function() {
+ it('exists', function() {
+ let route = this.subject();
+ expect(route).to.be.ok;
+ });
+ }
+);
| true |
Other
|
emberjs
|
ember.js
|
259e939518f7ba04215c97af50bda06b8d0fe6d6.json
|
tests/blueprints/mixin-test: Use fixture files
|
node-tests/blueprints/mixin-test-test.js
|
@@ -9,6 +9,8 @@ const modifyPackages = blueprintHelpers.modifyPackages;
const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;
+const fixture = require('../helpers/fixture');
+
describe('Blueprint: mixin-test', function() {
setupTestHooks(this);
@@ -20,7 +22,7 @@ describe('Blueprint: mixin-test', function() {
it('mixin-test foo', function() {
return emberGenerateDestroy(['mixin-test', 'foo'], _file => {
expect(_file('tests/unit/mixins/foo-test.js'))
- .to.contain("import FooMixin from 'my-app/mixins/foo';");
+ .to.equal(fixture('mixin-test/default.js'));
});
});
@@ -35,9 +37,7 @@ describe('Blueprint: mixin-test', function() {
it('mixin-test foo', function() {
return emberGenerateDestroy(['mixin-test', 'foo'], _file => {
expect(_file('tests/unit/mixins/foo-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("import FooMixin from 'my-app/mixins/foo';")
- .to.contain("describe('Unit | Mixin | foo', function() {");
+ .to.equal(fixture('mixin-test/mocha.js'));
});
});
});
@@ -51,7 +51,7 @@ describe('Blueprint: mixin-test', function() {
it('mixin-test foo', function() {
return emberGenerateDestroy(['mixin-test', 'foo'], _file => {
expect(_file('tests/unit/mixins/foo-test.js'))
- .to.contain("import FooMixin from 'my-addon/mixins/foo';");
+ .to.equal(fixture('mixin-test/addon.js'));
});
});
});
| true |
Other
|
emberjs
|
ember.js
|
259e939518f7ba04215c97af50bda06b8d0fe6d6.json
|
tests/blueprints/mixin-test: Use fixture files
|
node-tests/fixtures/mixin-test/addon.js
|
@@ -0,0 +1,12 @@
+import EmberObject from '@ember/object';
+import FooMixin from 'my-addon/mixins/foo';
+import { module, test } from 'qunit';
+
+module('Unit | Mixin | foo');
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ let FooObject = EmberObject.extend(FooMixin);
+ let subject = FooObject.create();
+ assert.ok(subject);
+});
| true |
Other
|
emberjs
|
ember.js
|
259e939518f7ba04215c97af50bda06b8d0fe6d6.json
|
tests/blueprints/mixin-test: Use fixture files
|
node-tests/fixtures/mixin-test/default.js
|
@@ -0,0 +1,12 @@
+import EmberObject from '@ember/object';
+import FooMixin from 'my-app/mixins/foo';
+import { module, test } from 'qunit';
+
+module('Unit | Mixin | foo');
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ let FooObject = EmberObject.extend(FooMixin);
+ let subject = FooObject.create();
+ assert.ok(subject);
+});
| true |
Other
|
emberjs
|
ember.js
|
259e939518f7ba04215c97af50bda06b8d0fe6d6.json
|
tests/blueprints/mixin-test: Use fixture files
|
node-tests/fixtures/mixin-test/mocha.js
|
@@ -0,0 +1,13 @@
+import { expect } from 'chai';
+import { describe, it } from 'mocha';
+import EmberObject from '@ember/object';
+import FooMixin from 'my-app/mixins/foo';
+
+describe('Unit | Mixin | foo', function() {
+ // Replace this with your real tests.
+ it('works', function() {
+ let FooObject = EmberObject.extend(FooMixin);
+ let subject = FooObject.create();
+ expect(subject).to.be.ok;
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
22a9e7f50f0c909aee8175d9cb7d04ea2c47bdbc.json
|
tests/blueprints/instance-initializer-test: Use fixture files
|
node-tests/blueprints/instance-initializer-test-test.js
|
@@ -9,6 +9,8 @@ const modifyPackages = blueprintHelpers.modifyPackages;
const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;
+const fixture = require('../helpers/fixture');
+
describe('Blueprint: instance-initializer-test', function() {
setupTestHooks(this);
@@ -20,11 +22,7 @@ describe('Blueprint: instance-initializer-test', function() {
it('instance-initializer-test foo', function() {
return emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
expect(_file('tests/unit/instance-initializers/foo-test.js'))
- .to.contain("import { initialize } from 'my-app/instance-initializers/foo';")
- .to.contain("module('Unit | Instance Initializer | foo'")
- .to.contain("application = Application.create();")
- .to.contain("this.appInstance = this.application.buildInstance();")
- .to.contain("initialize(this.appInstance);");
+ .to.equal(fixture('instance-initializer-test/default.js'));
});
});
@@ -39,11 +37,7 @@ describe('Blueprint: instance-initializer-test', function() {
it('instance-initializer-test foo for mocha', function() {
return emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
expect(_file('tests/unit/instance-initializers/foo-test.js'))
- .to.contain("import { initialize } from 'my-app/instance-initializers/foo';")
- .to.contain("describe('Unit | Instance Initializer | foo', function() {")
- .to.contain("application = Application.create();")
- .to.contain("appInstance = application.buildInstance();")
- .to.contain("initialize(appInstance);");
+ .to.equal(fixture('instance-initializer-test/mocha.js'));
});
});
});
@@ -57,11 +51,7 @@ describe('Blueprint: instance-initializer-test', function() {
it('instance-initializer-test foo', function() {
return emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
expect(_file('tests/unit/instance-initializers/foo-test.js'))
- .to.contain("import { initialize } from 'dummy/instance-initializers/foo';")
- .to.contain("module('Unit | Instance Initializer | foo'")
- .to.contain("application = Application.create();")
- .to.contain("this.appInstance = this.application.buildInstance();")
- .to.contain("initialize(this.appInstance);");
+ .to.equal(fixture('instance-initializer-test/dummy.js'));
});
});
});
| true |
Other
|
emberjs
|
ember.js
|
22a9e7f50f0c909aee8175d9cb7d04ea2c47bdbc.json
|
tests/blueprints/instance-initializer-test: Use fixture files
|
node-tests/fixtures/instance-initializer-test/default.js
|
@@ -0,0 +1,26 @@
+import Application from '@ember/application';
+import { run } from '@ember/runloop';
+import { initialize } from 'my-app/instance-initializers/foo';
+import { module, test } from 'qunit';
+import destroyApp from '../../helpers/destroy-app';
+
+module('Unit | Instance Initializer | foo', {
+ beforeEach() {
+ run(() => {
+ this.application = Application.create();
+ this.appInstance = this.application.buildInstance();
+ });
+ },
+ afterEach() {
+ run(this.appInstance, 'destroy');
+ destroyApp(this.application);
+ }
+});
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ initialize(this.appInstance);
+
+ // you would normally confirm the results of the initializer here
+ assert.ok(true);
+});
| true |
Other
|
emberjs
|
ember.js
|
22a9e7f50f0c909aee8175d9cb7d04ea2c47bdbc.json
|
tests/blueprints/instance-initializer-test: Use fixture files
|
node-tests/fixtures/instance-initializer-test/dummy.js
|
@@ -0,0 +1,26 @@
+import Application from '@ember/application';
+import { run } from '@ember/runloop';
+import { initialize } from 'dummy/instance-initializers/foo';
+import { module, test } from 'qunit';
+import destroyApp from '../../helpers/destroy-app';
+
+module('Unit | Instance Initializer | foo', {
+ beforeEach() {
+ run(() => {
+ this.application = Application.create();
+ this.appInstance = this.application.buildInstance();
+ });
+ },
+ afterEach() {
+ run(this.appInstance, 'destroy');
+ destroyApp(this.application);
+ }
+});
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ initialize(this.appInstance);
+
+ // you would normally confirm the results of the initializer here
+ assert.ok(true);
+});
| true |
Other
|
emberjs
|
ember.js
|
22a9e7f50f0c909aee8175d9cb7d04ea2c47bdbc.json
|
tests/blueprints/instance-initializer-test: Use fixture files
|
node-tests/fixtures/instance-initializer-test/mocha.js
|
@@ -0,0 +1,30 @@
+import { expect } from 'chai';
+import { describe, it, beforeEach } from 'mocha';
+import Application from '@ember/application';
+import { run } from '@ember/runloop';
+import { initialize } from 'my-app/instance-initializers/foo';
+import destroyApp from '../../helpers/destroy-app';
+
+describe('Unit | Instance Initializer | foo', function() {
+ let application, appInstance;
+
+ beforeEach(function() {
+ run(function() {
+ application = Application.create();
+ appInstance = application.buildInstance();
+ });
+ });
+
+ afterEach(function() {
+ run(appInstance, 'destroy');
+ destroyApp(application);
+ });
+
+ // Replace this with your real tests.
+ it('works', function() {
+ initialize(appInstance);
+
+ // you would normally confirm the results of the initializer here
+ expect(true).to.be.ok;
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
61040db1f6d0591e4da35d160d885a0b418c4ead.json
|
tests/blueprints/initializer-test: Use fixture files
|
node-tests/blueprints/initializer-test-test.js
|
@@ -9,6 +9,8 @@ const modifyPackages = blueprintHelpers.modifyPackages;
const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;
+const fixture = require('../helpers/fixture');
+
describe('Blueprint: initializer-test', function() {
setupTestHooks(this);
@@ -20,10 +22,7 @@ describe('Blueprint: initializer-test', function() {
it('initializer-test foo', function() {
return emberGenerateDestroy(['initializer-test', 'foo'], _file => {
expect(_file('tests/unit/initializers/foo-test.js'))
- .to.contain("import { initialize } from 'my-app/initializers/foo';")
- .to.contain("module('Unit | Initializer | foo'")
- .to.contain("application = Application.create();")
- .to.contain("initialize(this.application);");
+ .to.equal(fixture('initializer-test/default.js'));
});
});
@@ -38,10 +37,7 @@ describe('Blueprint: initializer-test', function() {
it('initializer-test foo', function() {
return emberGenerateDestroy(['initializer-test', 'foo'], _file => {
expect(_file('tests/unit/initializers/foo-test.js'))
- .to.contain("import { initialize } from 'my-app/initializers/foo';")
- .to.contain("describe('Unit | Initializer | foo', function() {")
- .to.contain("application = Application.create();")
- .to.contain("initialize(application);");
+ .to.equal(fixture('initializer-test/mocha.js'));
});
});
});
@@ -55,10 +51,7 @@ describe('Blueprint: initializer-test', function() {
it('initializer-test foo', function() {
return emberGenerateDestroy(['initializer-test', 'foo'], _file => {
expect(_file('tests/unit/initializers/foo-test.js'))
- .to.contain("import { initialize } from 'dummy/initializers/foo';")
- .to.contain("module('Unit | Initializer | foo'")
- .to.contain("application = Application.create();")
- .to.contain("initialize(this.application);");
+ .to.equal(fixture('initializer-test/dummy.js'));
});
});
});
| true |
Other
|
emberjs
|
ember.js
|
61040db1f6d0591e4da35d160d885a0b418c4ead.json
|
tests/blueprints/initializer-test: Use fixture files
|
node-tests/fixtures/initializer-test/default.js
|
@@ -0,0 +1,26 @@
+import Application from '@ember/application';
+import { run } from '@ember/runloop';
+
+import { initialize } from 'my-app/initializers/foo';
+import { module, test } from 'qunit';
+import destroyApp from '../../helpers/destroy-app';
+
+module('Unit | Initializer | foo', {
+ beforeEach() {
+ run(() => {
+ this.application = Application.create();
+ this.application.deferReadiness();
+ });
+ },
+ afterEach() {
+ destroyApp(this.application);
+ }
+});
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ initialize(this.application);
+
+ // you would normally confirm the results of the initializer here
+ assert.ok(true);
+});
| true |
Other
|
emberjs
|
ember.js
|
61040db1f6d0591e4da35d160d885a0b418c4ead.json
|
tests/blueprints/initializer-test: Use fixture files
|
node-tests/fixtures/initializer-test/dummy.js
|
@@ -0,0 +1,26 @@
+import Application from '@ember/application';
+import { run } from '@ember/runloop';
+
+import { initialize } from 'dummy/initializers/foo';
+import { module, test } from 'qunit';
+import destroyApp from '../../helpers/destroy-app';
+
+module('Unit | Initializer | foo', {
+ beforeEach() {
+ run(() => {
+ this.application = Application.create();
+ this.application.deferReadiness();
+ });
+ },
+ afterEach() {
+ destroyApp(this.application);
+ }
+});
+
+// Replace this with your real tests.
+test('it works', function(assert) {
+ initialize(this.application);
+
+ // you would normally confirm the results of the initializer here
+ assert.ok(true);
+});
| true |
Other
|
emberjs
|
ember.js
|
61040db1f6d0591e4da35d160d885a0b418c4ead.json
|
tests/blueprints/initializer-test: Use fixture files
|
node-tests/fixtures/initializer-test/mocha.js
|
@@ -0,0 +1,29 @@
+import { expect } from 'chai';
+import { describe, it, beforeEach, afterEach } from 'mocha';
+import { run } from '@ember/runloop';
+import Application from '@ember/application';
+import { initialize } from 'my-app/initializers/foo';
+import destroyApp from '../../helpers/destroy-app';
+
+describe('Unit | Initializer | foo', function() {
+ let application;
+
+ beforeEach(function() {
+ run(function() {
+ application = Application.create();
+ application.deferReadiness();
+ });
+ });
+
+ afterEach(function() {
+ destroyApp(application);
+ });
+
+ // Replace this with your real tests.
+ it('works', function() {
+ initialize(application);
+
+ // you would normally confirm the results of the initializer here
+ expect(true).to.be.ok;
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
e1c25c959c10f716e9ccbaeef4a8e1eaaa509f4e.json
|
tests/blueprints/helper-test: Use fixture files
|
node-tests/blueprints/helper-test-test.js
|
@@ -46,8 +46,7 @@ describe('Blueprint: helper-test', function() {
it('helper-test foo/bar-baz --integration', function() {
return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], _file => {
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
- .to.contain("import { describeComponent, it } from 'ember-mocha';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';");
+ .to.equal(fixture('helper-test/mocha.js'));
});
});
});
@@ -64,19 +63,14 @@ describe('Blueprint: helper-test', function() {
it('helper-test foo/bar-baz --integration', function() {
return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], _file => {
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("import { setupComponentTest } from 'ember-mocha';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("describe('Integration | Helper | foo/bar baz', function() {");
+ .to.equal(fixture('helper-test/mocha-0.12.js'));
});
});
it('helper-test foo/bar-baz for mocha', function() {
return emberGenerateDestroy(['helper-test', 'foo/bar-baz'], _file => {
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("setupComponentTest('foo/bar-baz', {")
- .to.contain("describe('Integration | Helper | foo/bar baz', function() {");
+ .to.equal(fixture('helper-test/mocha-0.12.js'));
});
});
});
| true |
Other
|
emberjs
|
ember.js
|
e1c25c959c10f716e9ccbaeef4a8e1eaaa509f4e.json
|
tests/blueprints/helper-test: Use fixture files
|
node-tests/fixtures/helper-test/mocha-0.12.js
|
@@ -0,0 +1,27 @@
+import { expect } from 'chai';
+import { describe, it } from 'mocha';
+import { setupComponentTest } from 'ember-mocha';
+import hbs from 'htmlbars-inline-precompile';
+
+describe('Integration | Helper | foo/bar baz', function() {
+ setupComponentTest('foo/bar-baz', {
+ integration: true
+ });
+
+ it('renders', function() {
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.on('myAction', function(val) { ... });
+ // Template block usage:
+ // this.render(hbs`
+ // {{#foo/bar-baz}}
+ // template content
+ // {{/foo/bar-baz}}
+ // `);
+ this.set('inputValue', '1234');
+
+ this.render(hbs`{{foo/bar-baz inputValue}}`);
+
+ expect(this.$().text().trim()).to.equal('1234');
+ });
+});
+
| true |
Other
|
emberjs
|
ember.js
|
e1c25c959c10f716e9ccbaeef4a8e1eaaa509f4e.json
|
tests/blueprints/helper-test: Use fixture files
|
node-tests/fixtures/helper-test/mocha.js
|
@@ -0,0 +1,28 @@
+import { expect } from 'chai';
+
+import { describeComponent, it } from 'ember-mocha';
+import hbs from 'htmlbars-inline-precompile';
+
+describeComponent('foo/bar-baz', 'helper:foo/bar-baz',
+ {
+ integration: true
+ },
+ function() {
+ it('renders', function() {
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.on('myAction', function(val) { ... });
+ // Template block usage:
+ // this.render(hbs`
+ // {{#foo/bar-baz}}
+ // template content
+ // {{/foo/bar-baz}}
+ // `);
+ this.set('inputValue', '1234');
+
+ this.render(hbs`{{foo/bar-baz inputValue}}`);
+
+ expect(this.$().text().trim()).to.equal('1234');
+ });
+ }
+);
+
| true |
Other
|
emberjs
|
ember.js
|
d73a1c0b7c5b6ad4c339ebca145ad3ce850973e7.json
|
tests/blueprints/controller-test: Use fixture files
|
node-tests/blueprints/controller-test-test.js
|
@@ -10,6 +10,7 @@ const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;
const generateFakePackageManifest = require('../helpers/generate-fake-package-manifest');
+const fixture = require('../helpers/fixture');
describe('Blueprint: controller-test', function() {
setupTestHooks(this);
@@ -22,8 +23,7 @@ describe('Blueprint: controller-test', function() {
it('controller-test foo', function() {
return emberGenerateDestroy(['controller-test', 'foo'], _file => {
expect(_file('tests/unit/controllers/foo-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('controller:foo'");
+ .to.equal(fixture('controller-test/default.js'));
});
});
@@ -39,8 +39,7 @@ describe('Blueprint: controller-test', function() {
it('controller-test foo for mocha', function() {
return emberGenerateDestroy(['controller-test', 'foo'], _file => {
expect(_file('tests/unit/controllers/foo-test.js'))
- .to.contain("import { describeModule, it } from 'ember-mocha';")
- .to.contain("describeModule('controller:foo', 'Unit | Controller | foo'");
+ .to.equal(fixture('controller-test/mocha.js'));
});
});
});
@@ -57,10 +56,7 @@ describe('Blueprint: controller-test', function() {
it('controller-test foo', function() {
return emberGenerateDestroy(['controller-test', 'foo'], _file => {
expect(_file('tests/unit/controllers/foo-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("import { setupTest } from 'ember-mocha';")
- .to.contain("describe('Unit | Controller | foo'")
- .to.contain("setupTest('controller:foo',");
+ .to.equal(fixture('controller-test/mocha-0.12.js'));
});
});
});
@@ -74,8 +70,7 @@ describe('Blueprint: controller-test', function() {
it('controller-test foo', function() {
return emberGenerateDestroy(['controller-test', 'foo'], _file => {
expect(_file('tests/unit/controllers/foo-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('controller:foo'");
+ .to.equal(fixture('controller-test/default.js'));
});
});
});
| true |
Other
|
emberjs
|
ember.js
|
d73a1c0b7c5b6ad4c339ebca145ad3ce850973e7.json
|
tests/blueprints/controller-test: Use fixture files
|
node-tests/fixtures/controller-test/default.js
|
@@ -0,0 +1,12 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:foo', 'Unit | Controller | foo', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let controller = this.subject();
+ assert.ok(controller);
+});
| true |
Other
|
emberjs
|
ember.js
|
d73a1c0b7c5b6ad4c339ebca145ad3ce850973e7.json
|
tests/blueprints/controller-test: Use fixture files
|
node-tests/fixtures/controller-test/mocha-0.12.js
|
@@ -0,0 +1,16 @@
+import { expect } from 'chai';
+import { describe, it } from 'mocha';
+import { setupTest } from 'ember-mocha';
+
+describe('Unit | Controller | foo', function() {
+ setupTest('controller:foo', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+ });
+
+ // Replace this with your real tests.
+ it('exists', function() {
+ let controller = this.subject();
+ expect(controller).to.be.ok;
+ });
+});
| true |
Other
|
emberjs
|
ember.js
|
d73a1c0b7c5b6ad4c339ebca145ad3ce850973e7.json
|
tests/blueprints/controller-test: Use fixture files
|
node-tests/fixtures/controller-test/mocha.js
|
@@ -0,0 +1,16 @@
+import { expect } from 'chai';
+import { describeModule, it } from 'ember-mocha';
+
+describeModule('controller:foo', 'Unit | Controller | foo',
+ {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+ },
+ function() {
+ // Replace this with your real tests.
+ it('exists', function() {
+ let controller = this.subject();
+ expect(controller).to.be.ok;
+ });
+ }
+);
| true |
Other
|
emberjs
|
ember.js
|
1ce7a9d14864607f3fdddede59a40c81231d7874.json
|
tests/blueprints/component-test: Use fixture files
|
node-tests/blueprints/component-test-test.js
|
@@ -47,12 +47,7 @@ describe('Blueprint: component-test', function() {
it('component-test x-foo', function() {
return emberGenerateDestroy(['component-test', 'x-foo'], _file => {
expect(_file('tests/integration/components/x-foo/component-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('x-foo'")
- .to.contain("integration: true")
- .to.contain("{{x-foo}}")
- .to.contain("{{#x-foo}}");
+ .to.equal(fixture('component-test/default.js'));
});
});
});
@@ -134,12 +129,7 @@ describe('Blueprint: component-test', function() {
it('component-test x-foo', function() {
return emberGenerateDestroy(['component-test', 'x-foo'], _file => {
expect(_file('tests/integration/components/x-foo-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('x-foo'")
- .to.contain("integration: true")
- .to.contain("{{x-foo}}")
- .to.contain("{{#x-foo}}");
+ .to.equal(fixture('component-test/default.js'));
expect(_file('app/component-test/x-foo.js'))
.to.not.exist;
@@ -149,9 +139,7 @@ describe('Blueprint: component-test', function() {
it('component-test x-foo --unit', function() {
return emberGenerateDestroy(['component-test', 'x-foo', '--unit'], _file => {
expect(_file('tests/unit/components/x-foo-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("moduleForComponent('x-foo'")
- .to.contain("unit: true");
+ .to.equal(fixture('component-test/unit.js'));
expect(_file('app/component-test/x-foo.js'))
.to.not.exist;
@@ -161,9 +149,7 @@ describe('Blueprint: component-test', function() {
it('component-test x-foo --dummy', function() {
return emberGenerateDestroy(['component-test', 'x-foo', '--dummy'], _file => {
expect(_file('tests/integration/components/x-foo-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('x-foo'");
+ .to.equal(fixture('component-test/default.js'));
expect(_file('app/component-test/x-foo.js'))
.to.not.exist;
@@ -179,21 +165,14 @@ describe('Blueprint: component-test', function() {
it('component-test x-foo --in-repo-addon=my-addon', function() {
return emberGenerateDestroy(['component-test', 'x-foo', '--in-repo-addon=my-addon'], _file => {
expect(_file('tests/integration/components/x-foo-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('x-foo'")
- .to.contain("integration: true")
- .to.contain("{{x-foo}}")
- .to.contain("{{#x-foo}}");
+ .to.equal(fixture('component-test/default.js'));
});
});
it('component-test x-foo --in-repo-addon=my-addon --unit', function() {
return emberGenerateDestroy(['component-test', 'x-foo', '--in-repo-addon=my-addon', '--unit'], _file => {
expect(_file('tests/unit/components/x-foo-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("moduleForComponent('x-foo'")
- .to.contain("unit: true");
+ .to.equal(fixture('component-test/unit.js'));
});
});
});
| false |
Other
|
emberjs
|
ember.js
|
1d07a7640eee47b03479c954b5f409fe0d0553d7.json
|
tests/fixtures: Add editorconfig overrides
|
node-tests/fixtures/.editorconfig
|
@@ -0,0 +1,5 @@
+# http://editorconfig.org
+
+[*]
+trim_trailing_whitespace = false
+insert_final_newline = false
| false |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/acceptance-test-test.js
|
@@ -12,22 +12,54 @@ const expect = chai.expect;
describe('Blueprint: acceptance-test', function() {
setupTestHooks(this);
- it('acceptance-test foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['acceptance-test', 'foo'], _file => {
+ describe('in app', function() {
+ beforeEach(function() {
+ return emberNew();
+ });
+
+ it('acceptance-test foo', function() {
+ return emberGenerateDestroy(['acceptance-test', 'foo'], _file => {
expect(_file('tests/acceptance/foo-test.js'))
.to.contain("import { test } from 'qunit';")
.to.contain("moduleForAcceptance('Acceptance | foo');")
.to.contain("test('visiting /foo', function(assert) {")
.to.contain("visit('/foo');")
.to.contain("andThen(function() {")
.to.contain("assert.equal(currentURL(), '/foo');");
- }));
+ });
+ });
+
+ describe('with ember-cli-mocha', function() {
+ beforeEach(function() {
+ return modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ });
+
+ it('acceptance-test foo', function() {
+ return emberGenerateDestroy(['acceptance-test', 'foo'], _file => {
+ expect(_file('tests/acceptance/foo-test.js'))
+ .to.contain("import { describe, it, beforeEach, afterEach } from 'mocha';")
+ .to.contain("import { expect } from 'chai';")
+ .to.contain("describe('Acceptance | foo', function() {")
+ .to.contain("it('can visit /foo', function() {")
+ .to.contain("visit('/foo');")
+ .to.contain("return andThen(() => {")
+ .to.contain("expect(currentURL()).to.equal('/foo');");
+ });
+ });
+ });
});
- it('in-addon acceptance-test foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['acceptance-test', 'foo'], _file => {
+
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('acceptance-test foo', function() {
+ return emberGenerateDestroy(['acceptance-test', 'foo'], _file => {
expect(_file('tests/acceptance/foo-test.js'))
.to.contain("import { test } from 'qunit';")
.to.contain("moduleForAcceptance('Acceptance | foo');")
@@ -38,12 +70,11 @@ describe('Blueprint: acceptance-test', function() {
expect(_file('app/acceptance-tests/foo.js'))
.to.not.exist;
- }));
- });
+ });
+ });
- it('in-addon acceptance-test foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['acceptance-test', 'foo/bar'], _file => {
+ it('acceptance-test foo/bar', function() {
+ return emberGenerateDestroy(['acceptance-test', 'foo/bar'], _file => {
expect(_file('tests/acceptance/foo/bar-test.js'))
.to.contain("import { test } from 'qunit';")
.to.contain("moduleForAcceptance('Acceptance | foo/bar');")
@@ -54,24 +85,7 @@ describe('Blueprint: acceptance-test', function() {
expect(_file('app/acceptance-tests/foo/bar.js'))
.to.not.exist;
- }));
- });
-
- it('acceptance-test foo for mocha', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => emberGenerateDestroy(['acceptance-test', 'foo'], _file => {
- expect(_file('tests/acceptance/foo-test.js'))
- .to.contain("import { describe, it, beforeEach, afterEach } from 'mocha';")
- .to.contain("import { expect } from 'chai';")
- .to.contain("describe('Acceptance | foo', function() {")
- .to.contain("it('can visit /foo', function() {")
- .to.contain("visit('/foo');")
- .to.contain("return andThen(() => {")
- .to.contain("expect(currentURL()).to.equal('/foo');");
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/component-addon-test.js
|
@@ -11,11 +11,16 @@ const expect = chai.expect;
describe('Blueprint: component-addon', function() {
setupTestHooks(this);
- it('component-addon foo-bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['component-addon', 'foo-bar'], _file => {
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('component-addon foo-bar', function() {
+ return emberGenerateDestroy(['component-addon', 'foo-bar'], _file => {
expect(_file('app/components/foo-bar.js'))
.to.contain("export { default } from 'my-addon/components/foo-bar';");
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/component-test.js
|
@@ -18,9 +18,13 @@ const fixture = require('../helpers/file');
describe('Blueprint: component', function() {
setupTestHooks(this);
- it('component x-foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component', 'x-foo'], _file => {
+ describe('in app', function() {
+ beforeEach(function() {
+ return emberNew();
+ });
+
+ it('component x-foo', function() {
+ return emberGenerateDestroy(['component', 'x-foo'], _file => {
expect(_file('app/components/x-foo.js')).to.contain("import Component from '@ember/component';")
.to.contain("export default Component.extend({")
.to.contain("});");
@@ -35,12 +39,11 @@ describe('Blueprint: component', function() {
.to.contain("integration: true")
.to.contain("{{x-foo}}")
.to.contain("{{#x-foo}}");
- }));
- });
+ });
+ });
- it('component foo/x-foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component', 'foo/x-foo'], _file => {
+ it('component foo/x-foo', function() {
+ return emberGenerateDestroy(['component', 'foo/x-foo'], _file => {
expect(_file('app/components/foo/x-foo.js'))
.to.contain("import Component from '@ember/component';")
.to.contain("export default Component.extend({")
@@ -56,12 +59,11 @@ describe('Blueprint: component', function() {
.to.contain("integration: true")
.to.contain("{{foo/x-foo}}")
.to.contain("{{#foo/x-foo}}");
- }));
- });
+ });
+ });
- it('component x-foo ignores --path option', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--path', 'foo'], _file => {
+ it('component x-foo --path foo', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--path', 'foo'], _file => {
expect(_file('app/components/x-foo.js'))
.to.contain("import Component from '@ember/component';")
.to.contain("export default Component.extend({")
@@ -77,540 +79,665 @@ describe('Blueprint: component', function() {
.to.contain("integration: true")
.to.contain("{{x-foo}}")
.to.contain("{{#x-foo}}");
- }));
- });
+ });
+ });
- it('in-addon component x-foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['component', 'x-foo'], _file => {
- expect(_file('addon/components/x-foo.js'))
+ it('component x-foo --pod', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--pod'], _file => {
+ expect(_file('app/components/x-foo/component.js'))
.to.contain("import Component from '@ember/component';")
- .to.contain("import layout from '../templates/components/x-foo';")
.to.contain("export default Component.extend({")
- .to.contain("layout")
.to.contain("});");
- expect(_file('addon/templates/components/x-foo.hbs'))
+ expect(_file('app/components/x-foo/template.hbs'))
.to.equal("{{yield}}");
- expect(_file('app/components/x-foo.js'))
- .to.contain("export { default } from 'my-addon/components/x-foo';");
-
- expect(_file('tests/integration/components/x-foo-test.js'))
+ expect(_file('tests/integration/components/x-foo/component-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
.to.contain("moduleForComponent('x-foo'")
- .to.contain("integration: true")
- .to.contain("{{x-foo}}")
- .to.contain("{{#x-foo}}");
- }));
- });
+ .to.contain("integration: true");
+ });
+ });
- it('in-addon component nested/x-foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['component', 'nested/x-foo'], _file => {
- expect(_file('addon/components/nested/x-foo.js'))
+ it('component foo/x-foo --pod', function() {
+ return emberGenerateDestroy(['component', 'foo/x-foo', '--pod'], _file => {
+ expect(_file('app/components/foo/x-foo/component.js'))
.to.contain("import Component from '@ember/component';")
- .to.contain("import layout from '../../templates/components/nested/x-foo';")
.to.contain("export default Component.extend({")
- .to.contain("layout")
.to.contain("});");
- expect(_file('addon/templates/components/nested/x-foo.hbs'))
+ expect(_file('app/components/foo/x-foo/template.hbs'))
.to.equal("{{yield}}");
- expect(_file('app/components/nested/x-foo.js'))
- .to.contain("export { default } from 'my-addon/components/nested/x-foo';");
-
- expect(_file('tests/integration/components/nested/x-foo-test.js'))
+ expect(_file('tests/integration/components/foo/x-foo/component-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('nested/x-foo'")
+ .to.contain("moduleForComponent('foo/x-foo'")
.to.contain("integration: true")
- .to.contain("{{nested/x-foo}}")
- .to.contain("{{#nested/x-foo}}");
- }));
- });
-
- it('dummy component x-foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--dummy'], _file => {
- expect(_file('tests/dummy/app/components/x-foo.js'))
- .to.contain("import Component from '@ember/component';")
- .to.contain("export default Component.extend({")
- .to.contain("});");
-
- expect(_file('tests/dummy/app/templates/components/x-foo.hbs'))
- .to.equal("{{yield}}");
-
- expect(_file('app/components/x-foo.js'))
- .to.not.exist;
-
- expect(_file('tests/unit/components/x-foo-test.js'))
- .to.not.exist;
- }));
- });
+ .to.contain("{{foo/x-foo}}")
+ .to.contain("{{#foo/x-foo}}");
+ });
+ });
- it('dummy component nested/x-foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['component', 'nested/x-foo', '--dummy'], _file => {
- expect(_file('tests/dummy/app/components/nested/x-foo.js'))
+ it('component x-foo --pod --path bar', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--pod', '--path', 'bar'], _file => {
+ expect(_file('app/bar/x-foo/component.js'))
.to.contain("import Component from '@ember/component';")
.to.contain("export default Component.extend({")
.to.contain("});");
- expect(_file('tests/dummy/app/templates/components/nested/x-foo.hbs'))
+ expect(_file('app/bar/x-foo/template.hbs'))
.to.equal("{{yield}}");
- expect(_file('app/components/nested/x-foo.js'))
- .to.not.exist;
-
- expect(_file('tests/unit/components/nested/x-foo-test.js'))
- .to.not.exist;
- }));
- });
+ expect(_file('tests/integration/bar/x-foo/component-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("import hbs from 'htmlbars-inline-precompile';")
+ .to.contain("moduleForComponent('bar/x-foo'")
+ .to.contain("integration: true")
+ .to.contain("{{bar/x-foo}}")
+ .to.contain("{{#bar/x-foo}}");
+ });
+ });
- it('in-repo-addon component x-foo', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--in-repo-addon=my-addon'], _file => {
- expect(_file('lib/my-addon/addon/components/x-foo.js'))
+ it('component foo/x-foo --pod --path bar', function() {
+ return emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '--path', 'bar'], _file => {
+ expect(_file('app/bar/foo/x-foo/component.js'))
.to.contain("import Component from '@ember/component';")
- .to.contain("import layout from '../templates/components/x-foo';")
.to.contain("export default Component.extend({")
- .to.contain("layout")
.to.contain("});");
- expect(_file('lib/my-addon/addon/templates/components/x-foo.hbs'))
+ expect(_file('app/bar/foo/x-foo/template.hbs'))
.to.equal("{{yield}}");
- expect(_file('lib/my-addon/app/components/x-foo.js'))
- .to.contain("export { default } from 'my-addon/components/x-foo';");
-
- expect(_file('tests/integration/components/x-foo-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('x-foo'")
- .to.contain("integration: true")
- .to.contain("{{x-foo}}")
- .to.contain("{{#x-foo}}");
- }));
- });
-
- it('in-repo-addon component-test x-foo', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['component-test', 'x-foo', '--in-repo-addon=my-addon'], _file => {
- expect(_file('tests/integration/components/x-foo-test.js'))
+ expect(_file('tests/integration/bar/foo/x-foo/component-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('x-foo'")
+ .to.contain("moduleForComponent('bar/foo/x-foo'")
.to.contain("integration: true")
- .to.contain("{{x-foo}}")
- .to.contain("{{#x-foo}}");
- }));
- });
-
- it('in-repo-addon component-test x-foo --unit', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['component-test', 'x-foo', '--in-repo-addon=my-addon', '--unit'], _file => {
- expect(_file('tests/unit/components/x-foo-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("moduleForComponent('x-foo'")
- .to.contain("unit: true");
- }));
- });
+ .to.contain("{{bar/foo/x-foo}}")
+ .to.contain("{{#bar/foo/x-foo}}");
+ });
+ });
- it('in-repo-addon component nested/x-foo', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['component', 'nested/x-foo', '--in-repo-addon=my-addon'], _file => {
- expect(_file('lib/my-addon/addon/components/nested/x-foo.js'))
+ it('component x-foo --pod --path bar/baz', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--pod', '--path', 'bar/baz'], _file => {
+ expect(_file('app/bar/baz/x-foo/component.js'))
.to.contain("import Component from '@ember/component';")
- .to.contain("import layout from '../../templates/components/nested/x-foo';")
.to.contain("export default Component.extend({")
- .to.contain("layout")
.to.contain("});");
- expect(_file('lib/my-addon/addon/templates/components/nested/x-foo.hbs'))
+ expect(_file('app/bar/baz/x-foo/template.hbs'))
.to.equal("{{yield}}");
- expect(_file('lib/my-addon/app/components/nested/x-foo.js'))
- .to.contain("export { default } from 'my-addon/components/nested/x-foo';");
-
- expect(_file('tests/integration/components/nested/x-foo-test.js'))
+ expect(_file('tests/integration/bar/baz/x-foo/component-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('nested/x-foo'")
- .to.contain("integration: true");
- }));
- });
+ .to.contain("moduleForComponent('bar/baz/x-foo'")
+ .to.contain("integration: true")
+ .to.contain("{{bar/baz/x-foo}}")
+ .to.contain("{{#bar/baz/x-foo}}");
+ });
+ });
- // Pod tests
- it('component x-foo --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--pod'], _file => {
- expect(_file('app/components/x-foo/component.js'))
+ it('component foo/x-foo --pod --path bar/baz', function() {
+ return emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '--path', 'bar/baz'], _file => {
+ expect(_file('app/bar/baz/foo/x-foo/component.js'))
.to.contain("import Component from '@ember/component';")
.to.contain("export default Component.extend({")
.to.contain("});");
- expect(_file('app/components/x-foo/template.hbs'))
+ expect(_file('app/bar/baz/foo/x-foo/template.hbs'))
.to.equal("{{yield}}");
- expect(_file('tests/integration/components/x-foo/component-test.js'))
+ expect(_file('tests/integration/bar/baz/foo/x-foo/component-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('x-foo'")
- .to.contain("integration: true");
- }));
- });
+ .to.contain("moduleForComponent('bar/baz/foo/x-foo'")
+ .to.contain("integration: true")
+ .to.contain("{{bar/baz/foo/x-foo}}")
+ .to.contain("{{#bar/baz/foo/x-foo}}");
+ });
+ });
- it('component x-foo --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--pod'], _file => {
- expect(_file('app/pods/components/x-foo/component.js'))
+ it('component x-foo --pod -no-path', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--pod', '-no-path'], _file => {
+ expect(_file('app/x-foo/component.js'))
.to.contain("import Component from '@ember/component';")
.to.contain("export default Component.extend({")
.to.contain("});");
- expect(_file('app/pods/components/x-foo/template.hbs'))
+ expect(_file('app/x-foo/template.hbs'))
.to.equal("{{yield}}");
- expect(_file('tests/integration/pods/components/x-foo/component-test.js'))
+ expect(_file('tests/integration/x-foo/component-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
.to.contain("moduleForComponent('x-foo'")
.to.contain("integration: true")
.to.contain("{{x-foo}}")
.to.contain("{{#x-foo}}");
- }));
- });
+ });
+ });
- it('component foo/x-foo --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component', 'foo/x-foo', '--pod'], _file => {
- expect(_file('app/components/foo/x-foo/component.js'))
+ it('component foo/x-foo --pod -no-path', function() {
+ return emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '-no-path'], _file => {
+ expect(_file('app/foo/x-foo/component.js'))
.to.contain("import Component from '@ember/component';")
.to.contain("export default Component.extend({")
.to.contain("});");
- expect(_file('app/components/foo/x-foo/template.hbs'))
+ expect(_file('app/foo/x-foo/template.hbs'))
.to.equal("{{yield}}");
- expect(_file('tests/integration/components/foo/x-foo/component-test.js'))
+ expect(_file('tests/integration/foo/x-foo/component-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
.to.contain("moduleForComponent('foo/x-foo'")
.to.contain("integration: true")
.to.contain("{{foo/x-foo}}")
.to.contain("{{#foo/x-foo}}");
- }));
- });
+ });
+ });
- it('component foo/x-foo --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['component', 'foo/x-foo', '--pod'], _file => {
- expect(_file('app/pods/components/foo/x-foo/component.js'))
- .to.contain("import Component from '@ember/component';")
- .to.contain("export default Component.extend({")
- .to.contain("});");
+ it('component-test x-foo', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo'], _file => {
+ expect(_file('tests/integration/components/x-foo-test.js'))
+ .to.equal(fixture('component-test/default.js'));
+ });
+ });
- expect(_file('app/pods/components/foo/x-foo/template.hbs'))
- .to.equal("{{yield}}");
+ it('component-test x-foo --unit', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo', '--unit'], _file => {
+ expect(_file('tests/unit/components/x-foo-test.js'))
+ .to.equal(fixture('component-test/unit.js'));
+ });
+ });
- expect(_file('tests/integration/pods/components/foo/x-foo/component-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('foo/x-foo'")
- .to.contain("integration: true")
- .to.contain("{{foo/x-foo}}")
- .to.contain("{{#foo/x-foo}}");
- }));
- });
+ describe('with podModulePrefix', function() {
+ beforeEach(function() {
+ setupPodConfig({ podModulePrefix: true });
+ });
- it('component x-foo --pod --path', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--pod', '--path', 'bar'], _file => {
- expect(_file('app/bar/x-foo/component.js'))
- .to.contain("import Component from '@ember/component';")
- .to.contain("export default Component.extend({")
- .to.contain("});");
+ it('component x-foo --pod', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--pod'], _file => {
+ expect(_file('app/pods/components/x-foo/component.js'))
+ .to.contain("import Component from '@ember/component';")
+ .to.contain("export default Component.extend({")
+ .to.contain("});");
- expect(_file('app/bar/x-foo/template.hbs'))
- .to.equal("{{yield}}");
+ expect(_file('app/pods/components/x-foo/template.hbs'))
+ .to.equal("{{yield}}");
- expect(_file('tests/integration/bar/x-foo/component-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('bar/x-foo'")
- .to.contain("integration: true")
- .to.contain("{{bar/x-foo}}")
- .to.contain("{{#bar/x-foo}}");
- }));
- });
+ expect(_file('tests/integration/pods/components/x-foo/component-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("import hbs from 'htmlbars-inline-precompile';")
+ .to.contain("moduleForComponent('x-foo'")
+ .to.contain("integration: true")
+ .to.contain("{{x-foo}}")
+ .to.contain("{{#x-foo}}");
+ });
+ });
- it('component x-foo --pod --path podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--pod', '--path', 'bar'], _file => {
- expect(_file('app/pods/bar/x-foo/component.js'))
- .to.contain("import Component from '@ember/component';")
- .to.contain("export default Component.extend({")
- .to.contain("});");
+ it('component foo/x-foo --pod', function() {
+ return emberGenerateDestroy(['component', 'foo/x-foo', '--pod'], _file => {
+ expect(_file('app/pods/components/foo/x-foo/component.js'))
+ .to.contain("import Component from '@ember/component';")
+ .to.contain("export default Component.extend({")
+ .to.contain("});");
- expect(_file('app/pods/bar/x-foo/template.hbs'))
- .to.equal("{{yield}}");
+ expect(_file('app/pods/components/foo/x-foo/template.hbs'))
+ .to.equal("{{yield}}");
- expect(_file('tests/integration/pods/bar/x-foo/component-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('bar/x-foo'")
- .to.contain("integration: true")
- .to.contain("{{bar/x-foo}}")
- .to.contain("{{#bar/x-foo}}");
- }));
- });
+ expect(_file('tests/integration/pods/components/foo/x-foo/component-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("import hbs from 'htmlbars-inline-precompile';")
+ .to.contain("moduleForComponent('foo/x-foo'")
+ .to.contain("integration: true")
+ .to.contain("{{foo/x-foo}}")
+ .to.contain("{{#foo/x-foo}}");
+ });
+ });
+
+ it('component x-foo --pod --path bar', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--pod', '--path', 'bar'], _file => {
+ expect(_file('app/pods/bar/x-foo/component.js'))
+ .to.contain("import Component from '@ember/component';")
+ .to.contain("export default Component.extend({")
+ .to.contain("});");
+
+ expect(_file('app/pods/bar/x-foo/template.hbs'))
+ .to.equal("{{yield}}");
+
+ expect(_file('tests/integration/pods/bar/x-foo/component-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("import hbs from 'htmlbars-inline-precompile';")
+ .to.contain("moduleForComponent('bar/x-foo'")
+ .to.contain("integration: true")
+ .to.contain("{{bar/x-foo}}")
+ .to.contain("{{#bar/x-foo}}");
+ });
+ });
+
+ it('component foo/x-foo --pod --path bar', function() {
+ return emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '--path', 'bar'], _file => {
+ expect(_file('app/pods/bar/foo/x-foo/component.js'))
+ .to.contain("import Component from '@ember/component';")
+ .to.contain("export default Component.extend({")
+ .to.contain("});");
+
+ expect(_file('app/pods/bar/foo/x-foo/template.hbs'))
+ .to.equal("{{yield}}");
+
+ expect(_file('tests/integration/pods/bar/foo/x-foo/component-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("moduleForComponent('bar/foo/x-foo'")
+ .to.contain("integration: true")
+ .to.contain("{{bar/foo/x-foo}}")
+ .to.contain("{{#bar/foo/x-foo}}");
+ });
+ });
+
+ it('component x-foo --pod --path bar/baz', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--pod', '--path', 'bar/baz'], _file => {
+ expect(_file('app/pods/bar/baz/x-foo/component.js'))
+ .to.contain("import Component from '@ember/component';")
+ .to.contain("export default Component.extend({")
+ .to.contain("});");
+
+ expect(_file('app/pods/bar/baz/x-foo/template.hbs'))
+ .to.equal("{{yield}}");
+
+ expect(_file('tests/integration/pods/bar/baz/x-foo/component-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("import hbs from 'htmlbars-inline-precompile';")
+ .to.contain("moduleForComponent('bar/baz/x-foo'")
+ .to.contain("integration: true")
+ .to.contain("{{bar/baz/x-foo}}")
+ .to.contain("{{#bar/baz/x-foo}}");
+ });
+ });
+
+ it('component foo/x-foo --pod --path bar/baz', function() {
+ return emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '--path', 'bar/baz'], _file => {
+ expect(_file('app/pods/bar/baz/foo/x-foo/component.js'))
+ .to.contain("import Component from '@ember/component';")
+ .to.contain("export default Component.extend({")
+ .to.contain("});");
+
+ expect(_file('app/pods/bar/baz/foo/x-foo/template.hbs'))
+ .to.equal("{{yield}}");
+
+ expect(_file('tests/integration/pods/bar/baz/foo/x-foo/component-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("import hbs from 'htmlbars-inline-precompile';")
+ .to.contain("moduleForComponent('bar/baz/foo/x-foo'")
+ .to.contain("integration: true")
+ .to.contain("{{bar/baz/foo/x-foo}}")
+ .to.contain("{{#bar/baz/foo/x-foo}}");
+ });
+ });
+
+ it('component x-foo --pod -no-path', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--pod', '-no-path'], _file => {
+ expect(_file('app/pods/x-foo/component.js'))
+ .to.contain("import Component from '@ember/component';")
+ .to.contain("export default Component.extend({")
+ .to.contain("});");
+
+ expect(_file('app/pods/x-foo/template.hbs'))
+ .to.equal("{{yield}}");
+
+ expect(_file('tests/integration/pods/x-foo/component-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("import hbs from 'htmlbars-inline-precompile';")
+ .to.contain("moduleForComponent('x-foo'")
+ .to.contain("integration: true")
+ .to.contain("{{x-foo}}")
+ .to.contain("{{#x-foo}}");
+ });
+ });
- it('component foo/x-foo --pod --path', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '--path', 'bar'], _file => {
- expect(_file('app/bar/foo/x-foo/component.js'))
- .to.contain("import Component from '@ember/component';")
- .to.contain("export default Component.extend({")
- .to.contain("});");
+ it('component foo/x-foo --pod -no-path', function() {
+ return emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '-no-path'], _file => {
+ expect(_file('app/pods/foo/x-foo/component.js'))
+ .to.contain("import Component from '@ember/component';")
+ .to.contain("export default Component.extend({")
+ .to.contain("});");
- expect(_file('app/bar/foo/x-foo/template.hbs'))
- .to.equal("{{yield}}");
+ expect(_file('app/pods/foo/x-foo/template.hbs'))
+ .to.equal("{{yield}}");
- expect(_file('tests/integration/bar/foo/x-foo/component-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('bar/foo/x-foo'")
- .to.contain("integration: true")
- .to.contain("{{bar/foo/x-foo}}")
- .to.contain("{{#bar/foo/x-foo}}");
- }));
- });
+ expect(_file('tests/integration/pods/foo/x-foo/component-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("import hbs from 'htmlbars-inline-precompile';")
+ .to.contain("moduleForComponent('foo/x-foo'")
+ .to.contain("integration: true")
+ .to.contain("{{foo/x-foo}}")
+ .to.contain("{{#foo/x-foo}}");
+ });
+ });
+ });
- it('component foo/x-foo --pod --path podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '--path', 'bar'], _file => {
- expect(_file('app/pods/bar/foo/x-foo/component.js'))
- .to.contain("import Component from '@ember/component';")
- .to.contain("export default Component.extend({")
- .to.contain("});");
+ describe('with usePods=true', function() {
+ beforeEach(function() {
+ fs.writeFileSync('.ember-cli', `{
+ "disableAnalytics": false,
+ "usePods": true
+ }`);
+ });
- expect(_file('app/pods/bar/foo/x-foo/template.hbs'))
- .to.equal("{{yield}}");
+ it('component-test x-foo', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo'], _file => {
+ expect(_file('tests/integration/components/x-foo/component-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("import hbs from 'htmlbars-inline-precompile';")
+ .to.contain("moduleForComponent('x-foo'")
+ .to.contain("integration: true")
+ .to.contain("{{x-foo}}")
+ .to.contain("{{#x-foo}}");
+ });
+ });
+ });
- expect(_file('tests/integration/pods/bar/foo/x-foo/component-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("moduleForComponent('bar/foo/x-foo'")
- .to.contain("integration: true")
- .to.contain("{{bar/foo/x-foo}}")
- .to.contain("{{#bar/foo/x-foo}}");
- }));
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ generateFakePackageManifest('ember-cli-qunit', '4.1.1');
+ });
+
+ it('component-test x-foo', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo'], _file => {
+ expect(_file('tests/integration/components/x-foo-test.js'))
+ .to.equal(fixture('component-test/rfc232.js'));
+ });
+ });
+
+ it('component-test x-foo --unit', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo', '--unit'], _file => {
+ expect(_file('tests/unit/components/x-foo-test.js'))
+ .to.equal(fixture('component-test/rfc232-unit.js'));
+ });
+ });
+ });
+
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ generateFakePackageManifest('ember-cli-mocha', '0.11.0');
+ });
+
+ it('component-test x-foo', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo'], _file => {
+ expect(_file('tests/integration/components/x-foo-test.js'))
+ .to.equal(fixture('component-test/mocha.js'));
+ });
+ });
+
+ it('component-test x-foo --unit', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo', '--unit'], _file => {
+ expect(_file('tests/unit/components/x-foo-test.js'))
+ .to.equal(fixture('component-test/mocha-unit.js'));
+ });
+ });
+ });
+
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ generateFakePackageManifest('ember-cli-mocha', '0.12.0');
+ });
+
+ it('component-test x-foo', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo'], _file => {
+ expect(_file('tests/integration/components/x-foo-test.js'))
+ .to.equal(fixture('component-test/mocha-0.12.js'));
+ });
+ });
+
+ it('component-test x-foo --unit', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo', '--unit'], _file => {
+ expect(_file('tests/unit/components/x-foo-test.js'))
+ .to.equal(fixture('component-test/mocha-0.12-unit.js'));
+ });
+ });
+ });
});
- it('component x-foo --pod --path nested', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--pod', '--path', 'bar/baz'], _file => {
- expect(_file('app/bar/baz/x-foo/component.js'))
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('component x-foo', function() {
+ return emberGenerateDestroy(['component', 'x-foo'], _file => {
+ expect(_file('addon/components/x-foo.js'))
.to.contain("import Component from '@ember/component';")
+ .to.contain("import layout from '../templates/components/x-foo';")
.to.contain("export default Component.extend({")
+ .to.contain("layout")
.to.contain("});");
- expect(_file('app/bar/baz/x-foo/template.hbs'))
+ expect(_file('addon/templates/components/x-foo.hbs'))
.to.equal("{{yield}}");
- expect(_file('tests/integration/bar/baz/x-foo/component-test.js'))
+ expect(_file('app/components/x-foo.js'))
+ .to.contain("export { default } from 'my-addon/components/x-foo';");
+
+ expect(_file('tests/integration/components/x-foo-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('bar/baz/x-foo'")
+ .to.contain("moduleForComponent('x-foo'")
.to.contain("integration: true")
- .to.contain("{{bar/baz/x-foo}}")
- .to.contain("{{#bar/baz/x-foo}}");
- }));
- });
+ .to.contain("{{x-foo}}")
+ .to.contain("{{#x-foo}}");
+ });
+ });
- it('component x-foo --pod --path nested podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--pod', '--path', 'bar/baz'], _file => {
- expect(_file('app/pods/bar/baz/x-foo/component.js'))
+ it('component nested/x-foo', function() {
+ return emberGenerateDestroy(['component', 'nested/x-foo'], _file => {
+ expect(_file('addon/components/nested/x-foo.js'))
.to.contain("import Component from '@ember/component';")
+ .to.contain("import layout from '../../templates/components/nested/x-foo';")
.to.contain("export default Component.extend({")
+ .to.contain("layout")
.to.contain("});");
- expect(_file('app/pods/bar/baz/x-foo/template.hbs'))
+ expect(_file('addon/templates/components/nested/x-foo.hbs'))
.to.equal("{{yield}}");
- expect(_file('tests/integration/pods/bar/baz/x-foo/component-test.js'))
+ expect(_file('app/components/nested/x-foo.js'))
+ .to.contain("export { default } from 'my-addon/components/nested/x-foo';");
+
+ expect(_file('tests/integration/components/nested/x-foo-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('bar/baz/x-foo'")
+ .to.contain("moduleForComponent('nested/x-foo'")
.to.contain("integration: true")
- .to.contain("{{bar/baz/x-foo}}")
- .to.contain("{{#bar/baz/x-foo}}");
- }));
- });
+ .to.contain("{{nested/x-foo}}")
+ .to.contain("{{#nested/x-foo}}");
+ });
+ });
- it('component foo/x-foo --pod --path nested', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '--path', 'bar/baz'], _file => {
- expect(_file('app/bar/baz/foo/x-foo/component.js'))
+ it('component x-foo --dummy', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--dummy'], _file => {
+ expect(_file('tests/dummy/app/components/x-foo.js'))
.to.contain("import Component from '@ember/component';")
.to.contain("export default Component.extend({")
.to.contain("});");
- expect(_file('app/bar/baz/foo/x-foo/template.hbs'))
+ expect(_file('tests/dummy/app/templates/components/x-foo.hbs'))
.to.equal("{{yield}}");
- expect(_file('tests/integration/bar/baz/foo/x-foo/component-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('bar/baz/foo/x-foo'")
- .to.contain("integration: true")
- .to.contain("{{bar/baz/foo/x-foo}}")
- .to.contain("{{#bar/baz/foo/x-foo}}");
- }));
- });
+ expect(_file('app/components/x-foo.js'))
+ .to.not.exist;
- it('component foo/x-foo --pod --path nested podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '--path', 'bar/baz'], _file => {
- expect(_file('app/pods/bar/baz/foo/x-foo/component.js'))
+ expect(_file('tests/unit/components/x-foo-test.js'))
+ .to.not.exist;
+ });
+ });
+
+ it('component nested/x-foo --dummy', function() {
+ return emberGenerateDestroy(['component', 'nested/x-foo', '--dummy'], _file => {
+ expect(_file('tests/dummy/app/components/nested/x-foo.js'))
.to.contain("import Component from '@ember/component';")
.to.contain("export default Component.extend({")
.to.contain("});");
- expect(_file('app/pods/bar/baz/foo/x-foo/template.hbs'))
+ expect(_file('tests/dummy/app/templates/components/nested/x-foo.hbs'))
.to.equal("{{yield}}");
- expect(_file('tests/integration/pods/bar/baz/foo/x-foo/component-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('bar/baz/foo/x-foo'")
- .to.contain("integration: true")
- .to.contain("{{bar/baz/foo/x-foo}}")
- .to.contain("{{#bar/baz/foo/x-foo}}");
- }));
- });
+ expect(_file('app/components/nested/x-foo.js'))
+ .to.not.exist;
- it('component x-foo --pod -no-path', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--pod', '-no-path'], _file => {
- expect(_file('app/x-foo/component.js'))
+ expect(_file('tests/unit/components/nested/x-foo-test.js'))
+ .to.not.exist;
+ });
+ });
+
+ it('component x-foo --pod', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--pod'], _file => {
+ expect(_file('addon/components/x-foo/component.js'))
.to.contain("import Component from '@ember/component';")
+ .to.contain("import layout from './template';")
.to.contain("export default Component.extend({")
+ .to.contain("layout")
.to.contain("});");
- expect(_file('app/x-foo/template.hbs'))
+ expect(_file('addon/components/x-foo/template.hbs'))
.to.equal("{{yield}}");
- expect(_file('tests/integration/x-foo/component-test.js'))
+ expect(_file('app/components/x-foo/component.js'))
+ .to.contain("export { default } from 'my-addon/components/x-foo/component';");
+
+ expect(_file('tests/integration/components/x-foo/component-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("moduleForComponent('x-foo'")
+ .to.contain("integration: true");
+ });
+ });
+
+ it('component-test x-foo', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo'], _file => {
+ expect(_file('tests/integration/components/x-foo-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
.to.contain("moduleForComponent('x-foo'")
.to.contain("integration: true")
.to.contain("{{x-foo}}")
.to.contain("{{#x-foo}}");
- }));
- });
- it('component x-foo --pod -no-path podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--pod', '-no-path'], _file => {
- expect(_file('app/pods/x-foo/component.js'))
- .to.contain("import Component from '@ember/component';")
- .to.contain("export default Component.extend({")
- .to.contain("});");
+ expect(_file('app/component-test/x-foo.js'))
+ .to.not.exist;
+ });
+ });
- expect(_file('app/pods/x-foo/template.hbs'))
- .to.equal("{{yield}}");
+ it('component-test x-foo --unit', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo', '--unit'], _file => {
+ expect(_file('tests/unit/components/x-foo-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("moduleForComponent('x-foo'")
+ .to.contain("unit: true");
- expect(_file('tests/integration/pods/x-foo/component-test.js'))
+ expect(_file('app/component-test/x-foo.js'))
+ .to.not.exist;
+ });
+ });
+
+ it('component-test x-foo --dummy', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo', '--dummy'], _file => {
+ expect(_file('tests/integration/components/x-foo-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('x-foo'")
- .to.contain("integration: true")
- .to.contain("{{x-foo}}")
- .to.contain("{{#x-foo}}");
- }));
+ .to.contain("moduleForComponent('x-foo'");
+
+ expect(_file('app/component-test/x-foo.js'))
+ .to.not.exist;
+ });
+ });
});
- it('component foo/x-foo --pod -no-path', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '-no-path'], _file => {
- expect(_file('app/foo/x-foo/component.js'))
+ describe('in in-repo-addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'in-repo-addon' });
+ });
+
+ it('component x-foo --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--in-repo-addon=my-addon'], _file => {
+ expect(_file('lib/my-addon/addon/components/x-foo.js'))
.to.contain("import Component from '@ember/component';")
+ .to.contain("import layout from '../templates/components/x-foo';")
.to.contain("export default Component.extend({")
+ .to.contain("layout")
.to.contain("});");
- expect(_file('app/foo/x-foo/template.hbs'))
+ expect(_file('lib/my-addon/addon/templates/components/x-foo.hbs'))
.to.equal("{{yield}}");
- expect(_file('tests/integration/foo/x-foo/component-test.js'))
+ expect(_file('lib/my-addon/app/components/x-foo.js'))
+ .to.contain("export { default } from 'my-addon/components/x-foo';");
+
+ expect(_file('tests/integration/components/x-foo-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('foo/x-foo'")
+ .to.contain("moduleForComponent('x-foo'")
.to.contain("integration: true")
- .to.contain("{{foo/x-foo}}")
- .to.contain("{{#foo/x-foo}}");
- }));
- });
-
- it('component foo/x-foo --pod -no-path podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '-no-path'], _file => {
- expect(_file('app/pods/foo/x-foo/component.js'))
- .to.contain("import Component from '@ember/component';")
- .to.contain("export default Component.extend({")
- .to.contain("});");
-
- expect(_file('app/pods/foo/x-foo/template.hbs'))
- .to.equal("{{yield}}");
+ .to.contain("{{x-foo}}")
+ .to.contain("{{#x-foo}}");
+ });
+ });
- expect(_file('tests/integration/pods/foo/x-foo/component-test.js'))
+ it('component-test x-foo --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo', '--in-repo-addon=my-addon'], _file => {
+ expect(_file('tests/integration/components/x-foo-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('foo/x-foo'")
+ .to.contain("moduleForComponent('x-foo'")
.to.contain("integration: true")
- .to.contain("{{foo/x-foo}}")
- .to.contain("{{#foo/x-foo}}");
- }));
- });
+ .to.contain("{{x-foo}}")
+ .to.contain("{{#x-foo}}");
+ });
+ });
- it('in-addon component x-foo --pod', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--pod'], _file => {
- expect(_file('addon/components/x-foo/component.js'))
+ it('component-test x-foo --in-repo-addon=my-addon --unit', function() {
+ return emberGenerateDestroy(['component-test', 'x-foo', '--in-repo-addon=my-addon', '--unit'], _file => {
+ expect(_file('tests/unit/components/x-foo-test.js'))
+ .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
+ .to.contain("moduleForComponent('x-foo'")
+ .to.contain("unit: true");
+ });
+ });
+
+ it('component nested/x-foo --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['component', 'nested/x-foo', '--in-repo-addon=my-addon'], _file => {
+ expect(_file('lib/my-addon/addon/components/nested/x-foo.js'))
.to.contain("import Component from '@ember/component';")
- .to.contain("import layout from './template';")
+ .to.contain("import layout from '../../templates/components/nested/x-foo';")
.to.contain("export default Component.extend({")
.to.contain("layout")
.to.contain("});");
- expect(_file('addon/components/x-foo/template.hbs'))
+ expect(_file('lib/my-addon/addon/templates/components/nested/x-foo.hbs'))
.to.equal("{{yield}}");
- expect(_file('app/components/x-foo/component.js'))
- .to.contain("export { default } from 'my-addon/components/x-foo/component';");
+ expect(_file('lib/my-addon/app/components/nested/x-foo.js'))
+ .to.contain("export { default } from 'my-addon/components/nested/x-foo';");
- expect(_file('tests/integration/components/x-foo/component-test.js'))
+ expect(_file('tests/integration/components/nested/x-foo-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("moduleForComponent('x-foo'")
+ .to.contain("import hbs from 'htmlbars-inline-precompile';")
+ .to.contain("moduleForComponent('nested/x-foo'")
.to.contain("integration: true");
- }));
- });
+ });
+ });
- it('in-repo-addon component x-foo --pod', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['component', 'x-foo', '--in-repo-addon=my-addon', '--pod'], _file => {
+ it('component x-foo --in-repo-addon=my-addon --pod', function() {
+ return emberGenerateDestroy(['component', 'x-foo', '--in-repo-addon=my-addon', '--pod'], _file => {
expect(_file('lib/my-addon/addon/components/x-foo/component.js'))
.to.contain("import Component from '@ember/component';")
.to.contain("import layout from './template';")
@@ -628,12 +755,11 @@ describe('Blueprint: component', function() {
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("moduleForComponent('x-foo'")
.to.contain("integration: true");
- }));
- });
+ });
+ });
- it('in-repo-addon component nested/x-foo', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['component', 'nested/x-foo', '--in-repo-addon=my-addon', '--pod'], _file => {
+ it('component nested/x-foo --in-repo-addon=my-addon --pod', function() {
+ return emberGenerateDestroy(['component', 'nested/x-foo', '--in-repo-addon=my-addon', '--pod'], _file => {
expect(_file('lib/my-addon/addon/components/nested/x-foo/component.js'))
.to.contain("import Component from '@ember/component';")
.to.contain("import layout from './template';")
@@ -651,155 +777,7 @@ describe('Blueprint: component', function() {
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("moduleForComponent('nested/x-foo'")
.to.contain("integration: true");
- }));
- });
-
- it('component-test x-foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component-test', 'x-foo'], _file => {
- expect(_file('tests/integration/components/x-foo-test.js'))
- .to.equal(fixture('component-test/default.js'));
- }));
- });
-
- describe('usePods: true', function() {
- it('component-test x-foo', function() {
- return emberNew()
- .then(() => {
- fs.writeFileSync('.ember-cli', `{
- "disableAnalytics": false,
- "usePods": true
- }`);
- })
- .then(() => emberGenerateDestroy(['component-test', 'x-foo'], _file => {
- expect(_file('tests/integration/components/x-foo/component-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('x-foo'")
- .to.contain("integration: true")
- .to.contain("{{x-foo}}")
- .to.contain("{{#x-foo}}");
- }));
+ });
});
});
-
- it('component-test x-foo --unit', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['component-test', 'x-foo', '--unit'], _file => {
- expect(_file('tests/unit/components/x-foo-test.js'))
- .to.equal(fixture('component-test/unit.js'));
- }));
- });
-
- it('in-addon component-test x-foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['component-test', 'x-foo'], _file => {
- expect(_file('tests/integration/components/x-foo-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('x-foo'")
- .to.contain("integration: true")
- .to.contain("{{x-foo}}")
- .to.contain("{{#x-foo}}");
-
- expect(_file('app/component-test/x-foo.js'))
- .to.not.exist;
- }));
- });
-
- it('in-addon component-test x-foo --unit', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['component-test', 'x-foo', '--unit'], _file => {
- expect(_file('tests/unit/components/x-foo-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("moduleForComponent('x-foo'")
- .to.contain("unit: true");
-
- expect(_file('app/component-test/x-foo.js'))
- .to.not.exist;
- }));
- });
-
- it('dummy component-test x-foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['component-test', 'x-foo', '--dummy'], _file => {
- expect(_file('tests/integration/components/x-foo-test.js'))
- .to.contain("import { moduleForComponent, test } from 'ember-qunit';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("moduleForComponent('x-foo'");
-
- expect(_file('app/component-test/x-foo.js'))
- .to.not.exist;
- }));
- });
-
- it('component-test x-foo for RFC232', function() {
- return emberNew()
- .then(() => generateFakePackageManifest('ember-cli-qunit', '4.1.1'))
- .then(() => emberGenerateDestroy(['component-test', 'x-foo'], _file => {
- expect(_file('tests/integration/components/x-foo-test.js'))
- .to.equal(fixture('component-test/rfc232.js'));
- }));
- });
-
- it('component-test x-foo --unit for RFC232', function() {
- return emberNew()
- .then(() => generateFakePackageManifest('ember-cli-qunit', '4.1.1'))
- .then(() => emberGenerateDestroy(['component-test', 'x-foo', '--unit'], _file => {
- expect(_file('tests/unit/components/x-foo-test.js'))
- .to.equal(fixture('component-test/rfc232-unit.js'));
- }));
- });
-
- it('component-test x-foo for mocha', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.11.0'))
- .then(() => emberGenerateDestroy(['component-test', 'x-foo'], _file => {
- expect(_file('tests/integration/components/x-foo-test.js'))
- .to.equal(fixture('component-test/mocha.js'));
- }));
- });
-
- it('component-test x-foo --unit for mocha', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.11.0'))
- .then(() => emberGenerateDestroy(['component-test', 'x-foo', '--unit'], _file => {
- expect(_file('tests/unit/components/x-foo-test.js'))
- .to.equal(fixture('component-test/mocha-unit.js'));
- }));
- });
-
- it('component-test x-foo for mocha v0.12+', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.12.0'))
- .then(() => emberGenerateDestroy(['component-test', 'x-foo'], _file => {
- expect(_file('tests/integration/components/x-foo-test.js'))
- .to.equal(fixture('component-test/mocha-0.12.js'));
- }));
- });
-
- it('component-test x-foo --unit for mocha v0.12+', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.12.0'))
- .then(() => emberGenerateDestroy(['component-test', 'x-foo', '--unit'], _file => {
- expect(_file('tests/unit/components/x-foo-test.js'))
- .to.equal(fixture('component-test/mocha-0.12-unit.js'));
- }));
- });
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/controller-test.js
|
@@ -15,35 +15,143 @@ const generateFakePackageManifest = require('../helpers/generate-fake-package-ma
describe('Blueprint: controller', function() {
setupTestHooks(this);
- it('controller foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['controller', 'foo'], _file => {
+ describe('in app', function() {
+ beforeEach(function() {
+ return emberNew();
+ });
+
+ it('controller foo', function() {
+ return emberGenerateDestroy(['controller', 'foo'], _file => {
expect(_file('app/controllers/foo.js'))
.to.contain("import Controller from '@ember/controller';")
.to.contain("export default Controller.extend({\n});");
expect(_file('tests/unit/controllers/foo-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('controller:foo'");
- }));
- });
+ });
+ });
- it('controller foo/bar', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['controller', 'foo/bar'], _file => {
+ it('controller foo/bar', function() {
+ return emberGenerateDestroy(['controller', 'foo/bar'], _file => {
expect(_file('app/controllers/foo/bar.js'))
.to.contain("import Controller from '@ember/controller';")
.to.contain("export default Controller.extend({\n});");
expect(_file('tests/unit/controllers/foo/bar-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('controller:foo/bar'");
- }));
- });
+ });
+ });
+
+ it('controller foo --pod', function() {
+ return emberGenerateDestroy(['controller', 'foo', '--pod'], _file => {
+ expect(_file('app/foo/controller.js'))
+ .to.contain("import Controller from '@ember/controller';")
+ .to.contain("export default Controller.extend({\n});");
+
+ expect(_file('tests/unit/foo/controller-test.js'))
+ .to.contain("import { moduleFor, test } from 'ember-qunit';")
+ .to.contain("moduleFor('controller:foo'");
+ });
+ });
+
+ it('controller foo/bar --pod', function() {
+ return emberGenerateDestroy(['controller', 'foo/bar', '--pod'], _file => {
+ expect(_file('app/foo/bar/controller.js'))
+ .to.contain("import Controller from '@ember/controller';")
+ .to.contain("export default Controller.extend({\n});");
- it('in-addon controller foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['controller', 'foo'], _file => {
+ expect(_file('tests/unit/foo/bar/controller-test.js'))
+ .to.contain("import { moduleFor, test } from 'ember-qunit';")
+ .to.contain("moduleFor('controller:foo/bar'");
+ });
+ });
+
+ it('controller-test foo', function() {
+ return emberGenerateDestroy(['controller-test', 'foo'], _file => {
+ expect(_file('tests/unit/controllers/foo-test.js'))
+ .to.contain("import { moduleFor, test } from 'ember-qunit';")
+ .to.contain("moduleFor('controller:foo'");
+ });
+ });
+
+ describe('with podModulePrefix', function() {
+ beforeEach(function() {
+ setupPodConfig({ podModulePrefix: true });
+ });
+
+ it('controller foo --pod podModulePrefix', function() {
+ return emberGenerateDestroy(['controller', 'foo', '--pod'], _file => {
+ expect(_file('app/pods/foo/controller.js'))
+ .to.contain("import Controller from '@ember/controller';")
+ .to.contain("export default Controller.extend({\n});");
+
+ expect(_file('tests/unit/pods/foo/controller-test.js'))
+ .to.contain("import { moduleFor, test } from 'ember-qunit';")
+ .to.contain("moduleFor('controller:foo'");
+ });
+ });
+
+ it('controller foo/bar --pod podModulePrefix', function() {
+ return emberGenerateDestroy(['controller', 'foo/bar', '--pod'], _file => {
+ expect(_file('app/pods/foo/bar/controller.js'))
+ .to.contain("import Controller from '@ember/controller';")
+ .to.contain("export default Controller.extend({\n});");
+
+ expect(_file('tests/unit/pods/foo/bar/controller-test.js'))
+ .to.contain("import { moduleFor, test } from 'ember-qunit';")
+ .to.contain("moduleFor('controller:foo/bar'");
+ });
+ });
+ });
+
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ generateFakePackageManifest('ember-cli-mocha', '0.11.0');
+ });
+
+ it('controller-test foo for mocha', function() {
+ return emberGenerateDestroy(['controller-test', 'foo'], _file => {
+ expect(_file('tests/unit/controllers/foo-test.js'))
+ .to.contain("import { describeModule, it } from 'ember-mocha';")
+ .to.contain("describeModule('controller:foo', 'Unit | Controller | foo'");
+ });
+ });
+ });
+
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ generateFakePackageManifest('ember-cli-mocha', '0.12.0');
+ });
+
+ it('controller-test foo', function() {
+ return emberGenerateDestroy(['controller-test', 'foo'], _file => {
+ expect(_file('tests/unit/controllers/foo-test.js'))
+ .to.contain("import { describe, it } from 'mocha';")
+ .to.contain("import { setupTest } from 'ember-mocha';")
+ .to.contain("describe('Unit | Controller | foo'")
+ .to.contain("setupTest('controller:foo',");
+ });
+ });
+ });
+ });
+
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('controller foo', function() {
+ return emberGenerateDestroy(['controller', 'foo'], _file => {
expect(_file('addon/controllers/foo.js'))
.to.contain("import Controller from '@ember/controller';")
.to.contain("export default Controller.extend({\n});");
@@ -54,12 +162,11 @@ describe('Blueprint: controller', function() {
expect(_file('tests/unit/controllers/foo-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('controller:foo'");
- }));
- });
+ });
+ });
- it('in-addon controller foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['controller', 'foo/bar'], _file => {
+ it('controller foo/bar', function() {
+ return emberGenerateDestroy(['controller', 'foo/bar'], _file => {
expect(_file('addon/controllers/foo/bar.js'))
.to.contain("import Controller from '@ember/controller';")
.to.contain("export default Controller.extend({\n});");
@@ -70,12 +177,11 @@ describe('Blueprint: controller', function() {
expect(_file('tests/unit/controllers/foo/bar-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('controller:foo/bar'");
- }));
- });
+ });
+ });
- it('dummy controller foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['controller', 'foo', '--dummy'], _file => {
+ it('controller foo --dummy', function() {
+ return emberGenerateDestroy(['controller', 'foo', '--dummy'], _file => {
expect(_file('tests/dummy/app/controllers/foo.js'))
.to.contain("import Controller from '@ember/controller';")
.to.contain("export default Controller.extend({\n});");
@@ -85,12 +191,11 @@ describe('Blueprint: controller', function() {
expect(_file('tests/unit/controllers/foo-test.js'))
.to.not.exist;
- }));
- });
+ });
+ });
- it('dummy controller foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['controller', 'foo/bar', '--dummy'], _file => {
+ it('controller foo/bar --dummy', function() {
+ return emberGenerateDestroy(['controller', 'foo/bar', '--dummy'], _file => {
expect(_file('tests/dummy/app/controllers/foo/bar.js'))
.to.contain("import Controller from '@ember/controller';")
.to.contain("export default Controller.extend({\n});");
@@ -100,12 +205,25 @@ describe('Blueprint: controller', function() {
expect(_file('tests/unit/controllers/foo/bar-test.js'))
.to.not.exist;
- }));
+ });
+ });
+
+ it('controller-test foo', function() {
+ return emberGenerateDestroy(['controller-test', 'foo'], _file => {
+ expect(_file('tests/unit/controllers/foo-test.js'))
+ .to.contain("import { moduleFor, test } from 'ember-qunit';")
+ .to.contain("moduleFor('controller:foo'");
+ });
+ });
});
- it('in-repo-addon controller foo', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['controller', 'foo', '--in-repo-addon=my-addon'], _file => {
+ describe('in in-repo-addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'in-repo-addon' });
+ });
+
+ it('controller foo --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['controller', 'foo', '--in-repo-addon=my-addon'], _file => {
expect(_file('lib/my-addon/addon/controllers/foo.js'))
.to.contain("import Controller from '@ember/controller';")
.to.contain("export default Controller.extend({\n});");
@@ -116,12 +234,11 @@ describe('Blueprint: controller', function() {
expect(_file('tests/unit/controllers/foo-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('controller:foo'");
- }));
- });
+ });
+ });
- it('in-repo-addon controller foo/bar', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['controller', 'foo/bar', '--in-repo-addon=my-addon'], _file => {
+ it('controller foo/bar --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['controller', 'foo/bar', '--in-repo-addon=my-addon'], _file => {
expect(_file('lib/my-addon/addon/controllers/foo/bar.js'))
.to.contain("import Controller from '@ember/controller';")
.to.contain("export default Controller.extend({\n});");
@@ -132,108 +249,7 @@ describe('Blueprint: controller', function() {
expect(_file('tests/unit/controllers/foo/bar-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('controller:foo/bar'");
- }));
- });
-
- it('controller foo --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['controller', 'foo', '--pod'], _file => {
- expect(_file('app/foo/controller.js'))
- .to.contain("import Controller from '@ember/controller';")
- .to.contain("export default Controller.extend({\n});");
-
- expect(_file('tests/unit/foo/controller-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('controller:foo'");
- }));
- });
-
- it('controller foo --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['controller', 'foo', '--pod'], _file => {
- expect(_file('app/pods/foo/controller.js'))
- .to.contain("import Controller from '@ember/controller';")
- .to.contain("export default Controller.extend({\n});");
-
- expect(_file('tests/unit/pods/foo/controller-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('controller:foo'");
- }));
- });
-
- it('controller foo/bar --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['controller', 'foo/bar', '--pod'], _file => {
- expect(_file('app/foo/bar/controller.js'))
- .to.contain("import Controller from '@ember/controller';")
- .to.contain("export default Controller.extend({\n});");
-
- expect(_file('tests/unit/foo/bar/controller-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('controller:foo/bar'");
- }));
- });
-
- it('controller foo/bar --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['controller', 'foo/bar', '--pod'], _file => {
- expect(_file('app/pods/foo/bar/controller.js'))
- .to.contain("import Controller from '@ember/controller';")
- .to.contain("export default Controller.extend({\n});");
-
- expect(_file('tests/unit/pods/foo/bar/controller-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('controller:foo/bar'");
- }));
- });
-
- it('controller-test foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['controller-test', 'foo'], _file => {
- expect(_file('tests/unit/controllers/foo-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('controller:foo'");
- }));
- });
-
- it('in-addon controller-test foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['controller-test', 'foo'], _file => {
- expect(_file('tests/unit/controllers/foo-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('controller:foo'");
- }));
- });
-
- it('controller-test foo for mocha', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.11.0'))
- .then(() => emberGenerateDestroy(['controller-test', 'foo'], _file => {
- expect(_file('tests/unit/controllers/foo-test.js'))
- .to.contain("import { describeModule, it } from 'ember-mocha';")
- .to.contain("describeModule('controller:foo', 'Unit | Controller | foo'");
- }));
- });
-
- it('controller-test foo for mocha v0.12+', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.12.0'))
- .then(() => emberGenerateDestroy(['controller-test', 'foo'], _file => {
- expect(_file('tests/unit/controllers/foo-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("import { setupTest } from 'ember-mocha';")
- .to.contain("describe('Unit | Controller | foo'")
- .to.contain("setupTest('controller:foo',");
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/helper-addon-test.js
|
@@ -13,11 +13,16 @@ const file = require('../helpers/file');
describe('Blueprint: helper-addon', function() {
setupTestHooks(this);
- it('in-addon helper-addon foo/bar-baz', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['helper-addon', 'foo/bar-baz'], _file => {
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('helper-addon foo/bar-baz', function() {
+ return emberGenerateDestroy(['helper-addon', 'foo/bar-baz'], _file => {
expect(_file('app/helpers/foo/bar-baz.js'))
.to.equal(file('helper-addon.js'));
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/helper-test.js
|
@@ -16,194 +16,193 @@ const file = require('../helpers/file');
describe('Blueprint: helper', function() {
setupTestHooks(this);
- it('helper foo/bar-baz', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['helper', 'foo/bar-baz'], _file => {
+ describe('in app', function() {
+ beforeEach(function() {
+ return emberNew();
+ });
+
+ it('helper foo/bar-baz', function() {
+ return emberGenerateDestroy(['helper', 'foo/bar-baz'], _file => {
expect(_file('app/helpers/foo/bar-baz.js'))
.to.equal(file('helper.js'));
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
- }));
- });
+ });
+ });
- it('helper foo/bar-baz unit', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['helper', '--test-type=unit', 'foo/bar-baz'], _file => {
+ it('helper foo/bar-baz unit', function() {
+ return emberGenerateDestroy(['helper', '--test-type=unit', 'foo/bar-baz'], _file => {
expect(_file('app/helpers/foo/bar-baz.js'))
.to.equal(file('helper.js'));
expect(_file('tests/unit/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/unit.js'));
- }));
- });
+ });
+ });
- it('in-addon helper foo/bar-baz', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['helper', 'foo/bar-baz'], _file => {
- expect(_file('addon/helpers/foo/bar-baz.js'))
- .to.equal(file('helper.js'));
+ it('helper foo/bar-baz --pod', function() {
+ return emberGenerateDestroy(['helper', 'foo/bar-baz', '--pod'], _file => {
expect(_file('app/helpers/foo/bar-baz.js'))
- .to.equal(file('helper-addon.js'));
- expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
- .to.equal(file('helper-test/integration.js'));
- }));
- });
-
- it('in-addon helper foo/bar-baz', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['helper', 'foo/bar-baz'], _file => {
- expect(_file('addon/helpers/foo/bar-baz.js'))
.to.equal(file('helper.js'));
- expect(_file('app/helpers/foo/bar-baz.js'))
- .to.equal(file('helper-addon.js'));
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
- }));
- });
+ });
+ });
- it('dummy helper foo/bar-baz', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['helper', 'foo/bar-baz', '--dummy'], _file => {
- expect(_file('tests/dummy/app/helpers/foo/bar-baz.js'))
- .to.equal(file('helper.js'));
+ it('helper foo/bar-baz --pod', function() {
+ return emberGenerateDestroy(['helper', 'foo/bar-baz', '--pod'], _file => {
expect(_file('app/helpers/foo/bar-baz.js'))
- .to.not.exist;
- expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
- .to.not.exist;
- }));
- });
-
- it('in-repo-addon helper foo/bar-baz', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['helper', 'foo/bar-baz', '--in-repo-addon=my-addon'], _file => {
- expect(_file('lib/my-addon/addon/helpers/foo/bar-baz.js'))
.to.equal(file('helper.js'));
- expect(_file('lib/my-addon/app/helpers/foo/bar-baz.js'))
- .to.equal(file('helper-addon.js'));
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
- }));
- });
+ });
+ });
- it('in-repo-addon helper foo/bar-baz', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['helper', 'foo/bar-baz', '--in-repo-addon=my-addon'], _file => {
- expect(_file('lib/my-addon/addon/helpers/foo/bar-baz.js'))
- .to.equal(file('helper.js'));
- expect(_file('lib/my-addon/app/helpers/foo/bar-baz.js'))
- .to.equal(file('helper-addon.js'));
+ it('helper-test foo/bar-baz', function() {
+ return emberGenerateDestroy(['helper-test', 'foo/bar-baz'], _file => {
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
- }));
- });
+ });
+ });
- it('helper foo/bar-baz --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['helper', 'foo/bar-baz', '--pod'], _file => {
- expect(_file('app/helpers/foo/bar-baz.js'))
- .to.equal(file('helper.js'));
+ it('helper-test foo/bar-baz --integration', function() {
+ return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], _file => {
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
- }));
- });
-
- it('helper foo/bar-baz --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['helper', 'foo/bar-baz', '--pod'], _file => {
- expect(_file('app/helpers/foo/bar-baz.js'))
+ });
+ });
+
+ describe('with podModulePrefix', function() {
+ beforeEach(function() {
+ setupPodConfig({ podModulePrefix: true });
+ });
+
+ it('helper foo/bar-baz --pod', function() {
+ return emberGenerateDestroy(['helper', 'foo/bar-baz', '--pod'], _file => {
+ expect(_file('app/helpers/foo/bar-baz.js'))
+ .to.equal(file('helper.js'));
+ expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
+ .to.equal(file('helper-test/integration.js'));
+ });
+ });
+
+ it('helper foo/bar-baz --pod', function() {
+ return emberGenerateDestroy(['helper', 'foo/bar-baz', '--pod'], _file => {
+ expect(_file('app/helpers/foo/bar-baz.js'))
+ .to.equal(file('helper.js'));
+ expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
+ .to.equal(file('helper-test/integration.js'));
+ });
+ });
+ });
+
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ generateFakePackageManifest('ember-cli-mocha', '0.11.0');
+ });
+
+ it('helper-test foo/bar-baz --integration', function() {
+ return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], _file => {
+ expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
+ .to.contain("import { describeComponent, it } from 'ember-mocha';")
+ .to.contain("import hbs from 'htmlbars-inline-precompile';");
+ });
+ });
+ });
+
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ generateFakePackageManifest('ember-cli-mocha', '0.12.0');
+ });
+
+ it('helper-test foo/bar-baz --integration', function() {
+ return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], _file => {
+ expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
+ .to.contain("import { describe, it } from 'mocha';")
+ .to.contain("import { setupComponentTest } from 'ember-mocha';")
+ .to.contain("import hbs from 'htmlbars-inline-precompile';")
+ .to.contain("describe('Integration | Helper | foo/bar baz', function() {");
+ });
+ });
+
+ it('helper-test foo/bar-baz for mocha', function() {
+ return emberGenerateDestroy(['helper-test', 'foo/bar-baz'], _file => {
+ expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
+ .to.contain("import { describe, it } from 'mocha';")
+ .to.contain("setupComponentTest('foo/bar-baz', {")
+ .to.contain("describe('Integration | Helper | foo/bar baz', function() {");
+ });
+ });
+ });
+ });
+
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('helper foo/bar-baz', function() {
+ return emberGenerateDestroy(['helper', 'foo/bar-baz'], _file => {
+ expect(_file('addon/helpers/foo/bar-baz.js'))
.to.equal(file('helper.js'));
+ expect(_file('app/helpers/foo/bar-baz.js'))
+ .to.equal(file('helper-addon.js'));
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
- }));
- });
+ });
+ });
- it('helper foo/bar-baz --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['helper', 'foo/bar-baz', '--pod'], _file => {
- expect(_file('app/helpers/foo/bar-baz.js'))
+ it('helper foo/bar-baz', function() {
+ return emberGenerateDestroy(['helper', 'foo/bar-baz'], _file => {
+ expect(_file('addon/helpers/foo/bar-baz.js'))
.to.equal(file('helper.js'));
+ expect(_file('app/helpers/foo/bar-baz.js'))
+ .to.equal(file('helper-addon.js'));
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
- }));
- });
+ });
+ });
- it('helper foo/bar-baz --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['helper', 'foo/bar-baz', '--pod'], _file => {
- expect(_file('app/helpers/foo/bar-baz.js'))
+ it('helper foo/bar-baz --dummy', function() {
+ return emberGenerateDestroy(['helper', 'foo/bar-baz', '--dummy'], _file => {
+ expect(_file('tests/dummy/app/helpers/foo/bar-baz.js'))
.to.equal(file('helper.js'));
+ expect(_file('app/helpers/foo/bar-baz.js'))
+ .to.not.exist;
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
- .to.equal(file('helper-test/integration.js'));
- }));
- });
+ .to.not.exist;
+ });
+ });
- it('helper-test foo/bar-baz --integration', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], _file => {
+ it('helper-test foo/bar-baz', function() {
+ return emberGenerateDestroy(['helper-test', 'foo/bar-baz'], _file => {
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
- }));
+ });
+ });
});
- it('helper-test foo/bar-baz', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['helper-test', 'foo/bar-baz'], _file => {
- expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
- .to.equal(file('helper-test/integration.js'));
- }));
- });
+ describe('in in-repo-addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'in-repo-addon' });
+ });
- it('in-addon helper-test foo/bar-baz', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['helper-test', 'foo/bar-baz'], _file => {
+ it('helper foo/bar-baz --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['helper', 'foo/bar-baz', '--in-repo-addon=my-addon'], _file => {
+ expect(_file('lib/my-addon/addon/helpers/foo/bar-baz.js'))
+ .to.equal(file('helper.js'));
+ expect(_file('lib/my-addon/app/helpers/foo/bar-baz.js'))
+ .to.equal(file('helper-addon.js'));
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.equal(file('helper-test/integration.js'));
- }));
- });
-
- it('helper-test foo/bar-baz --integration for mocha', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.11.0'))
- .then(() => emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], _file => {
- expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
- .to.contain("import { describeComponent, it } from 'ember-mocha';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';");
- }));
- });
-
- it('helper-test foo/bar-baz --integration for mocha v0.12+', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.12.0'))
- .then(() => emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], _file => {
- expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("import { setupComponentTest } from 'ember-mocha';")
- .to.contain("import hbs from 'htmlbars-inline-precompile';")
- .to.contain("describe('Integration | Helper | foo/bar baz', function() {");
- }));
- });
-
- it('helper-test foo/bar-baz for mocha', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.12.0'))
- .then(() => emberGenerateDestroy(['helper-test', 'foo/bar-baz'], _file => {
- expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("setupComponentTest('foo/bar-baz', {")
- .to.contain("describe('Integration | Helper | foo/bar baz', function() {");
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/initializer-addon-test.js
|
@@ -11,11 +11,16 @@ const expect = chai.expect;
describe('Blueprint: initializer-addon', function() {
setupTestHooks(this);
- it('initializer-addon foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['initializer-addon', 'foo'], _file => {
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('initializer-addon foo', function() {
+ return emberGenerateDestroy(['initializer-addon', 'foo'], _file => {
expect(_file('app/initializers/foo.js'))
.to.contain("export { default, initialize } from 'my-addon/initializers/foo';");
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/initializer-test.js
|
@@ -13,9 +13,13 @@ const expect = chai.expect;
describe('Blueprint: initializer', function() {
setupTestHooks(this);
- it('initializer foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['initializer', 'foo'], _file => {
+ describe('in app', function() {
+ beforeEach(function() {
+ return emberNew();
+ });
+
+ it('initializer foo', function() {
+ return emberGenerateDestroy(['initializer', 'foo'], _file => {
expect(_file('app/initializers/foo.js'))
.to.contain("export function initialize(/* application */) {\n" +
" // application.inject('route', 'foo', 'service:foo');\n" +
@@ -27,12 +31,11 @@ describe('Blueprint: initializer', function() {
expect(_file('tests/unit/initializers/foo-test.js'))
.to.contain("import { initialize } from 'my-app/initializers/foo';");
- }));
- });
+ });
+ });
- it('initializer foo/bar', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['initializer', 'foo/bar'], _file => {
+ it('initializer foo/bar', function() {
+ return emberGenerateDestroy(['initializer', 'foo/bar'], _file => {
expect(_file('app/initializers/foo/bar.js'))
.to.contain("export function initialize(/* application */) {\n" +
" // application.inject('route', 'foo', 'service:foo');\n" +
@@ -44,12 +47,104 @@ describe('Blueprint: initializer', function() {
expect(_file('tests/unit/initializers/foo/bar-test.js'))
.to.contain("import { initialize } from 'my-app/initializers/foo/bar';");
- }));
+ });
+ });
+
+ it('initializer foo --pod', function() {
+ return emberGenerateDestroy(['initializer', 'foo', '--pod'], _file => {
+ expect(_file('app/initializers/foo.js'))
+ .to.contain("export function initialize(/* application */) {\n" +
+ " // application.inject('route', 'foo', 'service:foo');\n" +
+ "}\n" +
+ "\n" +
+ "export default {\n" +
+ " initialize\n" +
+ "};");
+ });
+ });
+
+ it('initializer foo/bar --pod', function() {
+ return emberGenerateDestroy(['initializer', 'foo/bar', '--pod'], _file => {
+ expect(_file('app/initializers/foo/bar.js'))
+ .to.contain("export function initialize(/* application */) {\n" +
+ " // application.inject('route', 'foo', 'service:foo');\n" +
+ "}\n" +
+ "\n" +
+ "export default {\n" +
+ " initialize\n" +
+ "};");
+ });
+ });
+
+ it('initializer-test foo', function() {
+ return emberGenerateDestroy(['initializer-test', 'foo'], _file => {
+ expect(_file('tests/unit/initializers/foo-test.js'))
+ .to.contain("import { initialize } from 'my-app/initializers/foo';")
+ .to.contain("module('Unit | Initializer | foo'")
+ .to.contain("application = Application.create();")
+ .to.contain("initialize(this.application);");
+ });
+ });
+
+ describe('with podModulePrefix', function() {
+ beforeEach(function() {
+ setupPodConfig({ podModulePrefix: true });
+ });
+
+ it('initializer foo --pod', function() {
+ return emberGenerateDestroy(['initializer', 'foo', '--pod'], _file => {
+ expect(_file('app/initializers/foo.js'))
+ .to.contain("export function initialize(/* application */) {\n" +
+ " // application.inject('route', 'foo', 'service:foo');\n" +
+ "}\n" +
+ "\n" +
+ "export default {\n" +
+ " initialize\n" +
+ "};");
+ });
+ });
+
+ it('initializer foo/bar --pod', function() {
+ return emberGenerateDestroy(['initializer', 'foo/bar', '--pod'], _file => {
+ expect(_file('app/initializers/foo/bar.js'))
+ .to.contain("export function initialize(/* application */) {\n" +
+ " // application.inject('route', 'foo', 'service:foo');\n" +
+ "}\n" +
+ "\n" +
+ "export default {\n" +
+ " initialize\n" +
+ "};");
+ });
+ });
+ });
+
+ describe('with ember-cli-mocha', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ });
+
+ it('initializer-test foo', function() {
+ return emberGenerateDestroy(['initializer-test', 'foo'], _file => {
+ expect(_file('tests/unit/initializers/foo-test.js'))
+ .to.contain("import { initialize } from 'my-app/initializers/foo';")
+ .to.contain("describe('Unit | Initializer | foo', function() {")
+ .to.contain("application = Application.create();")
+ .to.contain("initialize(application);");
+ });
+ });
+ });
});
- it('in-addon initializer foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['initializer', 'foo'], _file => {
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('initializer foo', function() {
+ return emberGenerateDestroy(['initializer', 'foo'], _file => {
expect(_file('addon/initializers/foo.js'))
.to.contain("export function initialize(/* application */) {\n" +
" // application.inject('route', 'foo', 'service:foo');\n" +
@@ -64,12 +159,11 @@ describe('Blueprint: initializer', function() {
expect(_file('tests/unit/initializers/foo-test.js'))
.to.exist;
- }));
- });
+ });
+ });
- it('in-addon initializer foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['initializer', 'foo/bar'], _file => {
+ it('initializer foo/bar', function() {
+ return emberGenerateDestroy(['initializer', 'foo/bar'], _file => {
expect(_file('addon/initializers/foo/bar.js'))
.to.contain("export function initialize(/* application */) {\n" +
" // application.inject('route', 'foo', 'service:foo');\n" +
@@ -84,12 +178,11 @@ describe('Blueprint: initializer', function() {
expect(_file('tests/unit/initializers/foo/bar-test.js'))
.to.exist;
- }));
- });
+ });
+ });
- it('dummy initializer foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['initializer', 'foo', '--dummy'], _file => {
+ it('initializer foo --dumy', function() {
+ return emberGenerateDestroy(['initializer', 'foo', '--dummy'], _file => {
expect(_file('tests/dummy/app/initializers/foo.js'))
.to.contain("export function initialize(/* application */) {\n" +
" // application.inject('route', 'foo', 'service:foo');\n" +
@@ -104,12 +197,11 @@ describe('Blueprint: initializer', function() {
expect(_file('tests/unit/initializers/foo-test.js'))
.to.not.exist;
- }));
- });
+ });
+ });
- it('dummy initializer foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['initializer', 'foo/bar', '--dummy'], _file => {
+ it('initializer foo/bar --dummy', function() {
+ return emberGenerateDestroy(['initializer', 'foo/bar', '--dummy'], _file => {
expect(_file('tests/dummy/app/initializers/foo/bar.js'))
.to.contain("export function initialize(/* application */) {\n" +
" // application.inject('route', 'foo', 'service:foo');\n" +
@@ -124,12 +216,28 @@ describe('Blueprint: initializer', function() {
expect(_file('tests/unit/initializers/foo/bar-test.js'))
.to.not.exist;
- }));
+ });
+ });
+
+ it('initializer-test foo', function() {
+ return emberGenerateDestroy(['initializer-test', 'foo'], _file => {
+ expect(_file('tests/unit/initializers/foo-test.js'))
+ .to.contain("import { initialize } from 'dummy/initializers/foo';")
+ .to.contain("module('Unit | Initializer | foo'")
+ .to.contain("application = Application.create();")
+ .to.contain("initialize(this.application);");
+ });
+ });
+
});
- it('in-repo-addon initializer foo', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['initializer', 'foo', '--in-repo-addon=my-addon'], _file => {
+ describe('in in-repo-addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'in-repo-addon' });
+ });
+
+ it('initializer foo --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['initializer', 'foo', '--in-repo-addon=my-addon'], _file => {
expect(_file('lib/my-addon/addon/initializers/foo.js'))
.to.contain("export function initialize(/* application */) {\n" +
" // application.inject('route', 'foo', 'service:foo');\n" +
@@ -144,12 +252,11 @@ describe('Blueprint: initializer', function() {
expect(_file('tests/unit/initializers/foo-test.js'))
.to.exist;
- }));
- });
+ });
+ });
- it('in-repo-addon initializer foo/bar', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['initializer', 'foo/bar', '--in-repo-addon=my-addon'], _file => {
+ it('initializer foo/bar --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['initializer', 'foo/bar', '--in-repo-addon=my-addon'], _file => {
expect(_file('lib/my-addon/addon/initializers/foo/bar.js'))
.to.contain("export function initialize(/* application */) {\n" +
" // application.inject('route', 'foo', 'service:foo');\n" +
@@ -164,105 +271,7 @@ describe('Blueprint: initializer', function() {
expect(_file('tests/unit/initializers/foo/bar-test.js'))
.to.exist;
- }));
- });
-
- /* Pod tests */
-
- it('initializer foo --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['initializer', 'foo', '--pod'], _file => {
- expect(_file('app/initializers/foo.js'))
- .to.contain("export function initialize(/* application */) {\n" +
- " // application.inject('route', 'foo', 'service:foo');\n" +
- "}\n" +
- "\n" +
- "export default {\n" +
- " initialize\n" +
- "};");
- }));
- });
-
- it('initializer foo --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['initializer', 'foo', '--pod'], _file => {
- expect(_file('app/initializers/foo.js'))
- .to.contain("export function initialize(/* application */) {\n" +
- " // application.inject('route', 'foo', 'service:foo');\n" +
- "}\n" +
- "\n" +
- "export default {\n" +
- " initialize\n" +
- "};");
- }));
- });
-
- it('initializer foo/bar --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['initializer', 'foo/bar', '--pod'], _file => {
- expect(_file('app/initializers/foo/bar.js'))
- .to.contain("export function initialize(/* application */) {\n" +
- " // application.inject('route', 'foo', 'service:foo');\n" +
- "}\n" +
- "\n" +
- "export default {\n" +
- " initialize\n" +
- "};");
- }));
- });
-
-
- it('initializer foo/bar --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['initializer', 'foo/bar', '--pod'], _file => {
- expect(_file('app/initializers/foo/bar.js'))
- .to.contain("export function initialize(/* application */) {\n" +
- " // application.inject('route', 'foo', 'service:foo');\n" +
- "}\n" +
- "\n" +
- "export default {\n" +
- " initialize\n" +
- "};");
- }));
- });
-
-
- it('initializer-test foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['initializer-test', 'foo'], _file => {
- expect(_file('tests/unit/initializers/foo-test.js'))
- .to.contain("import { initialize } from 'my-app/initializers/foo';")
- .to.contain("module('Unit | Initializer | foo'")
- .to.contain("application = Application.create();")
- .to.contain("initialize(this.application);");
- }));
- });
-
- it('in-addon initializer-test foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['initializer-test', 'foo'], _file => {
- expect(_file('tests/unit/initializers/foo-test.js'))
- .to.contain("import { initialize } from 'dummy/initializers/foo';")
- .to.contain("module('Unit | Initializer | foo'")
- .to.contain("application = Application.create();")
- .to.contain("initialize(this.application);");
- }));
- });
-
- it('initializer-test foo for mocha', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => emberGenerateDestroy(['initializer-test', 'foo'], _file => {
- expect(_file('tests/unit/initializers/foo-test.js'))
- .to.contain("import { initialize } from 'my-app/initializers/foo';")
- .to.contain("describe('Unit | Initializer | foo', function() {")
- .to.contain("application = Application.create();")
- .to.contain("initialize(application);");
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/instance-initializer-addon-test.js
|
@@ -11,11 +11,16 @@ const expect = chai.expect;
describe('Blueprint: instance-initializer-addon', function() {
setupTestHooks(this);
- it('instance-initializer-addon foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['instance-initializer-addon', 'foo'], _file => {
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('instance-initializer-addon foo', function() {
+ return emberGenerateDestroy(['instance-initializer-addon', 'foo'], _file => {
expect(_file('app/instance-initializers/foo.js'))
.to.contain("export { default, initialize } from 'my-addon/instance-initializers/foo';");
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/instance-initializer-test.js
|
@@ -13,9 +13,14 @@ const expect = chai.expect;
describe('Blueprint: instance-initializer', function() {
setupTestHooks(this);
- it('instance-initializer foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['instance-initializer', 'foo'], _file => {
+
+ describe('in app', function() {
+ beforeEach(function() {
+ return emberNew();
+ });
+
+ it('instance-initializer foo', function() {
+ return emberGenerateDestroy(['instance-initializer', 'foo'], _file => {
expect(_file('app/instance-initializers/foo.js'))
.to.contain("export function initialize(/* appInstance */) {\n" +
" // appInstance.inject('route', 'foo', 'service:foo');\n" +
@@ -27,12 +32,11 @@ describe('Blueprint: instance-initializer', function() {
expect(_file('tests/unit/instance-initializers/foo-test.js'))
.to.contain("import { initialize } from 'my-app/instance-initializers/foo';");
- }));
- });
+ });
+ });
- it('instance-initializer foo/bar', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['instance-initializer', 'foo/bar'], _file => {
+ it('instance-initializer foo/bar', function() {
+ return emberGenerateDestroy(['instance-initializer', 'foo/bar'], _file => {
expect(_file('app/instance-initializers/foo/bar.js'))
.to.contain("export function initialize(/* appInstance */) {\n" +
" // appInstance.inject('route', 'foo', 'service:foo');\n" +
@@ -44,12 +48,106 @@ describe('Blueprint: instance-initializer', function() {
expect(_file('tests/unit/instance-initializers/foo/bar-test.js'))
.to.contain("import { initialize } from 'my-app/instance-initializers/foo/bar';");
- }));
+ });
+ });
+
+ it('instance-initializer foo --pod', function() {
+ return emberGenerateDestroy(['instance-initializer', 'foo', '--pod'], _file => {
+ expect(_file('app/instance-initializers/foo.js'))
+ .to.contain("export function initialize(/* appInstance */) {\n" +
+ " // appInstance.inject('route', 'foo', 'service:foo');\n" +
+ "}\n" +
+ "\n" +
+ "export default {\n" +
+ " initialize\n" +
+ "};");
+ });
+ });
+
+ it('instance-initializer foo/bar --pod', function() {
+ return emberGenerateDestroy(['instance-initializer', 'foo/bar', '--pod'], _file => {
+ expect(_file('app/instance-initializers/foo/bar.js'))
+ .to.contain("export function initialize(/* appInstance */) {\n" +
+ " // appInstance.inject('route', 'foo', 'service:foo');\n" +
+ "}\n" +
+ "\n" +
+ "export default {\n" +
+ " initialize\n" +
+ "};");
+ });
+ });
+
+ it('instance-initializer-test foo', function() {
+ return emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
+ expect(_file('tests/unit/instance-initializers/foo-test.js'))
+ .to.contain("import { initialize } from 'my-app/instance-initializers/foo';")
+ .to.contain("module('Unit | Instance Initializer | foo'")
+ .to.contain("application = Application.create();")
+ .to.contain("this.appInstance = this.application.buildInstance();")
+ .to.contain("initialize(this.appInstance);");
+ });
+ });
+
+ describe('with podModulePrefix', function() {
+ beforeEach(function() {
+ setupPodConfig({ podModulePrefix: true });
+ });
+
+ it('instance-initializer foo --pod', function() {
+ return emberGenerateDestroy(['instance-initializer', 'foo', '--pod'], _file => {
+ expect(_file('app/instance-initializers/foo.js'))
+ .to.contain("export function initialize(/* appInstance */) {\n" +
+ " // appInstance.inject('route', 'foo', 'service:foo');\n" +
+ "}\n" +
+ "\n" +
+ "export default {\n" +
+ " initialize\n" +
+ "};");
+ });
+ });
+
+ it('instance-initializer foo/bar --pod', function() {
+ return emberGenerateDestroy(['instance-initializer', 'foo/bar', '--pod'], _file => {
+ expect(_file('app/instance-initializers/foo/bar.js'))
+ .to.contain("export function initialize(/* appInstance */) {\n" +
+ " // appInstance.inject('route', 'foo', 'service:foo');\n" +
+ "}\n" +
+ "\n" +
+ "export default {\n" +
+ " initialize\n" +
+ "};");
+ });
+ });
+ });
+
+ describe('with ember-cli-mocha', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ });
+
+ it('instance-initializer-test foo for mocha', function() {
+ return emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
+ expect(_file('tests/unit/instance-initializers/foo-test.js'))
+ .to.contain("import { initialize } from 'my-app/instance-initializers/foo';")
+ .to.contain("describe('Unit | Instance Initializer | foo', function() {")
+ .to.contain("application = Application.create();")
+ .to.contain("appInstance = application.buildInstance();")
+ .to.contain("initialize(appInstance);");
+ });
+ });
+ });
});
- it('in-addon instance-initializer foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['instance-initializer', 'foo'], _file => {
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('instance-initializer foo', function() {
+ return emberGenerateDestroy(['instance-initializer', 'foo'], _file => {
expect(_file('addon/instance-initializers/foo.js'))
.to.contain("export function initialize(/* appInstance */) {\n" +
" // appInstance.inject('route', 'foo', 'service:foo');\n" +
@@ -63,12 +161,11 @@ describe('Blueprint: instance-initializer', function() {
.to.contain("export { default, initialize } from 'my-addon/instance-initializers/foo';");
expect(_file('tests/unit/instance-initializers/foo-test.js'));
- }));
- });
+ });
+ });
- it('in-addon instance-initializer foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['instance-initializer', 'foo/bar'], _file => {
+ it('instance-initializer foo/bar', function() {
+ return emberGenerateDestroy(['instance-initializer', 'foo/bar'], _file => {
expect(_file('addon/instance-initializers/foo/bar.js'))
.to.contain("export function initialize(/* appInstance */) {\n" +
" // appInstance.inject('route', 'foo', 'service:foo');\n" +
@@ -82,12 +179,11 @@ describe('Blueprint: instance-initializer', function() {
.to.contain("export { default, initialize } from 'my-addon/instance-initializers/foo/bar';");
expect(_file('tests/unit/instance-initializers/foo/bar-test.js'));
- }));
- });
+ });
+ });
- it('dummy instance-initializer foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['instance-initializer', 'foo', '--dummy'], _file => {
+ it('instance-initializer foo --dummy', function() {
+ return emberGenerateDestroy(['instance-initializer', 'foo', '--dummy'], _file => {
expect(_file('tests/dummy/app/instance-initializers/foo.js'))
.to.contain("export function initialize(/* appInstance */) {\n" +
" // appInstance.inject('route', 'foo', 'service:foo');\n" +
@@ -102,12 +198,11 @@ describe('Blueprint: instance-initializer', function() {
expect(_file('tests/unit/instance-initializers/foo-test.js'))
.to.not.exist;
- }));
- });
+ });
+ });
- it('dummy instance-initializer foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['instance-initializer', 'foo/bar', '--dummy'], _file => {
+ it('instance-initializer foo/bar --dummy', function() {
+ return emberGenerateDestroy(['instance-initializer', 'foo/bar', '--dummy'], _file => {
expect(_file('tests/dummy/app/instance-initializers/foo/bar.js'))
.to.contain("export function initialize(/* appInstance */) {\n" +
" // appInstance.inject('route', 'foo', 'service:foo');\n" +
@@ -122,12 +217,28 @@ describe('Blueprint: instance-initializer', function() {
expect(_file('tests/unit/instance-initializers/foo/bar-test.js'))
.to.not.exist;
- }));
+ });
+ });
+
+ it('instance-initializer-test foo', function() {
+ return emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
+ expect(_file('tests/unit/instance-initializers/foo-test.js'))
+ .to.contain("import { initialize } from 'dummy/instance-initializers/foo';")
+ .to.contain("module('Unit | Instance Initializer | foo'")
+ .to.contain("application = Application.create();")
+ .to.contain("this.appInstance = this.application.buildInstance();")
+ .to.contain("initialize(this.appInstance);");
+ });
+ });
});
- it('in-repo-addon instance-initializer foo', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['instance-initializer', 'foo', '--in-repo-addon=my-addon'], _file => {
+ describe('in in-repo-addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'in-repo-addon' });
+ });
+
+ it('instance-initializer foo --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['instance-initializer', 'foo', '--in-repo-addon=my-addon'], _file => {
expect(_file('lib/my-addon/addon/instance-initializers/foo.js'))
.to.contain("export function initialize(/* appInstance */) {\n" +
" // appInstance.inject('route', 'foo', 'service:foo');\n" +
@@ -142,12 +253,11 @@ describe('Blueprint: instance-initializer', function() {
expect(_file('tests/unit/instance-initializers/foo-test.js'))
.to.exist;
- }));
- });
+ });
+ });
- it('in-repo-addon instance-initializer foo/bar', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['instance-initializer', 'foo/bar', '--in-repo-addon=my-addon'], _file => {
+ it('instance-initializer foo/bar --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['instance-initializer', 'foo/bar', '--in-repo-addon=my-addon'], _file => {
expect(_file('lib/my-addon/addon/instance-initializers/foo/bar.js'))
.to.contain("export function initialize(/* appInstance */) {\n" +
" // appInstance.inject('route', 'foo', 'service:foo');\n" +
@@ -162,108 +272,7 @@ describe('Blueprint: instance-initializer', function() {
expect(_file('tests/unit/instance-initializers/foo/bar-test.js'))
.to.exist;
- }));
- });
-
- /* Pod tests */
-
- it('instance-initializer foo --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['instance-initializer', 'foo', '--pod'], _file => {
- expect(_file('app/instance-initializers/foo.js'))
- .to.contain("export function initialize(/* appInstance */) {\n" +
- " // appInstance.inject('route', 'foo', 'service:foo');\n" +
- "}\n" +
- "\n" +
- "export default {\n" +
- " initialize\n" +
- "};");
- }));
- });
-
- it('instance-initializer foo --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['instance-initializer', 'foo', '--pod'], _file => {
- expect(_file('app/instance-initializers/foo.js'))
- .to.contain("export function initialize(/* appInstance */) {\n" +
- " // appInstance.inject('route', 'foo', 'service:foo');\n" +
- "}\n" +
- "\n" +
- "export default {\n" +
- " initialize\n" +
- "};");
- }));
- });
-
- it('instance-initializer foo/bar --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['instance-initializer', 'foo/bar', '--pod'], _file => {
- expect(_file('app/instance-initializers/foo/bar.js'))
- .to.contain("export function initialize(/* appInstance */) {\n" +
- " // appInstance.inject('route', 'foo', 'service:foo');\n" +
- "}\n" +
- "\n" +
- "export default {\n" +
- " initialize\n" +
- "};");
- }));
- });
-
-
- it('instance-initializer foo/bar --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['instance-initializer', 'foo/bar', '--pod'], _file => {
- expect(_file('app/instance-initializers/foo/bar.js'))
- .to.contain("export function initialize(/* appInstance */) {\n" +
- " // appInstance.inject('route', 'foo', 'service:foo');\n" +
- "}\n" +
- "\n" +
- "export default {\n" +
- " initialize\n" +
- "};");
- }));
- });
-
-
- it('instance-initializer-test foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
- expect(_file('tests/unit/instance-initializers/foo-test.js'))
- .to.contain("import { initialize } from 'my-app/instance-initializers/foo';")
- .to.contain("module('Unit | Instance Initializer | foo'")
- .to.contain("application = Application.create();")
- .to.contain("this.appInstance = this.application.buildInstance();")
- .to.contain("initialize(this.appInstance);");
- }));
- });
-
- it('in-addon instance-initializer-test foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
- expect(_file('tests/unit/instance-initializers/foo-test.js'))
- .to.contain("import { initialize } from 'dummy/instance-initializers/foo';")
- .to.contain("module('Unit | Instance Initializer | foo'")
- .to.contain("application = Application.create();")
- .to.contain("this.appInstance = this.application.buildInstance();")
- .to.contain("initialize(this.appInstance);");
- }));
- });
-
- it('instance-initializer-test foo for mocha', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
- expect(_file('tests/unit/instance-initializers/foo-test.js'))
- .to.contain("import { initialize } from 'my-app/instance-initializers/foo';")
- .to.contain("describe('Unit | Instance Initializer | foo', function() {")
- .to.contain("application = Application.create();")
- .to.contain("appInstance = application.buildInstance();")
- .to.contain("initialize(appInstance);");
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/mixin-test.js
|
@@ -13,41 +13,131 @@ const expect = chai.expect;
describe('Blueprint: mixin', function() {
setupTestHooks(this);
- it('mixin foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['mixin', 'foo'], _file => {
+
+ describe('in app', function() {
+ beforeEach(function() {
+ return emberNew();
+ });
+
+ it('mixin foo', function() {
+ return emberGenerateDestroy(['mixin', 'foo'], _file => {
expect(_file('app/mixins/foo.js'))
.to.contain('import Mixin from \'@ember/object/mixin\';')
.to.contain('export default Mixin.create({\n});');
expect(_file('tests/unit/mixins/foo-test.js'))
.to.contain("import FooMixin from 'my-app/mixins/foo';");
- }));
- });
+ });
+ });
- it('mixin foo/bar', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['mixin', 'foo/bar'], _file => {
+ it('mixin foo/bar', function() {
+ return emberGenerateDestroy(['mixin', 'foo/bar'], _file => {
expect(_file('app/mixins/foo/bar.js'))
.to.contain('import Mixin from \'@ember/object/mixin\';')
.to.contain('export default Mixin.create({\n});');
expect(_file('tests/unit/mixins/foo/bar-test.js'))
.to.contain("import FooBarMixin from 'my-app/mixins/foo/bar';");
- }));
- });
+ });
+ });
- it('mixin foo/bar/baz', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['mixin', 'foo/bar/baz'], _file => {
+ it('mixin foo/bar/baz', function() {
+ return emberGenerateDestroy(['mixin', 'foo/bar/baz'], _file => {
expect(_file('tests/unit/mixins/foo/bar/baz-test.js'))
.to.contain("import FooBarBazMixin from 'my-app/mixins/foo/bar/baz';");
- }));
- });
+ });
+ });
+
+ it('mixin foo --pod', function() {
+ return emberGenerateDestroy(['mixin', 'foo', '--pod'], _file => {
+ expect(_file('app/mixins/foo.js'))
+ .to.contain('import Mixin from \'@ember/object/mixin\';')
+ .to.contain('export default Mixin.create({\n});');
+
+ expect(_file('tests/unit/mixins/foo-test.js'))
+ .to.contain("import FooMixin from 'my-app/mixins/foo';");
+ });
+ });
+
+ it('mixin foo/bar --pod', function() {
+ return emberGenerateDestroy(['mixin', 'foo/bar', '--pod'], _file => {
+ expect(_file('app/mixins/foo/bar.js'))
+ .to.contain('import Mixin from \'@ember/object/mixin\';')
+ .to.contain('export default Mixin.create({\n});');
+
+ expect(_file('tests/unit/mixins/foo/bar-test.js'))
+ .to.contain("import FooBarMixin from 'my-app/mixins/foo/bar';");
+ });
+ });
+
+ it('mixin foo/bar/baz --pod', function() {
+ return emberGenerateDestroy(['mixin', 'foo/bar/baz', '--pod'], _file => {
+ expect(_file('tests/unit/mixins/foo/bar/baz-test.js'))
+ .to.contain("import FooBarBazMixin from 'my-app/mixins/foo/bar/baz';");
+ });
+ });
- it('in-addon mixin foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['mixin', 'foo'], _file => {
+ it('mixin-test foo', function() {
+ return emberGenerateDestroy(['mixin-test', 'foo'], _file => {
+ expect(_file('tests/unit/mixins/foo-test.js'))
+ .to.contain("import FooMixin from 'my-app/mixins/foo';");
+ });
+ });
+
+ describe('with podModulePrefix', function() {
+ beforeEach(function() {
+ setupPodConfig({ podModulePrefix: true });
+ });
+
+ it('mixin foo --pod', function() {
+ return emberGenerateDestroy(['mixin', 'foo', '--pod'], _file => {
+ expect(_file('app/mixins/foo.js'))
+ .to.contain('import Mixin from \'@ember/object/mixin\';')
+ .to.contain('export default Mixin.create({\n});');
+
+ expect(_file('tests/unit/mixins/foo-test.js'))
+ .to.contain("import FooMixin from 'my-app/mixins/foo';");
+ });
+ });
+
+ it('mixin foo/bar --pod', function() {
+ return emberGenerateDestroy(['mixin', 'foo/bar', '--pod'], _file => {
+ expect(_file('app/mixins/foo/bar.js'))
+ .to.contain('import Mixin from \'@ember/object/mixin\';')
+ .to.contain('export default Mixin.create({\n});');
+
+ expect(_file('tests/unit/mixins/foo/bar-test.js'))
+ .to.contain("import FooBarMixin from 'my-app/mixins/foo/bar';");
+ });
+ });
+ });
+
+ describe('with ember-cli-mocha', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ });
+
+ it('mixin-test foo', function() {
+ return emberGenerateDestroy(['mixin-test', 'foo'], _file => {
+ expect(_file('tests/unit/mixins/foo-test.js'))
+ .to.contain("import { describe, it } from 'mocha';")
+ .to.contain("import FooMixin from 'my-app/mixins/foo';")
+ .to.contain("describe('Unit | Mixin | foo', function() {");
+ });
+ });
+ });
+ });
+
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('mixin foo', function() {
+ return emberGenerateDestroy(['mixin', 'foo'], _file => {
expect(_file('addon/mixins/foo.js'))
.to.contain('import Mixin from \'@ember/object/mixin\';')
.to.contain('export default Mixin.create({\n});');
@@ -57,12 +147,11 @@ describe('Blueprint: mixin', function() {
expect(_file('app/mixins/foo.js'))
.to.not.exist;
- }));
- });
+ });
+ });
- it('in-addon mixin foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['mixin', 'foo/bar'], _file => {
+ it('mixin foo/bar', function() {
+ return emberGenerateDestroy(['mixin', 'foo/bar'], _file => {
expect(_file('addon/mixins/foo/bar.js'))
.to.contain('import Mixin from \'@ember/object/mixin\';')
.to.contain('export default Mixin.create({\n});');
@@ -72,12 +161,11 @@ describe('Blueprint: mixin', function() {
expect(_file('app/mixins/foo/bar.js'))
.to.not.exist;
- }));
- });
+ });
+ });
- it('in-addon mixin foo/bar/baz', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['mixin', 'foo/bar/baz'], _file => {
+ it('mixin foo/bar/baz', function() {
+ return emberGenerateDestroy(['mixin', 'foo/bar/baz'], _file => {
expect(_file('addon/mixins/foo/bar/baz.js'))
.to.contain('import Mixin from \'@ember/object/mixin\';')
.to.contain('export default Mixin.create({\n});');
@@ -87,128 +175,49 @@ describe('Blueprint: mixin', function() {
expect(_file('app/mixins/foo/bar/baz.js'))
.to.not.exist;
- }));
+ });
+ });
+
+ it('mixin-test foo', function() {
+ return emberGenerateDestroy(['mixin-test', 'foo'], _file => {
+ expect(_file('tests/unit/mixins/foo-test.js'))
+ .to.contain("import FooMixin from 'my-addon/mixins/foo';");
+ });
+ });
});
- it('in-repo-addon mixin foo', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['mixin', 'foo', '--in-repo-addon=my-addon'], _file => {
+ describe('in in-repo-addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'in-repo-addon' });
+ });
+
+ it('mixin foo --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['mixin', 'foo', '--in-repo-addon=my-addon'], _file => {
expect(_file('lib/my-addon/addon/mixins/foo.js'))
.to.contain('import Mixin from \'@ember/object/mixin\';')
.to.contain('export default Mixin.create({\n});');
expect(_file('tests/unit/mixins/foo-test.js'))
.to.contain("import FooMixin from 'my-addon/mixins/foo';");
- }));
- });
+ });
+ });
- it('in-repo-addon mixin foo/bar', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['mixin', 'foo/bar', '--in-repo-addon=my-addon'], _file => {
+ it('mixin foo/bar --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['mixin', 'foo/bar', '--in-repo-addon=my-addon'], _file => {
expect(_file('lib/my-addon/addon/mixins/foo/bar.js'))
.to.contain('import Mixin from \'@ember/object/mixin\';')
.to.contain('export default Mixin.create({\n});');
expect(_file('tests/unit/mixins/foo/bar-test.js'))
.to.contain("import FooBarMixin from 'my-addon/mixins/foo/bar';");
- }));
- });
+ });
+ });
- it('in-repo-addon mixin foo/bar/baz', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['mixin', 'foo/bar/baz', '--in-repo-addon=my-addon'], _file => {
+ it('mixin foo/bar/baz --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['mixin', 'foo/bar/baz', '--in-repo-addon=my-addon'], _file => {
expect(_file('tests/unit/mixins/foo/bar/baz-test.js'))
.to.contain("import FooBarBazMixin from 'my-addon/mixins/foo/bar/baz';");
- }));
- });
-
- /* Pod tests */
-
- it('mixin foo --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['mixin', 'foo', '--pod'], _file => {
- expect(_file('app/mixins/foo.js'))
- .to.contain('import Mixin from \'@ember/object/mixin\';')
- .to.contain('export default Mixin.create({\n});');
-
- expect(_file('tests/unit/mixins/foo-test.js'))
- .to.contain("import FooMixin from 'my-app/mixins/foo';");
- }));
- });
-
- it('mixin foo --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['mixin', 'foo', '--pod'], _file => {
- expect(_file('app/mixins/foo.js'))
- .to.contain('import Mixin from \'@ember/object/mixin\';')
- .to.contain('export default Mixin.create({\n});');
-
- expect(_file('tests/unit/mixins/foo-test.js'))
- .to.contain("import FooMixin from 'my-app/mixins/foo';");
- }));
- });
-
- it('mixin foo/bar --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['mixin', 'foo/bar', '--pod'], _file => {
- expect(_file('app/mixins/foo/bar.js'))
- .to.contain('import Mixin from \'@ember/object/mixin\';')
- .to.contain('export default Mixin.create({\n});');
-
- expect(_file('tests/unit/mixins/foo/bar-test.js'))
- .to.contain("import FooBarMixin from 'my-app/mixins/foo/bar';");
- }));
- });
-
- it('mixin foo/bar --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['mixin', 'foo/bar', '--pod'], _file => {
- expect(_file('app/mixins/foo/bar.js'))
- .to.contain('import Mixin from \'@ember/object/mixin\';')
- .to.contain('export default Mixin.create({\n});');
-
- expect(_file('tests/unit/mixins/foo/bar-test.js'))
- .to.contain("import FooBarMixin from 'my-app/mixins/foo/bar';");
- }));
- });
-
- it('mixin foo/bar/baz --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['mixin', 'foo/bar/baz', '--pod'], _file => {
- expect(_file('tests/unit/mixins/foo/bar/baz-test.js'))
- .to.contain("import FooBarBazMixin from 'my-app/mixins/foo/bar/baz';");
- }));
- });
-
- it('mixin-test foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['mixin-test', 'foo'], _file => {
- expect(_file('tests/unit/mixins/foo-test.js'))
- .to.contain("import FooMixin from 'my-app/mixins/foo';");
- }));
- });
-
- it('in-addon mixin-test foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['mixin-test', 'foo'], _file => {
- expect(_file('tests/unit/mixins/foo-test.js'))
- .to.contain("import FooMixin from 'my-addon/mixins/foo';");
- }));
- });
-
- it('mixin-test foo for mocha', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => emberGenerateDestroy(['mixin-test', 'foo'], _file => {
- expect(_file('tests/unit/mixins/foo-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("import FooMixin from 'my-app/mixins/foo';")
- .to.contain("describe('Unit | Mixin | foo', function() {");
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/route-addon-test.js
|
@@ -11,13 +11,19 @@ const expect = chai.expect;
describe('Blueprint: route-addon', function() {
setupTestHooks(this);
- it('route-addon foo', function() {
- return emberNew({ target: 'addon' }).then(() => emberGenerateDestroy(['route-addon', 'foo'], _file => {
- expect(_file('app/routes/foo.js'))
- .to.contain("export { default } from 'my-addon/routes/foo';");
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
- expect(_file('app/templates/foo.js'))
- .to.contain("export { default } from 'my-addon/templates/foo';");
- }));
+ it('route-addon foo', function() {
+ return emberGenerateDestroy(['route-addon', 'foo'], _file => {
+ expect(_file('app/routes/foo.js'))
+ .to.contain("export { default } from 'my-addon/routes/foo';");
+
+ expect(_file('app/templates/foo.js'))
+ .to.contain("export { default } from 'my-addon/templates/foo';");
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/route-test.js
|
@@ -20,41 +20,46 @@ const generateFakePackageManifest = require('../helpers/generate-fake-package-ma
describe('Blueprint: route', function() {
setupTestHooks(this);
- it('route foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['route', 'foo'], (_file) => {
- expect(_file('app/routes/foo.js'))
- .to.contain('import Route from \'@ember/routing/route\';')
- .to.contain('export default Route.extend({\n});');
+ describe('in app', function() {
+ beforeEach(function() {
+ return emberNew();
+ });
- expect(_file('app/templates/foo.hbs'))
- .to.equal('{{outlet}}');
+ it('route foo', function() {
+ return emberGenerateDestroy(['route', 'foo'], (_file) => {
+ expect(_file('app/routes/foo.js'))
+ .to.contain('import Route from \'@ember/routing/route\';')
+ .to.contain('export default Route.extend({\n});');
- expect(_file('tests/unit/routes/foo-test.js'))
- .to.contain('import { moduleFor, test } from \'ember-qunit\';')
- .to.contain('moduleFor(\'route:foo\'');
+ expect(_file('app/templates/foo.hbs'))
+ .to.equal('{{outlet}}');
- expect(file('app/router.js'))
- .to.contain('this.route(\'foo\')');
- }))
- .then(() => expect(file('app/router.js'))
- .to.not.contain('this.route(\'foo\')'));
- });
+ expect(_file('tests/unit/routes/foo-test.js'))
+ .to.contain('import { moduleFor, test } from \'ember-qunit\';')
+ .to.contain('moduleFor(\'route:foo\'');
- it('route foo with --skip-router', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['route', 'foo', '--skip-router'], (_file) => {
+ expect(file('app/router.js'))
+ .to.contain('this.route(\'foo\')');
+
+ }).then(() => {
+ expect(file('app/router.js'))
+ .to.not.contain('this.route(\'foo\')');
+ });
+ });
+
+ it('route foo --skip-router', function() {
+ return emberGenerateDestroy(['route', 'foo', '--skip-router'], (_file) => {
expect(_file('app/routes/foo.js')).to.exist;
expect(_file('app/templates/foo.hbs')).to.exist;
expect(_file('tests/unit/routes/foo-test.js')).to.exist;
expect(file('app/router.js')).to.not.contain('this.route(\'foo\')');
- }))
- .then(() => expect(file('app/router.js')).to.not.contain('this.route(\'foo\')'));
- });
+ }).then(() => {
+ expect(file('app/router.js')).to.not.contain('this.route(\'foo\')');
+ });
+ });
- it('route foo with --path', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['route', 'foo', '--path=:foo_id/show'], (_file) => {
+ it('route foo --path=:foo_id/show', function() {
+ return emberGenerateDestroy(['route', 'foo', '--path=:foo_id/show'], (_file) => {
expect(_file('app/routes/foo.js'))
.to.contain('import Route from \'@ember/routing/route\';')
.to.contain('export default Route.extend({\n});');
@@ -70,15 +75,16 @@ describe('Blueprint: route', function() {
.to.contain('this.route(\'foo\', {')
.to.contain('path: \':foo_id/show\'')
.to.contain('});');
- }))
- .then(() => expect(file('app/router.js'))
- .to.not.contain('this.route(\'foo\'')
- .to.not.contain('path: \':foo_id/show\''));
- });
- it('route --reset-namespace', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['route', 'parent/child', '--reset-namespace'], (_file) => {
+ }).then(() => {
+ expect(file('app/router.js'))
+ .to.not.contain('this.route(\'foo\'')
+ .to.not.contain('path: \':foo_id/show\'');
+ });
+ });
+
+ it('route parent/child --reset-namespace', function() {
+ return emberGenerateDestroy(['route', 'parent/child', '--reset-namespace'], (_file) => {
expect(_file('app/routes/child.js'))
.to.contain('import Route from \'@ember/routing/route\';')
.to.contain('export default Route.extend({\n});');
@@ -95,12 +101,11 @@ describe('Blueprint: route', function() {
.to.contain('this.route(\'child\', {')
.to.contain('resetNamespace: true')
.to.contain('});');
- }));
- });
+ });
+ });
- it('route --reset-namespace --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['route', 'parent/child', '--reset-namespace', '--pod'], (_file) => {
+ it('route parent/child --reset-namespace --pod', function() {
+ return emberGenerateDestroy(['route', 'parent/child', '--reset-namespace', '--pod'], (_file) => {
expect(_file('app/child/route.js'))
.to.contain('import Route from \'@ember/routing/route\';')
.to.contain('export default Route.extend({\n});');
@@ -117,38 +122,174 @@ describe('Blueprint: route', function() {
.to.contain('this.route(\'child\', {')
.to.contain('resetNamespace: true')
.to.contain('});');
- }));
- });
+ });
+ });
- it('route index', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['route', 'index'], (_file) => {
+ it('route index', function() {
+ return emberGenerateDestroy(['route', 'index'], (_file) => {
expect(_file('app/routes/index.js')).to.exist;
expect(_file('app/templates/index.hbs')).to.exist;
expect(_file('tests/unit/routes/index-test.js')).to.exist;
expect(file('app/router.js')).to.not.contain('this.route(\'index\')');
- }))
- .then(() => expect(file('app/router.js')).to.not.contain('this.route(\'index\')'));
- });
+ }).then(() => {
+ expect(file('app/router.js')).to.not.contain('this.route(\'index\')');
+ });
+ });
- it('route application', function() {
- return emberNew()
- .then(() => emberGenerate(['route', 'application']))
- .then(() => expect(file('app/router.js')).to.not.contain('this.route(\'application\')'));
- });
+ it('route application', function() {
+ return emberGenerate(['route', 'application']).then(() => {
+ expect(file('app/router.js')).to.not.contain('this.route(\'application\')');
+ });
+ });
- it('route basic isn\'t added to router', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['route', 'basic'], (_file) => {
+ it('route basic', function() {
+ return emberGenerateDestroy(['route', 'basic'], (_file) => {
expect(_file('app/routes/basic.js')).to.exist;
expect(file('app/router.js')).to.not.contain('this.route(\'basic\')');
- }))
- .then(() => expect(file('app/router.js')).to.not.contain('this.route(\'basic\')'));
+ }).then(() => {
+ expect(file('app/router.js')).to.not.contain('this.route(\'basic\')');
+ });
+ });
+
+
+ it('route foo --pod', function() {
+ return emberGenerateDestroy(['route', 'foo', '--pod'], (_file) => {
+ expect(_file('app/foo/route.js'))
+ .to.contain('import Route from \'@ember/routing/route\';')
+ .to.contain('export default Route.extend({\n});');
+
+ expect(_file('app/foo/template.hbs'))
+ .to.equal('{{outlet}}');
+
+ expect(_file('tests/unit/foo/route-test.js'))
+ .to.contain('import { moduleFor, test } from \'ember-qunit\';')
+ .to.contain('moduleFor(\'route:foo\'');
+
+ expect(file('app/router.js'))
+ .to.contain('this.route(\'foo\')');
+
+ }).then(() => {
+ expect(file('app/router.js'))
+ .to.not.contain('this.route(\'foo\')');
+ });
+ });
+
+ it('route foo --pod with --path', function() {
+ return emberGenerate(['route', 'foo', '--pod', '--path=:foo_id/show'])
+ .then(() => expect(file('app/router.js'))
+ .to.contain('this.route(\'foo\', {')
+ .to.contain('path: \':foo_id/show\'')
+ .to.contain('});'))
+
+ .then(() => emberDestroy(['route', 'foo', '--pod', '--path=:foo_id/show']))
+ .then(() => expect(file('app/router.js'))
+ .to.not.contain('this.route(\'foo\', {')
+ .to.not.contain('path: \':foo_id/show\''));
+ });
+
+ it('route index --pod', function() {
+ return emberGenerate(['route', 'index', '--pod'])
+ .then(() => expect(file('app/router.js'))
+ .to.not.contain('this.route(\'index\')'));
+ });
+
+ it('route application --pod', function() {
+ return emberGenerate(['route', 'application', '--pod'])
+ .then(() => expect(file('app/application/route.js')).to.exist)
+ .then(() => expect(file('app/application/template.hbs')).to.exist)
+ .then(() => expect(file('app/router.js')).to.not.contain('this.route(\'application\')'));
+ });
+
+ it('route basic --pod', function() {
+ return emberGenerateDestroy(['route', 'basic', '--pod'], (_file) => {
+ expect(_file('app/basic/route.js')).to.exist;
+ expect(file('app/router.js'))
+ .to.not.contain('this.route(\'index\')');
+ });
+ });
+
+ it('route-test foo', function() {
+ return emberGenerateDestroy(['route-test', 'foo'], (_file) => {
+ expect(_file('tests/unit/routes/foo-test.js'))
+ .to.contain('import { moduleFor, test } from \'ember-qunit\';')
+ .to.contain('moduleFor(\'route:foo\'');
+ });
+ });
+
+ describe('with podModulePrefix', function() {
+ beforeEach(function() {
+ setupPodConfig({ podModulePrefix: true });
+ });
+
+ it('route foo --pod', function() {
+ return emberGenerateDestroy(['route', 'foo', '--pod'], (_file) => {
+ expect(_file('app/pods/foo/route.js'))
+ .to.contain('import Route from \'@ember/routing/route\';')
+ .to.contain('export default Route.extend({\n});');
+
+ expect(_file('app/pods/foo/template.hbs'))
+ .to.equal('{{outlet}}');
+
+ expect(_file('tests/unit/pods/foo/route-test.js'))
+ .to.contain('import { moduleFor, test } from \'ember-qunit\';')
+ .to.contain('moduleFor(\'route:foo\'');
+
+ expect(file('app/router.js'))
+ .to.contain('this.route(\'foo\')');
+
+ }).then(() => {
+ expect(file('app/router.js'))
+ .to.not.contain('this.route(\'foo\')');
+ });
+ });
+ });
+
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ generateFakePackageManifest('ember-cli-mocha', '0.11.0');
+ });
+
+ it('route-test foo', function() {
+ return emberGenerateDestroy(['route-test', 'foo'], (_file) => {
+ expect(_file('tests/unit/routes/foo-test.js'))
+ .to.contain('import { describeModule, it } from \'ember-mocha\';')
+ .to.contain('describeModule(\'route:foo\', \'Unit | Route | foo\'');
+ });
+ });
+ });
+
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ generateFakePackageManifest('ember-cli-mocha', '0.12.0');
+ });
+
+ it('route-test foo', function() {
+ return emberGenerateDestroy(['route-test', 'foo'], (_file) => {
+ expect(_file('tests/unit/routes/foo-test.js'))
+ .to.contain('import { describe, it } from \'mocha\';')
+ .to.contain('import { setupTest } from \'ember-mocha\';')
+ .to.contain('describe(\'Unit | Route | foo\', function() {')
+ .to.contain('setupTest(\'route:foo\',');
+ });
+ });
+ });
});
- it('in-addon route foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['route', 'foo'], (_file) => {
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('route foo', function() {
+ return emberGenerateDestroy(['route', 'foo'], (_file) => {
expect(_file('addon/routes/foo.js'))
.to.contain('import Route from \'@ember/routing/route\';')
.to.contain('export default Route.extend({\n});');
@@ -168,14 +309,15 @@ describe('Blueprint: route', function() {
expect(file('tests/dummy/app/router.js'))
.to.not.contain('this.route(\'foo\')');
- }))
- .then(() => expect(file('tests/dummy/app/router.js'))
- .to.not.contain('this.route(\'foo\')'));
- });
- it('in-addon route foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['route', 'foo/bar'], (_file) => {
+ }).then(() => {
+ expect(file('tests/dummy/app/router.js'))
+ .to.not.contain('this.route(\'foo\')');
+ });
+ });
+
+ it('route foo/bar', function() {
+ return emberGenerateDestroy(['route', 'foo/bar'], (_file) => {
expect(_file('addon/routes/foo/bar.js'))
.to.contain('import Route from \'@ember/routing/route\';')
.to.contain('export default Route.extend({\n});');
@@ -195,14 +337,15 @@ describe('Blueprint: route', function() {
expect(file('tests/dummy/app/router.js'))
.to.not.contain('this.route(\'bar\')');
- }))
- .then(() => expect(file('tests/dummy/app/router.js'))
- .to.not.contain('this.route(\'bar\')'));
- });
- it('dummy route foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['route', 'foo', '--dummy'], (_file) => {
+ }).then(() => {
+ expect(file('tests/dummy/app/router.js'))
+ .to.not.contain('this.route(\'bar\')');
+ });
+ });
+
+ it('route foo --dummy', function() {
+ return emberGenerateDestroy(['route', 'foo', '--dummy'], (_file) => {
expect(_file('tests/dummy/app/routes/foo.js'))
.to.contain('import Route from \'@ember/routing/route\';')
.to.contain('export default Route.extend({\n});');
@@ -216,14 +359,15 @@ describe('Blueprint: route', function() {
expect(file('tests/dummy/app/router.js'))
.to.contain('this.route(\'foo\')');
- }))
- .then(() => expect(file('tests/dummy/app/router.js'))
- .to.not.contain('this.route(\'foo\')'));
- });
- it('dummy route foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['route', 'foo/bar', '--dummy'], (_file) => {
+ }).then(() => {
+ expect(file('tests/dummy/app/router.js'))
+ .to.not.contain('this.route(\'foo\')');
+ });
+ });
+
+ it('route foo/bar --dummy', function() {
+ return emberGenerateDestroy(['route', 'foo/bar', '--dummy'], (_file) => {
expect(_file('tests/dummy/app/routes/foo/bar.js'))
.to.contain('import Route from \'@ember/routing/route\';')
.to.contain('export default Route.extend({\n});');
@@ -238,14 +382,50 @@ describe('Blueprint: route', function() {
expect(file('tests/dummy/app/router.js'))
.to.contain('this.route(\'foo\', function() {')
.to.contain('this.route(\'bar\')');
- }))
- .then(() => expect(file('tests/dummy/app/router.js'))
- .to.not.contain('this.route(\'bar\')'));
+
+ }).then(() => {
+ expect(file('tests/dummy/app/router.js'))
+ .to.not.contain('this.route(\'bar\')');
+ });
+ });
+
+ it('route foo --pod', function() {
+ return emberGenerateDestroy(['route', 'foo', '--pod'], (_file) => {
+ expect(_file('addon/foo/route.js'))
+ .to.contain('import Route from \'@ember/routing/route\';')
+ .to.contain('export default Route.extend({\n});');
+
+ expect(_file('addon/foo/template.hbs'))
+ .to.equal('{{outlet}}');
+
+ expect(_file('app/foo/route.js'))
+ .to.contain('export { default } from \'my-addon/foo/route\';');
+
+ expect(_file('app/foo/template.js'))
+ .to.contain('export { default } from \'my-addon/foo/template\';');
+
+ expect(_file('tests/unit/foo/route-test.js'))
+ .to.contain('import { moduleFor, test } from \'ember-qunit\';')
+ .to.contain('moduleFor(\'route:foo\'');
+ });
+ });
+
+ it('route-test foo', function() {
+ return emberGenerateDestroy(['route-test', 'foo'], (_file) => {
+ expect(_file('tests/unit/routes/foo-test.js'))
+ .to.contain('import { moduleFor, test } from \'ember-qunit\';')
+ .to.contain('moduleFor(\'route:foo\'');
+ });
+ });
});
- it('in-repo-addon route foo', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['route', 'foo', '--in-repo-addon=my-addon'], (_file) => {
+ describe('in in-repo-addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'in-repo-addon' });
+ });
+
+ it('route foo --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['route', 'foo', '--in-repo-addon=my-addon'], (_file) => {
expect(_file('lib/my-addon/addon/routes/foo.js'))
.to.contain('import Route from \'@ember/routing/route\';')
.to.contain('export default Route.extend({\n});');
@@ -262,12 +442,11 @@ describe('Blueprint: route', function() {
expect(_file('tests/unit/routes/foo-test.js'))
.to.contain('import { moduleFor, test } from \'ember-qunit\';')
.to.contain('moduleFor(\'route:foo\'');
- }));
- });
+ });
+ });
- it('in-repo-addon route foo/bar', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['route', 'foo/bar', '--in-repo-addon=my-addon'], (_file) => {
+ it('route foo/bar --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['route', 'foo/bar', '--in-repo-addon=my-addon'], (_file) => {
expect(_file('lib/my-addon/addon/routes/foo/bar.js'))
.to.contain('import Route from \'@ember/routing/route\';')
.to.contain('export default Route.extend({\n});');
@@ -284,157 +463,7 @@ describe('Blueprint: route', function() {
expect(_file('tests/unit/routes/foo/bar-test.js'))
.to.contain('import { moduleFor, test } from \'ember-qunit\';')
.to.contain('moduleFor(\'route:foo/bar\'');
- }));
- });
-
- it('route foo --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['route', 'foo', '--pod'], (_file) => {
- expect(_file('app/foo/route.js'))
- .to.contain('import Route from \'@ember/routing/route\';')
- .to.contain('export default Route.extend({\n});');
-
- expect(_file('app/foo/template.hbs'))
- .to.equal('{{outlet}}');
-
- expect(_file('tests/unit/foo/route-test.js'))
- .to.contain('import { moduleFor, test } from \'ember-qunit\';')
- .to.contain('moduleFor(\'route:foo\'');
-
- expect(file('app/router.js'))
- .to.contain('this.route(\'foo\')');
- }))
- .then(() => expect(file('app/router.js'))
- .to.not.contain('this.route(\'foo\')'));
- });
-
- it('route foo --pod with --path', function() {
- return emberNew()
- .then(() => emberGenerate(['route', 'foo', '--pod', '--path=:foo_id/show']))
- .then(() => expect(file('app/router.js'))
- .to.contain('this.route(\'foo\', {')
- .to.contain('path: \':foo_id/show\'')
- .to.contain('});'))
-
- .then(() => emberDestroy(['route', 'foo', '--pod', '--path=:foo_id/show']))
- .then(() => expect(file('app/router.js'))
- .to.not.contain('this.route(\'foo\', {')
- .to.not.contain('path: \':foo_id/show\''));
- });
-
- it('route foo --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['route', 'foo', '--pod'], (_file) => {
- expect(_file('app/pods/foo/route.js'))
- .to.contain('import Route from \'@ember/routing/route\';')
- .to.contain('export default Route.extend({\n});');
-
- expect(_file('app/pods/foo/template.hbs'))
- .to.equal('{{outlet}}');
-
- expect(_file('tests/unit/pods/foo/route-test.js'))
- .to.contain('import { moduleFor, test } from \'ember-qunit\';')
- .to.contain('moduleFor(\'route:foo\'');
-
- expect(file('app/router.js'))
- .to.contain('this.route(\'foo\')');
- }))
- .then(() => expect(file('app/router.js'))
- .to.not.contain('this.route(\'foo\')'));
- });
-
- it('route index --pod', function() {
- return emberNew()
- .then(() => emberGenerate(['route', 'index', '--pod']))
- .then(() => expect(file('app/router.js'))
- .to.not.contain('this.route(\'index\')'));
- });
-
- it('route application --pod', function() {
- return emberNew()
- .then(() => emberGenerate(['route', 'application', '--pod']))
- .then(() => expect(file('app/application/route.js')).to.exist)
- .then(() => expect(file('app/application/template.hbs')).to.exist)
- .then(() => expect(file('app/router.js')).to.not.contain('this.route(\'application\')'));
- });
-
- it('route basic --pod isn\'t added to router', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['route', 'basic', '--pod'], (_file) => {
- expect(_file('app/basic/route.js')).to.exist;
- expect(file('app/router.js'))
- .to.not.contain('this.route(\'index\')');
- }));
- });
-
- it('in-addon route foo --pod', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['route', 'foo', '--pod'], (_file) => {
- expect(_file('addon/foo/route.js'))
- .to.contain('import Route from \'@ember/routing/route\';')
- .to.contain('export default Route.extend({\n});');
-
- expect(_file('addon/foo/template.hbs'))
- .to.equal('{{outlet}}');
-
- expect(_file('app/foo/route.js'))
- .to.contain('export { default } from \'my-addon/foo/route\';');
-
- expect(_file('app/foo/template.js'))
- .to.contain('export { default } from \'my-addon/foo/template\';');
-
- expect(_file('tests/unit/foo/route-test.js'))
- .to.contain('import { moduleFor, test } from \'ember-qunit\';')
- .to.contain('moduleFor(\'route:foo\'');
- }));
- });
-
- it('route-test foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['route-test', 'foo'], (_file) => {
- expect(_file('tests/unit/routes/foo-test.js'))
- .to.contain('import { moduleFor, test } from \'ember-qunit\';')
- .to.contain('moduleFor(\'route:foo\'');
- }));
- });
-
- it('in-addon route-test foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['route-test', 'foo'], (_file) => {
- expect(_file('tests/unit/routes/foo-test.js'))
- .to.contain('import { moduleFor, test } from \'ember-qunit\';')
- .to.contain('moduleFor(\'route:foo\'');
- }));
- });
-
- it('route-test foo for mocha', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.11.0'))
- .then(() => emberGenerateDestroy(['route-test', 'foo'], (_file) => {
- expect(_file('tests/unit/routes/foo-test.js'))
- .to.contain('import { describeModule, it } from \'ember-mocha\';')
- .to.contain('describeModule(\'route:foo\', \'Unit | Route | foo\'');
- }));
- });
-
- it('route-test foo for mocha v0.12+', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.12.0'))
- .then(() => emberGenerateDestroy(['route-test', 'foo'], (_file) => {
- expect(_file('tests/unit/routes/foo-test.js'))
- .to.contain('import { describe, it } from \'mocha\';')
- .to.contain('import { setupTest } from \'ember-mocha\';')
- .to.contain('describe(\'Unit | Route | foo\', function() {')
- .to.contain('setupTest(\'route:foo\',');
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/service-test.js
|
@@ -15,195 +15,198 @@ const generateFakePackageManifest = require('../helpers/generate-fake-package-ma
describe('Blueprint: service', function() {
setupTestHooks(this);
- it('service foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['service', 'foo'], _file => {
+ describe('in app', function() {
+ beforeEach(function() {
+ return emberNew();
+ });
+
+ it('service foo', function() {
+ return emberGenerateDestroy(['service', 'foo'], _file => {
expect(_file('app/services/foo.js'))
.to.contain("import Service from '@ember/service';")
.to.contain('export default Service.extend({\n});');
expect(_file('tests/unit/services/foo-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('service:foo'");
- }));
- });
+ });
+ });
- it('service foo/bar', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['service', 'foo/bar'], _file => {
+ it('service foo/bar', function() {
+ return emberGenerateDestroy(['service', 'foo/bar'], _file => {
expect(_file('app/services/foo/bar.js'))
.to.contain("import Service from '@ember/service';")
.to.contain('export default Service.extend({\n});');
expect(_file('tests/unit/services/foo/bar-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('service:foo/bar'");
- }));
- });
- it('in-addon service foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['service', 'foo'], _file => {
- expect(_file('addon/services/foo.js'))
- .to.contain("import Service from '@ember/service';")
- .to.contain('export default Service.extend({\n});');
-
- expect(_file('app/services/foo.js'))
- .to.contain("export { default } from 'my-addon/services/foo';");
-
- expect(_file('tests/unit/services/foo-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('service:foo'");
- }));
- });
+ });
+ });
- it('in-addon service foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['service', 'foo/bar'], _file => {
- expect(_file('addon/services/foo/bar.js'))
- .to.contain("import Service from '@ember/service';")
- .to.contain('export default Service.extend({\n});');
-
- expect(_file('app/services/foo/bar.js'))
- .to.contain("export { default } from 'my-addon/services/foo/bar';");
-
- expect(_file('tests/unit/services/foo/bar-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('service:foo/bar'");
- }));
- });
-
- it('service foo --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['service', 'foo', '--pod'], _file => {
+ it('service foo --pod', function() {
+ return emberGenerateDestroy(['service', 'foo', '--pod'], _file => {
expect(_file('app/foo/service.js'))
.to.contain("import Service from '@ember/service';")
.to.contain('export default Service.extend({\n});');
expect(_file('tests/unit/foo/service-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('service:foo'");
- }));
- });
+ });
+ });
- it('service foo/bar --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['service', 'foo/bar', '--pod'], _file => {
+ it('service foo/bar --pod', function() {
+ return emberGenerateDestroy(['service', 'foo/bar', '--pod'], _file => {
expect(_file('app/foo/bar/service.js'))
.to.contain("import Service from '@ember/service';")
.to.contain('export default Service.extend({\n});');
expect(_file('tests/unit/foo/bar/service-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('service:foo/bar'");
- }));
+ });
+ });
+
+ it('service-test foo', function() {
+ return emberGenerateDestroy(['service-test', 'foo'], _file => {
+ expect(_file('tests/unit/services/foo-test.js'))
+ .to.contain("import { moduleFor, test } from 'ember-qunit';")
+ .to.contain("moduleFor('service:foo'");
+ });
+ });
+
+ describe('with podModulePrefix', function() {
+ beforeEach(function() {
+ setupPodConfig({ podModulePrefix: true });
+ });
+
+ it('service foo --pod', function() {
+ return emberGenerateDestroy(['service', 'foo', '--pod'], _file => {
+ expect(_file('app/pods/foo/service.js'))
+ .to.contain("import Service from '@ember/service';")
+ .to.contain('export default Service.extend({\n});');
+
+ expect(_file('tests/unit/pods/foo/service-test.js'))
+ .to.contain("import { moduleFor, test } from 'ember-qunit';")
+ .to.contain("moduleFor('service:foo'");
+ });
+ });
+
+ it('service foo/bar --pod', function() {
+ return emberGenerateDestroy(['service', 'foo/bar', '--pod'], _file => {
+ expect(_file('app/pods/foo/bar/service.js'))
+ .to.contain("import Service from '@ember/service';")
+ .to.contain('export default Service.extend({\n});');
+
+ expect(_file('tests/unit/pods/foo/bar/service-test.js'))
+ .to.contain("import { moduleFor, test } from 'ember-qunit';")
+ .to.contain("moduleFor('service:foo/bar'");
+ });
+ });
+ });
+
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ generateFakePackageManifest('ember-cli-mocha', '0.11.0');
+ });
+
+ it('service-test foo', function() {
+ return emberGenerateDestroy(['service-test', 'foo'], _file => {
+ expect(_file('tests/unit/services/foo-test.js'))
+ .to.contain("import { describeModule, it } from 'ember-mocha';")
+ .to.contain("describeModule('service:foo', 'Unit | Service | foo'");
+ });
+ });
+
+ it('service-test foo --pod', function() {
+ return emberGenerateDestroy(['service-test', 'foo', '--pod'], _file => {
+ expect(_file('tests/unit/foo/service-test.js'))
+ .to.contain("import { describeModule, it } from 'ember-mocha';")
+ .to.contain("describeModule('service:foo', 'Unit | Service | foo'");
+ });
+ });
+ });
+
+ describe('with [email protected]', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ generateFakePackageManifest('ember-cli-mocha', '0.12.0');
+ });
+
+ it('service-test foo', function() {
+ return emberGenerateDestroy(['service-test', 'foo'], _file => {
+ expect(_file('tests/unit/services/foo-test.js'))
+ .to.contain("import { describe, it } from 'mocha';")
+ .to.contain("import { setupTest } from 'ember-mocha';")
+ .to.contain("describe('Unit | Service | foo', function() {")
+ .to.contain("setupTest('service:foo',");
+ });
+ });
+
+ it('service-test foo --pod', function() {
+ return emberGenerateDestroy(['service-test', 'foo', '--pod'], _file => {
+ expect(_file('tests/unit/foo/service-test.js'))
+ .to.contain("import { describe, it } from 'mocha';")
+ .to.contain("import { setupTest } from 'ember-mocha';")
+ .to.contain("describe('Unit | Service | foo', function() {")
+ .to.contain("setupTest('service:foo',");
+ });
+ });
+ });
});
- it('service foo --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['service', 'foo', '--pod'], _file => {
- expect(_file('app/pods/foo/service.js'))
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('service foo', function() {
+ return emberGenerateDestroy(['service', 'foo'], _file => {
+ expect(_file('addon/services/foo.js'))
.to.contain("import Service from '@ember/service';")
.to.contain('export default Service.extend({\n});');
- expect(_file('tests/unit/pods/foo/service-test.js'))
+ expect(_file('app/services/foo.js'))
+ .to.contain("export { default } from 'my-addon/services/foo';");
+
+ expect(_file('tests/unit/services/foo-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('service:foo'");
- }));
- });
+ });
+ });
- it('service foo/bar --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['service', 'foo/bar', '--pod'], _file => {
- expect(_file('app/pods/foo/bar/service.js'))
+ it('service foo/bar', function() {
+ return emberGenerateDestroy(['service', 'foo/bar'], _file => {
+ expect(_file('addon/services/foo/bar.js'))
.to.contain("import Service from '@ember/service';")
.to.contain('export default Service.extend({\n});');
- expect(_file('tests/unit/pods/foo/bar/service-test.js'))
- .to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('service:foo/bar'");
- }));
- });
+ expect(_file('app/services/foo/bar.js'))
+ .to.contain("export { default } from 'my-addon/services/foo/bar';");
- it('service-test foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['service-test', 'foo'], _file => {
- expect(_file('tests/unit/services/foo-test.js'))
+ expect(_file('tests/unit/services/foo/bar-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
- .to.contain("moduleFor('service:foo'");
- }));
- });
+ .to.contain("moduleFor('service:foo/bar'");
+ });
+ });
- it('in-addon service-test foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['service-test', 'foo'], _file => {
+ it('service-test foo', function() {
+ return emberGenerateDestroy(['service-test', 'foo'], _file => {
expect(_file('tests/unit/services/foo-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('service:foo'");
expect(_file('app/service-test/foo.js'))
.to.not.exist;
- }));
- });
-
- it('service-test foo for mocha', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.11.0'))
- .then(() => emberGenerateDestroy(['service-test', 'foo'], _file => {
- expect(_file('tests/unit/services/foo-test.js'))
- .to.contain("import { describeModule, it } from 'ember-mocha';")
- .to.contain("describeModule('service:foo', 'Unit | Service | foo'");
- }));
- });
-
- it('service-test foo for mocha --pod', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.11.0'))
- .then(() => emberGenerateDestroy(['service-test', 'foo', '--pod'], _file => {
- expect(_file('tests/unit/foo/service-test.js'))
- .to.contain("import { describeModule, it } from 'ember-mocha';")
- .to.contain("describeModule('service:foo', 'Unit | Service | foo'");
- }));
- });
-
- it('service-test foo for mocha v0.12+', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.12.0'))
- .then(() => emberGenerateDestroy(['service-test', 'foo'], _file => {
- expect(_file('tests/unit/services/foo-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("import { setupTest } from 'ember-mocha';")
- .to.contain("describe('Unit | Service | foo', function() {")
- .to.contain("setupTest('service:foo',");
- }));
- });
-
- it('service-test foo for mocha v0.12+ --pod', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => generateFakePackageManifest('ember-cli-mocha', '0.12.0'))
- .then(() => emberGenerateDestroy(['service-test', 'foo', '--pod'], _file => {
- expect(_file('tests/unit/foo/service-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("import { setupTest } from 'ember-mocha';")
- .to.contain("describe('Unit | Service | foo', function() {")
- .to.contain("setupTest('service:foo',");
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/template-test.js
|
@@ -12,101 +12,108 @@ const expect = chai.expect;
describe('Blueprint: template', function() {
setupTestHooks(this);
- it('template foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['template', 'foo'], _file => {
+ describe('in app', function() {
+ beforeEach(function() {
+ return emberNew();
+ });
+
+ it('template foo', function() {
+ return emberGenerateDestroy(['template', 'foo'], _file => {
expect(_file('app/templates/foo.hbs')).to.equal('');
- }));
- });
+ });
+ });
- it('template foo/bar', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['template', 'foo/bar'], _file => {
+ it('template foo/bar', function() {
+ return emberGenerateDestroy(['template', 'foo/bar'], _file => {
expect(_file('app/templates/foo/bar.hbs')).to.equal('');
- }));
- });
+ });
+ });
- it('template foo --pod', function() {
- return emberNew()
- .then(() => setupPodConfig({
- usePods: true
- }))
- .then(() => emberGenerateDestroy(['template', 'foo'], _file => {
- expect(_file('app/foo/template.hbs')).to.equal('');
- }));
- });
+ describe('with usePods', function() {
+ beforeEach(function() {
+ setupPodConfig({ usePods: true });
+ });
- it('template foo/bar --pod', function() {
- return emberNew()
- .then(() => setupPodConfig({
- usePods: true
- }))
- .then(() => emberGenerateDestroy(['template', 'foo/bar'], _file => {
- expect(_file('app/foo/bar/template.hbs')).to.equal('');
- }));
- });
+ it('template foo', function() {
+ return emberGenerateDestroy(['template', 'foo'], _file => {
+ expect(_file('app/foo/template.hbs')).to.equal('');
+ });
+ });
- it('template foo --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({
- usePods: true,
- podModulePrefix: true
- }))
- .then(() => emberGenerateDestroy(['template', 'foo'], _file => {
- expect(_file('app/pods/foo/template.hbs')).to.equal('');
- }));
- });
+ it('template foo/bar', function() {
+ return emberGenerateDestroy(['template', 'foo/bar'], _file => {
+ expect(_file('app/foo/bar/template.hbs')).to.equal('');
+ });
+ });
+ });
+
+ describe('with usePods + podModulePrefix', function() {
+ beforeEach(function() {
+ setupPodConfig({
+ usePods: true,
+ podModulePrefix: true
+ });
+ });
- it('template foo/bar --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({
- usePods: true,
- podModulePrefix: true
- }))
- .then(() => emberGenerateDestroy(['template', 'foo/bar'], _file => {
- expect(_file('app/pods/foo/bar/template.hbs')).to.equal('');
- }));
+ it('template foo', function() {
+ return emberGenerateDestroy(['template', 'foo'], _file => {
+ expect(_file('app/pods/foo/template.hbs')).to.equal('');
+ });
+ });
+
+ it('template foo/bar', function() {
+ return emberGenerateDestroy(['template', 'foo/bar'], _file => {
+ expect(_file('app/pods/foo/bar/template.hbs')).to.equal('');
+ });
+ });
+ });
});
- it('in-addon template foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['template', 'foo'], _file => {
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('template foo', function() {
+ return emberGenerateDestroy(['template', 'foo'], _file => {
expect(_file('addon/templates/foo.hbs')).to.equal('');
- }));
- });
+ });
+ });
- it('in-addon template foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['template', 'foo/bar'], _file => {
+ it('template foo/bar', function() {
+ return emberGenerateDestroy(['template', 'foo/bar'], _file => {
expect(_file('addon/templates/foo/bar.hbs')).to.equal('');
- }));
- });
+ });
+ });
- it('dummy template foo', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['template', 'foo', '--dummy'], _file => {
+ it('template foo --dummy', function() {
+ return emberGenerateDestroy(['template', 'foo', '--dummy'], _file => {
expect(_file('tests/dummy/app/templates/foo.hbs')).to.equal('');
- }));
- });
+ });
+ });
- it('dummy template foo/bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['template', 'foo/bar', '--dummy'], _file => {
+ it('template foo/bar --dummy', function() {
+ return emberGenerateDestroy(['template', 'foo/bar', '--dummy'], _file => {
expect(_file('tests/dummy/app/templates/foo/bar.hbs')).to.equal('');
- }));
+ });
+ });
});
- it('in-repo-addon template foo', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['template', 'foo', '--in-repo-addon=my-addon'], _file => {
+ describe('in in-repo-addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'in-repo-addon' });
+ });
+
+ it('template foo --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['template', 'foo', '--in-repo-addon=my-addon'], _file => {
expect(_file('lib/my-addon/addon/templates/foo.hbs')).to.equal('');
- }));
- });
+ });
+ });
- it('in-repo-addon template foo/bar', function() {
- return emberNew({ target: 'in-repo-addon' })
- .then(() => emberGenerateDestroy(['template', 'foo/bar', '--in-repo-addon=my-addon'], _file => {
+ it('template foo/bar --in-repo-addon=my-addon', function() {
+ return emberGenerateDestroy(['template', 'foo/bar', '--in-repo-addon=my-addon'], _file => {
expect(_file('lib/my-addon/addon/templates/foo/bar.hbs')).to.equal('');
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/test-helper-test.js
|
@@ -11,12 +11,17 @@ const expect = chai.expect;
describe('Blueprint: test-helper', function() {
setupTestHooks(this);
- it('test-helper foo', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['test-helper', 'foo'], _file => {
+ describe('in app', function() {
+ beforeEach(function() {
+ return emberNew();
+ });
+
+ it('test-helper foo', function() {
+ return emberGenerateDestroy(['test-helper', 'foo'], _file => {
expect(_file('tests/helpers/foo.js'))
.to.contain("import { registerAsyncHelper } from '@ember/test';")
.to.contain('export default registerAsyncHelper(\'foo\', function(app) {\n\n}');
- }));
+ });
+ });
});
});
| true |
Other
|
emberjs
|
ember.js
|
304f6c16fb5784f14a3d8fd8a394c778af938088.json
|
tests/blueprints: Use describe() blocks to setup preconditions
|
node-tests/blueprints/util-test.js
|
@@ -13,131 +13,143 @@ const expect = chai.expect;
describe('Blueprint: util', function() {
setupTestHooks(this);
- it('util foo-bar', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['util', 'foo-bar'], _file => {
+ describe('in app', function() {
+ beforeEach(function() {
+ return emberNew();
+ });
+
+ it('util foo-bar', function() {
+ return emberGenerateDestroy(['util', 'foo-bar'], _file => {
expect(_file('app/utils/foo-bar.js'))
.to.contain('export default function fooBar() {\n' +
' return true;\n' +
'}');
expect(_file('tests/unit/utils/foo-bar-test.js'))
.to.contain("import fooBar from 'my-app/utils/foo-bar';");
- }));
- });
+ });
+ });
- it('util foo-bar/baz', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['util', 'foo/bar-baz'], _file => {
+ it('util foo-bar/baz', function() {
+ return emberGenerateDestroy(['util', 'foo/bar-baz'], _file => {
expect(_file('app/utils/foo/bar-baz.js'))
.to.contain('export default function fooBarBaz() {\n' +
' return true;\n' +
'}');
expect(_file('tests/unit/utils/foo/bar-baz-test.js'))
.to.contain("import fooBarBaz from 'my-app/utils/foo/bar-baz';");
- }));
- });
+ });
+ });
- it('in-addon util foo-bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['util', 'foo-bar'], _file => {
- expect(_file('addon/utils/foo-bar.js'))
+ it('util foo-bar --pod', function() {
+ return emberGenerateDestroy(['util', 'foo-bar', '--pod'], _file => {
+ expect(_file('app/utils/foo-bar.js'))
.to.contain('export default function fooBar() {\n' +
' return true;\n' +
'}');
- expect(_file('app/utils/foo-bar.js'))
- .to.contain("export { default } from 'my-addon/utils/foo-bar';");
-
expect(_file('tests/unit/utils/foo-bar-test.js'))
- .to.contain("import fooBar from 'dummy/utils/foo-bar';");
- }));
- });
+ .to.contain("import fooBar from 'my-app/utils/foo-bar';");
+ });
+ });
- it('in-addon util foo-bar/baz', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['util', 'foo/bar-baz'], _file => {
- expect(_file('addon/utils/foo/bar-baz.js'))
+ it('util foo-bar/baz --pod', function() {
+ return emberGenerateDestroy(['util', 'foo/bar-baz', '--pod'], _file => {
+ expect(_file('app/utils/foo/bar-baz.js'))
.to.contain('export default function fooBarBaz() {\n' +
' return true;\n' +
'}');
- expect(_file('app/utils/foo/bar-baz.js'))
- .to.contain("export { default } from 'my-addon/utils/foo/bar-baz';");
-
expect(_file('tests/unit/utils/foo/bar-baz-test.js'))
- .to.contain("import fooBarBaz from 'dummy/utils/foo/bar-baz';");
- }));
- });
-
- it('util foo-bar --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['util', 'foo-bar', '--pod'], _file => {
- expect(_file('app/utils/foo-bar.js'))
- .to.contain('export default function fooBar() {\n' +
- ' return true;\n' +
- '}');
+ .to.contain("import fooBarBaz from 'my-app/utils/foo/bar-baz';");
+ });
+ });
+ it('util-test foo-bar', function() {
+ return emberGenerateDestroy(['util-test', 'foo-bar'], _file => {
expect(_file('tests/unit/utils/foo-bar-test.js'))
.to.contain("import fooBar from 'my-app/utils/foo-bar';");
- }));
+ });
+ });
+
+ describe('with podModulePrefix', function() {
+ beforeEach(function() {
+ return setupPodConfig({ podModulePrefix: true });
+ });
+
+ it('util foo-bar --pod', function() {
+ return emberGenerateDestroy(['util', 'foo-bar', '--pod'], _file => {
+ expect(_file('app/utils/foo-bar.js'))
+ .to.contain('export default function fooBar() {\n' +
+ ' return true;\n' +
+ '}');
+
+ expect(_file('tests/unit/utils/foo-bar-test.js'))
+ .to.contain("import fooBar from 'my-app/utils/foo-bar';");
+ });
+ });
+ });
+
+ describe('with ember-cli-mocha', function() {
+ beforeEach(function() {
+ modifyPackages([
+ { name: 'ember-cli-qunit', delete: true },
+ { name: 'ember-cli-mocha', dev: true }
+ ]);
+ });
+
+ it('util-test foo-bar', function() {
+ return emberGenerateDestroy(['util-test', 'foo-bar'], _file => {
+ expect(_file('tests/unit/utils/foo-bar-test.js'))
+ .to.contain("import { describe, it } from 'mocha';")
+ .to.contain("import fooBar from 'my-app/utils/foo-bar';")
+ .to.contain("describe('Unit | Utility | foo bar', function() {");
+ });
+ });
+ });
});
- it('util foo-bar --pod podModulePrefix', function() {
- return emberNew()
- .then(() => setupPodConfig({ podModulePrefix: true }))
- .then(() => emberGenerateDestroy(['util', 'foo-bar', '--pod'], _file => {
- expect(_file('app/utils/foo-bar.js'))
+ describe('in addon', function() {
+ beforeEach(function() {
+ return emberNew({ target: 'addon' });
+ });
+
+ it('util foo-bar', function() {
+ return emberGenerateDestroy(['util', 'foo-bar'], _file => {
+ expect(_file('addon/utils/foo-bar.js'))
.to.contain('export default function fooBar() {\n' +
- ' return true;\n' +
- '}');
+ ' return true;\n' +
+ '}');
+
+ expect(_file('app/utils/foo-bar.js'))
+ .to.contain("export { default } from 'my-addon/utils/foo-bar';");
expect(_file('tests/unit/utils/foo-bar-test.js'))
- .to.contain("import fooBar from 'my-app/utils/foo-bar';");
- }));
- });
+ .to.contain("import fooBar from 'dummy/utils/foo-bar';");
+ });
+ });
- it('util foo-bar/baz --pod', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['util', 'foo/bar-baz', '--pod'], _file => {
- expect(_file('app/utils/foo/bar-baz.js'))
+ it('util foo-bar/baz', function() {
+ return emberGenerateDestroy(['util', 'foo/bar-baz'], _file => {
+ expect(_file('addon/utils/foo/bar-baz.js'))
.to.contain('export default function fooBarBaz() {\n' +
- ' return true;\n' +
- '}');
+ ' return true;\n' +
+ '}');
- expect(_file('tests/unit/utils/foo/bar-baz-test.js'))
- .to.contain("import fooBarBaz from 'my-app/utils/foo/bar-baz';");
- }));
- });
+ expect(_file('app/utils/foo/bar-baz.js'))
+ .to.contain("export { default } from 'my-addon/utils/foo/bar-baz';");
- it('util-test foo-bar', function() {
- return emberNew()
- .then(() => emberGenerateDestroy(['util-test', 'foo-bar'], _file => {
- expect(_file('tests/unit/utils/foo-bar-test.js'))
- .to.contain("import fooBar from 'my-app/utils/foo-bar';");
- }));
- });
+ expect(_file('tests/unit/utils/foo/bar-baz-test.js'))
+ .to.contain("import fooBarBaz from 'dummy/utils/foo/bar-baz';");
+ });
+ });
- it('in-addon util-test foo-bar', function() {
- return emberNew({ target: 'addon' })
- .then(() => emberGenerateDestroy(['util-test', 'foo-bar'], _file => {
+ it('util-test foo-bar', function() {
+ return emberGenerateDestroy(['util-test', 'foo-bar'], _file => {
expect(_file('tests/unit/utils/foo-bar-test.js'))
.to.contain("import fooBar from 'dummy/utils/foo-bar';");
- }));
- });
-
- it('util-test foo-bar for mocha', function() {
- return emberNew()
- .then(() => modifyPackages([
- { name: 'ember-cli-qunit', delete: true },
- { name: 'ember-cli-mocha', dev: true }
- ]))
- .then(() => emberGenerateDestroy(['util-test', 'foo-bar'], _file => {
- expect(_file('tests/unit/utils/foo-bar-test.js'))
- .to.contain("import { describe, it } from 'mocha';")
- .to.contain("import fooBar from 'my-app/utils/foo-bar';")
- .to.contain("describe('Unit | Utility | foo bar', function() {");
- }));
+ });
+ });
});
});
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.