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
|
c32446792cee3f1006c00b2aa546438693a6cae5.json
|
Remove usage of `LOOKUP_FACTORY`.
This was added as a "backdoor" to use `container.lookupFactory`
(and its double extend semantics) without triggering a deprecation.
|
packages/container/tests/container_test.js
|
@@ -3,7 +3,6 @@ import { ENV } from 'ember-environment';
import { get } from 'ember-metal';
import { Registry } from '..';
import { factory } from 'internal-test-helpers';
-import { LOOKUP_FACTORY } from 'container';
let originalModelInjections;
@@ -17,7 +16,12 @@ QUnit.module('Container', {
});
function lookupFactory(name, container, options) {
- return container[LOOKUP_FACTORY](name, options);
+ let factory;
+ expectDeprecation(() => {
+ factory = container.lookupFactory(name, options);
+ }, 'Using "_lookupFactory" is deprecated. Please use container.factoryFor instead.');
+
+ return factory;
}
QUnit.test('A registered factory returns the same instance each time', function() {
@@ -477,7 +481,7 @@ QUnit.test('factory for non extendables resolves are cached', function() {
});
QUnit.test('The `_onLookup` hook is called on factories when looked up the first time', function() {
- expect(2);
+ expect(4); // 2 are from expectDeprecation in `lookupFactory`
let registry = new Registry();
let container = registry.container();
| true |
Other
|
emberjs
|
ember.js
|
c32446792cee3f1006c00b2aa546438693a6cae5.json
|
Remove usage of `LOOKUP_FACTORY`.
This was added as a "backdoor" to use `container.lookupFactory`
(and its double extend semantics) without triggering a deprecation.
|
packages/ember-application/lib/system/engine-instance.js
|
@@ -12,7 +12,7 @@ import {
} from 'ember-runtime';
import { assert, Error as EmberError } from 'ember-debug';
import { run } from 'ember-metal';
-import { Registry, LOOKUP_FACTORY, privatize as P } from 'container';
+import { Registry, privatize as P } from 'container';
import { getEngineParent, setEngineParent } from './engine-parent';
/**
@@ -195,10 +195,6 @@ const EngineInstance = EmberObject.extend(RegistryProxyMixin, ContainerProxyMixi
this.inject('view', '_environment', '-environment:main');
this.inject('route', '_environment', '-environment:main');
- },
-
- [LOOKUP_FACTORY](fullName, options) {
- return this.__container__[LOOKUP_FACTORY](fullName, options);
}
});
| true |
Other
|
emberjs
|
ember.js
|
c32446792cee3f1006c00b2aa546438693a6cae5.json
|
Remove usage of `LOOKUP_FACTORY`.
This was added as a "backdoor" to use `container.lookupFactory`
(and its double extend semantics) without triggering a deprecation.
|
packages/ember-runtime/lib/mixins/container_proxy.js
|
@@ -6,9 +6,6 @@ import {
Mixin,
run
} from 'ember-metal';
-import {
- LOOKUP_FACTORY
-} from 'container';
/**
ContainerProxyMixin is used to provide public access to specific
@@ -110,10 +107,6 @@ let containerProxyMixin = {
return this.__container__.lookupFactory(fullName, options);
},
- [LOOKUP_FACTORY]() {
- return this.__container__[LOOKUP_FACTORY](...arguments);
- },
-
/**
Given a name and a source path, resolve the fullName
| true |
Other
|
emberjs
|
ember.js
|
c32446792cee3f1006c00b2aa546438693a6cae5.json
|
Remove usage of `LOOKUP_FACTORY`.
This was added as a "backdoor" to use `container.lookupFactory`
(and its double extend semantics) without triggering a deprecation.
|
packages/internal-test-helpers/lib/build-owner.js
|
@@ -1,4 +1,4 @@
-import { Registry, LOOKUP_FACTORY } from 'container';
+import { Registry } from 'container';
import { Router } from 'ember-routing';
import {
Application,
@@ -15,17 +15,7 @@ export default function buildOwner(options = {}) {
let resolver = options.resolver;
let bootOptions = options.bootOptions || {};
- let Owner = EmberObject.extend(RegistryProxyMixin, ContainerProxyMixin, {
- [LOOKUP_FACTORY]() {
- return this.__container__[LOOKUP_FACTORY](...arguments);
- }
- });
-
- Owner.reopen({
- factoryFor() {
- return this.__container__.factoryFor(...arguments);
- }
- });
+ let Owner = EmberObject.extend(RegistryProxyMixin, ContainerProxyMixin);
let namespace = EmberObject.create({
Resolver: { create() { return resolver; } }
| true |
Other
|
emberjs
|
ember.js
|
a97f8c5c5181c776896591db34216697f199d7a1.json
|
add test for binding in input type=checkbox
|
packages/ember-glimmer/lib/components/checkbox.js
|
@@ -51,7 +51,6 @@ export default EmberComponent.extend({
],
type: 'checkbox',
- checked: false,
disabled: false,
indeterminate: false,
@@ -61,6 +60,6 @@ export default EmberComponent.extend({
},
change() {
- set(this, 'checked', this.$().prop('checked'));
+ set(this, 'checked', this.$().prop('checked'));
}
});
| true |
Other
|
emberjs
|
ember.js
|
a97f8c5c5181c776896591db34216697f199d7a1.json
|
add test for binding in input type=checkbox
|
packages/ember-glimmer/tests/integration/helpers/input-test.js
|
@@ -535,6 +535,17 @@ moduleFor(`Helpers test: {{input type='checkbox'}}`, class extends InputRenderin
this.assertCheckboxIsChecked();
}
+ ['@test native click changes check property'](assert) {
+ this.render(`{{input type="checkbox"}}`);
+
+ this.assertSingleCheckbox();
+ this.assertCheckboxIsNotChecked();
+ this.$input()[0].click();
+ this.assertCheckboxIsChecked();
+ this.$input()[0].click();
+ this.assertCheckboxIsNotChecked();
+ }
+
['@test with static values'](assert) {
this.render(`{{input type="checkbox" disabled=false tabindex=10 name="original-name" checked=false}}`);
@@ -552,7 +563,6 @@ moduleFor(`Helpers test: {{input type='checkbox'}}`, class extends InputRenderin
this.assertAttr('tabindex', '10');
this.assertAttr('name', 'original-name');
}
-
});
moduleFor(`Helpers test: {{input type='text'}}`, class extends InputRenderingTest {
| true |
Other
|
emberjs
|
ember.js
|
a1e3a9fbf2560ca77a4956780971d83b71eacb14.json
|
remove old deprecation flag in Map/OrderedSet
|
packages/ember-metal/lib/map.js
|
@@ -65,7 +65,6 @@ function copyMap(original, newObject) {
function OrderedSet() {
if (this instanceof OrderedSet) {
this.clear();
- this._silenceRemoveDeprecation = false;
} else {
missingNew('OrderedSet');
}
@@ -209,7 +208,6 @@ OrderedSet.prototype = {
let Constructor = this.constructor;
let set = new Constructor();
- set._silenceRemoveDeprecation = this._silenceRemoveDeprecation;
set.presenceSet = copyNull(this.presenceSet);
set.list = this.toArray();
set.size = this.size;
@@ -241,7 +239,6 @@ OrderedSet.prototype = {
function Map() {
if (this instanceof Map) {
this._keys = OrderedSet.create();
- this._keys._silenceRemoveDeprecation = true;
this._values = Object.create(null);
this.size = 0;
} else {
| false |
Other
|
emberjs
|
ember.js
|
fe59f2cafbc53b737b5542edbe7549c1e0a4dab0.json
|
Improve test names
|
packages/ember-routing/tests/system/controller_for_test.js
|
@@ -27,23 +27,22 @@ moduleFor('Ember.generateController', class extends ApplicationTestCase {
});
}
- ['@test generateController should return App.Controller if provided'](assert) {
- let MainController = Controller.extend();
- this.add('controller:basic', MainController);
+ ['@test generateController should return controller:basic if resolved'](assert) {
+ let BasicController = Controller.extend();
+ this.add('controller:basic', BasicController);
return this.visit('/').then(() => {
let controller = generateController(this.applicationInstance, 'home');
- assert.ok(controller instanceof MainController, 'should return controller');
+ assert.ok(controller instanceof BasicController, 'should return controller');
});
}
- ['@test generateController should return controller:basic if provided'](assert) {
- let controller;
+ ['@test generateController should return controller:basic if registered'](assert) {
let BasicController = Controller.extend();
- this.add('controller:basic', BasicController);
+ this.application.register('controller:basic', BasicController);
return this.visit('/').then(() => {
- controller = generateController(this.applicationInstance, 'home');
+ let controller = generateController(this.applicationInstance, 'home');
if (EMBER_NO_DOUBLE_EXTEND) {
assert.ok(controller instanceof BasicController, 'should return base class of controller');
| false |
Other
|
emberjs
|
ember.js
|
f97fae97ef1ead675d26812a1ba610586d7dacc2.json
|
Remove 1.13 deprecations
|
packages/ember-application/lib/utils/validate-type.js
|
@@ -21,20 +21,9 @@ export default function validateType(resolvedType, parsedName) {
let [action, factoryFlag, expectedType] = validationAttributes;
- if (action === 'deprecate') {
- deprecate(
- `In Ember 2.0 ${parsedName.type} factories must have an \`${factoryFlag}\` ` +
- `property set to true. You registered ${resolvedType} as a ${parsedName.type} ` +
- `factory. Either add the \`${factoryFlag}\` property to this factory or ` +
- `extend from ${expectedType}.`,
- !!resolvedType[factoryFlag],
- { id: 'ember-application.validate-type', until: '3.0.0' }
- );
- } else {
- assert(
- `Expected ${parsedName.fullName} to resolve to an ${expectedType} but ` +
- `instead it was ${resolvedType}.`,
- !!resolvedType[factoryFlag]
- );
- }
+ assert(
+ `Expected ${parsedName.fullName} to resolve to an ${expectedType} but ` +
+ `instead it was ${resolvedType}.`,
+ !!resolvedType[factoryFlag]
+ );
}
| true |
Other
|
emberjs
|
ember.js
|
f97fae97ef1ead675d26812a1ba610586d7dacc2.json
|
Remove 1.13 deprecations
|
packages/ember-application/tests/system/dependency_injection/default_resolver_test.js
|
@@ -20,7 +20,6 @@ import {
setTemplate,
Helper,
helper as makeHelper,
- makeBoundHelper as makeHTMLBarsBoundHelper
} from 'ember-glimmer';
import { compile } from 'ember-template-compiler';
@@ -157,21 +156,14 @@ QUnit.test('the default resolver resolves helpers on the namespace', function()
let CompleteHelper = Helper.extend();
let LegacyHTMLBarsBoundHelper;
- expectDeprecation(() => {
- LegacyHTMLBarsBoundHelper = makeHTMLBarsBoundHelper(() => {});
- }, 'Using `Ember.HTMLBars.makeBoundHelper` is deprecated. Please refactor to use `Ember.Helper` or `Ember.Helper.helper`.');
-
application.ShorthandHelper = ShorthandHelper;
application.CompleteHelper = CompleteHelper;
- application.LegacyHtmlBarsBoundHelper = LegacyHTMLBarsBoundHelper; // Must use lowered "tml" in "HTMLBars" for resolver to find this
let resolvedShorthand = registry.resolve('helper:shorthand');
let resolvedComplete = registry.resolve('helper:complete');
- let resolvedLegacyHTMLBars = registry.resolve('helper:legacy-html-bars-bound');
equal(resolvedShorthand, ShorthandHelper, 'resolve fetches the shorthand helper factory');
equal(resolvedComplete, CompleteHelper, 'resolve fetches the complete helper factory');
- equal(resolvedLegacyHTMLBars, LegacyHTMLBarsBoundHelper, 'resolves legacy HTMLBars bound helper');
});
QUnit.test('the default resolver resolves to the same instance, no matter the notation ', function() {
@@ -270,21 +262,23 @@ QUnit.test('no assertion for routes that extend from Ember.Route', function() {
});
QUnit.test('deprecation warning for service factories without isServiceFactory property', function() {
- expectDeprecation(/service factories must have an `isServiceFactory` property/);
- application.FooService = EmberObject.extend();
- registry.resolve('service:foo');
+ expectAssertion(() =>{
+ application.FooService = EmberObject.extend();
+ registry.resolve('service:foo');
+ }, /Expected service:foo to resolve to an Ember.Service but instead it was \.FooService\./);
});
QUnit.test('no deprecation warning for service factories that extend from Ember.Service', function() {
- expectNoDeprecation();
+ expect(0);
application.FooService = Service.extend();
registry.resolve('service:foo');
});
QUnit.test('deprecation warning for component factories without isComponentFactory property', function() {
- expectDeprecation(/component factories must have an `isComponentFactory` property/);
- application.FooComponent = EmberObject.extend();
- registry.resolve('component:foo');
+ expectAssertion(() => {
+ application.FooComponent = EmberObject.extend();
+ registry.resolve('component:foo');
+ }, /Expected component:foo to resolve to an Ember\.Component but instead it was \.FooComponent\./);
});
QUnit.test('no deprecation warning for component factories that extend from Ember.Component', function() {
| true |
Other
|
emberjs
|
ember.js
|
f97fae97ef1ead675d26812a1ba610586d7dacc2.json
|
Remove 1.13 deprecations
|
packages/ember-glimmer/lib/index.js
|
@@ -204,7 +204,6 @@ export { default as LinkComponent } from './components/link-to';
export { default as Component } from './component';
export { default as Helper, helper } from './helper';
export { default as Environment } from './environment';
-export { default as makeBoundHelper } from './make-bound-helper';
export {
SafeString,
escapeExpression,
| true |
Other
|
emberjs
|
ember.js
|
f97fae97ef1ead675d26812a1ba610586d7dacc2.json
|
Remove 1.13 deprecations
|
packages/ember-glimmer/lib/make-bound-helper.js
|
@@ -1,58 +0,0 @@
-/**
-@module ember
-@submodule ember-glimmer
-*/
-import { deprecate } from 'ember-debug';
-import { helper } from './helper';
-
-/**
- Create a bound helper. Accepts a function that receives the ordered and hash parameters
- from the template. If a bound property was provided in the template, it will be resolved to its
- value and any changes to the bound property cause the helper function to be re-run with the updated
- values.
-
- * `params` - An array of resolved ordered parameters.
- * `hash` - An object containing the hash parameters.
-
- For example:
-
- * With an unquoted ordered parameter:
-
- ```javascript
- {{x-capitalize foo}}
- ```
-
- Assuming `foo` was set to `"bar"`, the bound helper would receive `["bar"]` as its first argument, and
- an empty hash as its second.
-
- * With a quoted ordered parameter:
-
- ```javascript
- {{x-capitalize "foo"}}
- ```
-
- The bound helper would receive `["foo"]` as its first argument, and an empty hash as its second.
-
- * With an unquoted hash parameter:
-
- ```javascript
- {{x-repeat "foo" count=repeatCount}}
- ```
-
- Assuming that `repeatCount` resolved to 2, the bound helper would receive `["foo"]` as its first argument,
- and { count: 2 } as its second.
-
- @private
- @method makeBoundHelper
- @for Ember.HTMLBars
- @param {Function} fn
- @since 1.10.0
-*/
-export default function makeBoundHelper(fn) {
- deprecate(
- 'Using `Ember.HTMLBars.makeBoundHelper` is deprecated. Please refactor to use `Ember.Helper` or `Ember.Helper.helper`.',
- false,
- { id: 'ember-htmlbars.make-bound-helper', until: '3.0.0' }
- );
- return helper(fn);
-}
| true |
Other
|
emberjs
|
ember.js
|
f97fae97ef1ead675d26812a1ba610586d7dacc2.json
|
Remove 1.13 deprecations
|
packages/ember-glimmer/tests/integration/helpers/custom-helper-test.js
|
@@ -1,6 +1,5 @@
/* globals EmberDev */
import { RenderingTest, moduleFor } from '../../utils/test-case';
-import { makeBoundHelper } from '../../utils/helpers';
import { runDestroy } from 'internal-test-helpers';
import { set } from 'ember-metal';
import { HAS_NATIVE_WEAKMAP } from 'ember-utils';
@@ -57,24 +56,6 @@ moduleFor('Helpers test: custom helpers', class extends RenderingTest {
this.assertText('');
}
- ['@test it can resolve custom makeBoundHelper with or without dashes [DEPRECATED]']() {
- expectDeprecation(() => {
- this.owner.register('helper:hello', makeBoundHelper(() => 'hello'));
- }, 'Using `Ember.HTMLBars.makeBoundHelper` is deprecated. Please refactor to use `Ember.Helper` or `Ember.Helper.helper`.');
-
- expectDeprecation(() => {
- this.owner.register('helper:hello-world', makeBoundHelper(() => 'hello world'));
- }, 'Using `Ember.HTMLBars.makeBoundHelper` is deprecated. Please refactor to use `Ember.Helper` or `Ember.Helper.helper`.');
-
- this.render('{{hello}} | {{hello-world}}');
-
- this.assertText('hello | hello world');
-
- this.runTask(() => this.rerender());
-
- this.assertText('hello | hello world');
- }
-
['@test it can resolve custom class-based helpers with or without dashes']() {
this.registerHelper('hello', {
compute() {
| true |
Other
|
emberjs
|
ember.js
|
f97fae97ef1ead675d26812a1ba610586d7dacc2.json
|
Remove 1.13 deprecations
|
packages/ember-glimmer/tests/utils/helpers.js
|
@@ -13,7 +13,6 @@ export {
TextField,
InteractiveRender,
InertRenderer,
- makeBoundHelper,
htmlSafe,
SafeString,
DOMChanges,
| true |
Other
|
emberjs
|
ember.js
|
f97fae97ef1ead675d26812a1ba610586d7dacc2.json
|
Remove 1.13 deprecations
|
packages/ember-metal/tests/main_test.js
|
@@ -32,18 +32,6 @@ QUnit.test('SEMVER_REGEX properly validates and invalidates version numbers', fu
validateVersionString('1.11', false);
});
-QUnit.test('Ember.keys is deprecated', function() {
- expectDeprecation(function() {
- Ember.keys({});
- }, 'Ember.keys is deprecated in favor of Object.keys');
-});
-
-QUnit.test('Ember.create is deprecated', function() {
- expectDeprecation(function() {
- Ember.create(null);
- }, 'Ember.create is deprecated in favor of Object.create');
-});
-
QUnit.test('Ember.Backburner is deprecated', function() {
expectDeprecation(function() {
new Ember.Backburner(['foo']);
| true |
Other
|
emberjs
|
ember.js
|
f97fae97ef1ead675d26812a1ba610586d7dacc2.json
|
Remove 1.13 deprecations
|
packages/ember/lib/index.js
|
@@ -482,7 +482,6 @@ import {
template,
escapeExpression,
isHTMLSafe,
- makeBoundHelper,
getTemplates,
setTemplates,
_getSafeString
@@ -515,7 +514,6 @@ EmberHandleBarsUtils.escapeExpression = escapeExpression;
EmberString.htmlSafe = htmlSafe;
EmberString.isHTMLSafe = isHTMLSafe;
-EmberHTMLBars.makeBoundHelper = makeBoundHelper;
/**
Global hash of shared templates. This will automatically be populated
@@ -547,9 +545,6 @@ Ember.VERSION = VERSION;
metal.libraries.registerCoreLibrary('Ember', VERSION);
-Ember.create = deprecateFunc('Ember.create is deprecated in favor of Object.create', { id: 'ember-metal.ember-create', until: '3.0.0' }, Object.create);
-Ember.keys = deprecateFunc('Ember.keys is deprecated in favor of Object.keys', { id: 'ember-metal.ember.keys', until: '3.0.0' }, Object.keys);
-
// require the main entry points for each of these packages
// this is so that the global exports occur properly
import * as views from 'ember-views';
| true |
Other
|
emberjs
|
ember.js
|
f97fae97ef1ead675d26812a1ba610586d7dacc2.json
|
Remove 1.13 deprecations
|
packages/ember/tests/reexports_test.js
|
@@ -143,7 +143,6 @@ QUnit.module('ember reexports');
['Handlebars.SafeString', 'ember-glimmer', { get: '_getSafeString' }],
['Handlebars.Utils.escapeExpression', 'ember-glimmer', 'escapeExpression'],
['String.htmlSafe', 'ember-glimmer', 'htmlSafe'],
- ['HTMLBars.makeBoundHelper', 'ember-glimmer', 'makeBoundHelper'],
// ember-runtime
['_RegistryProxyMixin', 'ember-runtime', 'RegistryProxyMixin'],
| true |
Other
|
emberjs
|
ember.js
|
7b7e20e2297f63b26dd1dbd3455b63e06b6c591e.json
|
Implement feedback from merge party
|
packages/ember-glimmer/lib/environment.js
|
@@ -151,16 +151,12 @@ export default class Environment extends GlimmerEnvironment {
getComponentDefinition(path, symbolTable) {
let name = path[0];
- let finalizer = _instrumentStart('render.compile', instrumentationPayload, name);
+ let finalizer = _instrumentStart('render.getComponentDefinition', instrumentationPayload, name);
let blockMeta = symbolTable.getMeta();
let owner = blockMeta.owner;
let source = blockMeta.moduleName && `template:${blockMeta.moduleName}`;
let definition = this._definitionCache.get({ name, source, owner });
- if (definition) {
- definition.finalizer = finalizer;
- } else {
- finalizer();
- }
+ finalizer();
return definition;
}
| true |
Other
|
emberjs
|
ember.js
|
7b7e20e2297f63b26dd1dbd3455b63e06b6c591e.json
|
Implement feedback from merge party
|
packages/ember-glimmer/lib/syntax/curly-component.js
|
@@ -175,8 +175,6 @@ class CurlyComponentManager extends AbstractManager {
}
create(environment, definition, args, dynamicScope, callerSelfRef, hasBlock) {
- definition.finalizer();
-
if (DEBUG) {
this._pushToDebugStack(`component:${definition.name}`, environment)
}
@@ -423,7 +421,6 @@ export class CurlyComponentDefinition extends ComponentDefinition {
super(name, MANAGER, ComponentClass);
this.template = template;
this.args = args;
- this.finalizer = () => {};
}
}
| true |
Other
|
emberjs
|
ember.js
|
7b7e20e2297f63b26dd1dbd3455b63e06b6c591e.json
|
Implement feedback from merge party
|
packages/ember-glimmer/tests/integration/components/instrumentation-compile-test.js
|
@@ -12,7 +12,7 @@ moduleFor('Components compile instrumentation', class extends RenderingTest {
this.resetEvents();
- instrumentationSubscribe('render.compile', {
+ instrumentationSubscribe('render.getComponentDefinition', {
before: (name, timestamp, payload) => {
if (payload.view !== this.component) {
this.actual.before.push(payload);
| true |
Other
|
emberjs
|
ember.js
|
0f1db78ce5ed9370482331b8668aa7057384935c.json
|
Add test coverage to Object.assign polyfill
|
packages/ember-utils/tests/assign_test.js
|
@@ -2,16 +2,37 @@ import { assignPolyfill as assign } from '..';
QUnit.module('Ember.assign');
-QUnit.test('Ember.assign', function() {
- let a = { a: 1 };
- let b = { b: 2 };
- let c = { c: 3 };
- let a2 = { a: 4 };
-
- assign(a, b, c, a2);
-
- deepEqual(a, { a: 4, b: 2, c: 3 });
- deepEqual(b, { b: 2 });
- deepEqual(c, { c: 3 });
- deepEqual(a2, { a: 4 });
+QUnit.test('merging objects', function() {
+ let trgt = { a: 1 };
+ let src1 = { b: 2 };
+ let src2 = { c: 3 };
+
+ assign(trgt, src1, src2);
+
+ deepEqual(trgt, { a: 1, b: 2, c: 3 }, 'assign copies values from one or more source objects to a target object');
+ deepEqual(src1, { b: 2 }, 'assign does not change source object 1');
+ deepEqual(src2, { c: 3 }, 'assign does not change source object 2');
+});
+
+QUnit.test('merging objects with same property', function() {
+ let trgt = { a: 1, b: 1 };
+ let src1 = { a: 2, b: 2 };
+ let src2 = { a: 3 };
+
+ assign(trgt, src1, src2);
+ deepEqual(trgt, { a: 3, b: 2 }, 'properties are overwritten by other objects that have the same properties later in the parameters order');
+});
+
+QUnit.test('null', function() {
+ let trgt = { a: 1 };
+
+ assign(trgt, null);
+ deepEqual(trgt, { a: 1 }, 'null as a source parameter is ignored');
+});
+
+QUnit.test('undefined', function() {
+ let trgt = { a: 1 };
+
+ assign(trgt, null);
+ deepEqual(trgt, { a: 1 }, 'undefined as a source parameter is ignored');
});
| false |
Other
|
emberjs
|
ember.js
|
6a017c01ac54c81b31896b2b79f6558c2dc6dc89.json
|
Use Object.assign instead of polyfill if available
- Use `Object.assign` instead of polyfill if available
- Expose `assignPolyfill` for direct testing
|
packages/ember-utils/lib/assign.js
|
@@ -15,7 +15,7 @@
@return {Object}
@public
*/
-export default function assign(original) {
+export function assign(original) {
for (let i = 1; i < arguments.length; i++) {
let arg = arguments[i];
if (!arg) { continue; }
@@ -30,3 +30,5 @@ export default function assign(original) {
return original;
}
+
+export default Object.assign || assign;
| true |
Other
|
emberjs
|
ember.js
|
6a017c01ac54c81b31896b2b79f6558c2dc6dc89.json
|
Use Object.assign instead of polyfill if available
- Use `Object.assign` instead of polyfill if available
- Expose `assignPolyfill` for direct testing
|
packages/ember-utils/lib/index.js
|
@@ -10,7 +10,10 @@
*/
export { default as symbol } from './symbol';
export { getOwner, setOwner, OWNER } from './owner';
-export { default as assign } from './assign';
+
+// Export `assignPolyfill` for testing
+export { default as assign, assign as assignPolyfill } from './assign';
+
export { default as dictionary } from './dictionary';
export {
uuid,
| true |
Other
|
emberjs
|
ember.js
|
6a017c01ac54c81b31896b2b79f6558c2dc6dc89.json
|
Use Object.assign instead of polyfill if available
- Use `Object.assign` instead of polyfill if available
- Expose `assignPolyfill` for direct testing
|
packages/ember-utils/tests/assign_test.js
|
@@ -1,4 +1,4 @@
-import { assign } from '..';
+import { assignPolyfill as assign } from '..';
QUnit.module('Ember.assign');
| true |
Other
|
emberjs
|
ember.js
|
6a017c01ac54c81b31896b2b79f6558c2dc6dc89.json
|
Use Object.assign instead of polyfill if available
- Use `Object.assign` instead of polyfill if available
- Expose `assignPolyfill` for direct testing
|
packages/ember/lib/index.js
|
@@ -25,7 +25,7 @@ Ember.tryInvoke = utils.tryInvoke;
Ember.wrap = utils.wrap;
Ember.applyStr = utils.applyStr;
Ember.uuid = utils.uuid;
-Ember.assign = Object.assign || utils.assign;
+Ember.assign = utils.assign;
// container exports
Ember.Container = Container;
| true |
Other
|
emberjs
|
ember.js
|
6a017c01ac54c81b31896b2b79f6558c2dc6dc89.json
|
Use Object.assign instead of polyfill if available
- Use `Object.assign` instead of polyfill if available
- Expose `assignPolyfill` for direct testing
|
packages/ember/tests/reexports_test.js
|
@@ -8,7 +8,7 @@ QUnit.module('ember reexports');
// ember-utils
['getOwner', 'ember-utils', 'getOwner'],
['setOwner', 'ember-utils', 'setOwner'],
- // ['assign', 'ember-metal'], TODO: fix this test, we use `Object.assign` if present
+ ['assign', 'ember-utils'],
['GUID_KEY', 'ember-utils'],
['uuid', 'ember-utils'],
['generateGuid', 'ember-utils'],
| true |
Other
|
emberjs
|
ember.js
|
ceea31a86e38e16f1d5775cefabc2fa092dd192a.json
|
Remove use of private method makeArray in examples
|
packages/ember-runtime/lib/utils.js
|
@@ -89,7 +89,7 @@ export function isArray(obj) {
Ember.typeOf(new Number(101)); // 'number'
Ember.typeOf(true); // 'boolean'
Ember.typeOf(new Boolean(true)); // 'boolean'
- Ember.typeOf(Ember.makeArray); // 'function'
+ Ember.typeOf(Ember.A); // 'function'
Ember.typeOf([1, 2, 90]); // 'array'
Ember.typeOf(/abc/); // 'regexp'
Ember.typeOf(new Date()); // 'date'
| false |
Other
|
emberjs
|
ember.js
|
99cca3ea366ac20ebbba830bcd261b25e420272d.json
|
Add test case for render.compile instrumentation
|
packages/ember-glimmer/lib/environment.js
|
@@ -57,7 +57,7 @@ import { FACTORY_FOR } from 'container';
import { default as ActionModifierManager } from './modifiers/action';
function instrumentationPayload(name) {
- return { object: name };
+ return { object: `component:${name}` };
}
export default class Environment extends GlimmerEnvironment {
| true |
Other
|
emberjs
|
ember.js
|
99cca3ea366ac20ebbba830bcd261b25e420272d.json
|
Add test case for render.compile instrumentation
|
packages/ember-glimmer/tests/integration/components/instrumentation-compile-test.js
|
@@ -0,0 +1,97 @@
+import { moduleFor, RenderingTest } from '../../utils/test-case';
+import { Component } from '../../utils/helpers';
+import {
+ instrumentationSubscribe,
+ instrumentationReset,
+ set
+} from 'ember-metal';
+
+moduleFor('Components compile instrumentation', class extends RenderingTest {
+ constructor() {
+ super();
+
+ this.resetEvents();
+
+ instrumentationSubscribe('render.compile', {
+ before: (name, timestamp, payload) => {
+ if (payload.view !== this.component) {
+ this.actual.before.push(payload);
+ }
+ },
+ after: (name, timestamp, payload) => {
+ if (payload.view !== this.component) {
+ this.actual.after.push(payload);
+ }
+ }
+ });
+ }
+
+ resetEvents() {
+ this.expected = {
+ before: [],
+ after: []
+ };
+
+ this.actual = {
+ before: [],
+ after: []
+ };
+ }
+
+ teardown() {
+ this.assert.deepEqual(this.actual.before, [], 'No unexpected events (before)');
+ this.assert.deepEqual(this.actual.after, [], 'No unexpected events (after)');
+ super.teardown();
+ instrumentationReset();
+ }
+
+ ['@test it should only receive an instrumentation event for initial render'](assert) {
+ let testCase = this;
+
+ let BaseClass = Component.extend({
+ tagName: '',
+
+ willRender() {
+ testCase.expected.before.push(this);
+ testCase.expected.after.unshift(this);
+ }
+ });
+
+ this.registerComponent('x-bar', {
+ template: '[x-bar: {{bar}}]',
+ ComponentClass: BaseClass.extend()
+ });
+
+ this.render(`[-top-level: {{foo}}] {{x-bar bar=bar}}`, {
+ foo: 'foo', bar: 'bar'
+ });
+
+ this.assertText('[-top-level: foo] [x-bar: bar]');
+
+ this.assertEvents('after initial render');
+
+ this.runTask(() => this.rerender());
+
+ this.assertEvents('after no-op rerender');
+ }
+
+ assertEvents(label) {
+ let { actual, expected } = this;
+ this.assert.strictEqual(actual.before.length, actual.after.length, `${label}: before and after callbacks should be balanced`);
+
+ this._assertEvents(`${label} (before):`, actual.before, expected.before);
+ this._assertEvents(`${label} (after):`, actual.before, expected.before);
+
+ this.resetEvents();
+ }
+
+ _assertEvents(label, actual, expected) {
+ this.assert.equal(actual.length, expected.length, `${label}: expected ${expected.length} and got ${actual.length}`);
+
+ actual.forEach((payload, i) => this.assertPayload(payload, expected[i]));
+ }
+
+ assertPayload(payload, component) {
+ this.assert.equal(payload.object, component._debugContainerKey, 'payload.object');
+ }
+});
| true |
Other
|
emberjs
|
ember.js
|
3bac3e88ebcaa95f0ac5757f6b8b1b669d9cdd4a.json
|
Add failing tests for ember-cli/6026
|
node-tests/blueprints/route-test.js
|
@@ -85,6 +85,54 @@ describe('Acceptance: ember generate and destroy route', function() {
.to.not.contain('path: \':foo_id/show\''));
});
+ it('route --reset-namespace', function() {
+ var args = ['route', 'parent/child', '--reset-namespace'];
+
+ return emberNew()
+ .then(() => emberGenerateDestroy(args, (_file) => {
+ expect(_file('app/routes/child.js'))
+ .to.contain('import Ember from \'ember\';')
+ .to.contain('export default Ember.Route.extend({\n});');
+
+ expect(_file('app/templates/child.hbs'))
+ .to.contain('{{outlet}}');
+
+ expect(_file('tests/unit/routes/child-test.js'))
+ .to.contain('import { moduleFor, test } from \'ember-qunit\';')
+ .to.contain('moduleFor(\'route:child\'');
+
+ expect(file('app/router.js'))
+ .to.contain('this.route(\'parent\', {')
+ .to.contain('this.route(\'child\', {')
+ .to.contain('resetNamespace: true')
+ .to.contain('});');
+ }));
+ });
+
+ it('route --reset-namespace --pod', function() {
+ var args = ['route', 'parent/child', '--reset-namespace', '--pod'];
+
+ return emberNew()
+ .then(() => emberGenerateDestroy(args, (_file) => {
+ expect(_file('app/child/route.js'))
+ .to.contain('import Ember from \'ember\';')
+ .to.contain('export default Ember.Route.extend({\n});');
+
+ expect(_file('app/child/template.hbs'))
+ .to.contain('{{outlet}}');
+
+ expect(_file('tests/unit/child/route-test.js'))
+ .to.contain('import { moduleFor, test } from \'ember-qunit\';')
+ .to.contain('moduleFor(\'route:child\'');
+
+ expect(file('app/router.js'))
+ .to.contain('this.route(\'parent\', {')
+ .to.contain('this.route(\'child\', {')
+ .to.contain('resetNamespace: true')
+ .to.contain('});');
+ }));
+ });
+
it('route index', function() {
var args = ['route', 'index'];
| false |
Other
|
emberjs
|
ember.js
|
c5ec6debf53c183f2c259a2c1dda6180c0f44f1c.json
|
drop the replaceIn API
|
packages/ember-views/lib/mixins/view_support.js
|
@@ -329,31 +329,6 @@ export default Mixin.create({
return element;
},
- /**
- Replaces the content of the specified parent element with this view's
- element. If the view does not have an HTML representation yet,
- the element will be generated automatically.
-
- Note that this method just schedules the view to be appended; the DOM
- element will not be appended to the given element until all bindings have
- finished synchronizing
-
- @method replaceIn
- @param {String|DOMElement|jQuery} target A selector, element, HTML string, or jQuery object
- @return {Ember.View} received
- @private
- */
- replaceIn(selector) {
- let target = jQuery(selector);
-
- assert(`You tried to replace in (${selector}) but that isn't in the DOM`, target.length > 0);
- assert('You cannot replace an existing Ember.View.', !target.is('.ember-view') && !target.parents().is('.ember-view'));
-
- this.renderer.replaceIn(this, target[0]);
-
- return this;
- },
-
/**
Appends the view's element to the document body. If the view does
not have an HTML representation yet
| false |
Other
|
emberjs
|
ember.js
|
84ff4a84994716a4bf9d6764b0dc0f7d1e3ad025.json
|
Fix runtime feature flags
|
broccoli/packages.js
|
@@ -237,8 +237,11 @@ module.exports.emberLicense = function _emberLicense() {
module.exports.emberFeaturesES = function _emberFeaturesES(production = false) {
let FEATURES = production ? RELEASE : DEBUG;
let content = stripIndent`
- const FEATURES = ${JSON.stringify(FEATURES)};
- export default FEATURES;
+ import { ENV } from 'ember-environment';
+ import { assign } from 'ember-utils';
+ export const DEFAULT_FEATURES = ${JSON.stringify(FEATURES)};
+ export const FEATURES = assign(DEFAULT_FEATURES, ENV.FEATURES);
+
${Object.keys(toConst(FEATURES)).map((FEATURE) => {
return `export const ${FEATURE} = FEATURES["${FEATURE.replace(/_/g, '-').toLowerCase()}"];`
| true |
Other
|
emberjs
|
ember.js
|
84ff4a84994716a4bf9d6764b0dc0f7d1e3ad025.json
|
Fix runtime feature flags
|
packages/ember-debug/lib/features.js
|
@@ -1,6 +1,6 @@
-import { assign } from 'ember-utils';
import { ENV } from 'ember-environment';
-import DEFAULT_FEATURES from 'ember/features';
+import * as FLAGS from 'ember/features';
+let { FEATURES } = FLAGS;
/**
The hash of enabled Canary features. Add to this, any canary features
@@ -15,7 +15,8 @@ import DEFAULT_FEATURES from 'ember/features';
@since 1.1.0
@public
*/
-export const FEATURES = assign(DEFAULT_FEATURES, ENV.FEATURES);
+
+// Auto-generated
/**
Determine whether the specified `feature` is enabled. Used by Ember's
@@ -44,7 +45,3 @@ export default function isEnabled(feature) {
return false;
}
}
-
-export {
- DEFAULT_FEATURES
-};
| true |
Other
|
emberjs
|
ember.js
|
84ff4a84994716a4bf9d6764b0dc0f7d1e3ad025.json
|
Fix runtime feature flags
|
packages/ember-debug/lib/index.js
|
@@ -1,15 +1,16 @@
-import DEFAULT_FEATURES from 'ember/features';
import { ENV, environment } from 'ember-environment';
import Logger from 'ember-console';
import { isTesting } from './testing';
import EmberError from './error';
-import { default as isFeatureEnabled, FEATURES } from './features';
+import { default as isFeatureEnabled } from './features';
+import * as FLAGS from 'ember/features';
+let { DEFAULT_FEATURES, FEATURES } = FLAGS;
import _deprecate from './deprecate';
import _warn from './warn';
export { registerHandler as registerWarnHandler } from './warn';
export { registerHandler as registerDeprecationHandler } from './deprecate';
-export { default as isFeatureEnabled, FEATURES } from './features';
+export { default as isFeatureEnabled } from './features';
export { default as Error } from './error';
export { isTesting, setTesting } from './testing';
| true |
Other
|
emberjs
|
ember.js
|
84ff4a84994716a4bf9d6764b0dc0f7d1e3ad025.json
|
Fix runtime feature flags
|
packages/ember-template-compiler/lib/index.js
|
@@ -1,11 +1,11 @@
import _Ember from 'ember-metal';
-import { FEATURES } from 'ember-debug';
+import * as FLAGS from 'ember/features';
import { ENV } from 'ember-environment';
import VERSION from 'ember/version';
// private API used by ember-cli-htmlbars to setup ENV and FEATURES
if (!_Ember.ENV) { _Ember.ENV = ENV; }
-if (!_Ember.FEATURES) { _Ember.FEATURES = FEATURES; }
+if (!_Ember.FEATURES) { _Ember.FEATURES = FLAGS.FEATURES; }
if (!_Ember.VERSION) { _Ember.VERSION = VERSION; }
export { _Ember };
| true |
Other
|
emberjs
|
ember.js
|
84ff4a84994716a4bf9d6764b0dc0f7d1e3ad025.json
|
Fix runtime feature flags
|
packages/ember/lib/index.js
|
@@ -9,7 +9,8 @@ import { Registry, Container } from 'container';
// ****ember-metal****
import Ember, * as metal from 'ember-metal';
-import { EMBER_METAL_WEAKMAP } from 'ember/features'
+import { EMBER_METAL_WEAKMAP } from 'ember/features';
+import * as FLAGS from 'ember/features'
// ember-utils exports
Ember.getOwner = utils.getOwner;
@@ -80,7 +81,7 @@ Ember.getWithDefault = metal.getWithDefault;
Ember._getPath = metal._getPath;
Ember.set = metal.set;
Ember.trySet = metal.trySet;
-Ember.FEATURES = EmberDebug.FEATURES;
+Ember.FEATURES = FLAGS.FEATURES;
Ember.FEATURES.isEnabled = EmberDebug.isFeatureEnabled;
Ember._Cache = metal.Cache;
Ember.on = metal.on;
| true |
Other
|
emberjs
|
ember.js
|
84ff4a84994716a4bf9d6764b0dc0f7d1e3ad025.json
|
Fix runtime feature flags
|
packages/ember/tests/reexports_test.js
|
@@ -47,7 +47,7 @@ QUnit.module('ember reexports');
['onerror', 'ember-metal', { get: 'getOnerror', set: 'setOnerror' }],
// ['create'], TODO: figure out what to do here
// ['keys'], TODO: figure out what to do here
- ['FEATURES', 'ember-debug'],
+ ['FEATURES', 'ember/features'],
['FEATURES.isEnabled', 'ember-debug', 'isFeatureEnabled'],
['Error', 'ember-debug'],
['META_DESC', 'ember-metal'],
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember-application/lib/system/application.js
|
@@ -1024,6 +1024,7 @@ Application.reopenClass({
});
function commonSetupRegistry(registry) {
+ registry.register('router:main', Router);
registry.register('-view-registry:main', { create() { return dictionary(null); } });
registry.register('route:basic', Route);
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember-glimmer/tests/integration/application/actions-test.js
|
@@ -6,15 +6,15 @@ moduleFor('Application test: actions', class extends ApplicationTest {
['@test actions in top level template application template target application controller'](assert) {
assert.expect(1);
- this.registerController('application', Controller.extend({
+ this.add('controller:application', Controller.extend({
actions: {
handleIt(arg) {
assert.ok(true, 'controller received action properly');
}
}
}));
- this.registerTemplate('application', '<button id="handle-it" {{action "handleIt"}}>Click!</button>');
+ this.addTemplate('application', '<button id="handle-it" {{action "handleIt"}}>Click!</button>');
return this.visit('/')
.then(() => {
@@ -25,23 +25,23 @@ moduleFor('Application test: actions', class extends ApplicationTest {
['@test actions in nested outlet template target their controller'](assert) {
assert.expect(1);
- this.registerController('application', Controller.extend({
+ this.add('controller:application', Controller.extend({
actions: {
handleIt(arg) {
assert.ok(false, 'application controller should not have received action!');
}
}
}));
- this.registerController('index', Controller.extend({
+ this.add('controller:index', Controller.extend({
actions: {
handleIt(arg) {
assert.ok(true, 'controller received action properly');
}
}
}));
- this.registerTemplate('index', '<button id="handle-it" {{action "handleIt"}}>Click!</button>');
+ this.addTemplate('index', '<button id="handle-it" {{action "handleIt"}}>Click!</button>');
return this.visit('/')
.then(() => {
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember-glimmer/tests/integration/application/engine-test.js
|
@@ -10,26 +10,26 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
setupAppAndRoutableEngine(hooks = []) {
let self = this;
- this.application.register('template:application', compile('Application{{outlet}}'));
+ this.addTemplate('application', 'Application{{outlet}}');
this.router.map(function() {
this.mount('blog');
});
- this.application.register('route-map:blog', function() {
+ this.add('route-map:blog', function() {
this.route('post', function() {
this.route('comments');
this.route('likes');
});
this.route('category', {path: 'category/:id'});
this.route('author', {path: 'author/:id'});
});
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
model() {
hooks.push('application - application');
}
}));
- this.registerEngine('blog', Engine.extend({
+ this.add('engine:blog', Engine.extend({
init() {
this._super(...arguments);
this.register('controller:application', Controller.extend({
@@ -62,7 +62,7 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
setupAppAndRoutelessEngine(hooks) {
this.setupRoutelessEngine(hooks);
- this.registerEngine('chat-engine', Engine.extend({
+ this.add('engine:chat-engine', Engine.extend({
init() {
this._super(...arguments);
this.register('template:application', compile('Engine'));
@@ -77,19 +77,19 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
}
setupAppAndRoutableEngineWithPartial(hooks) {
- this.application.register('template:application', compile('Application{{outlet}}'));
+ this.addTemplate('application', 'Application{{outlet}}');
this.router.map(function() {
this.mount('blog');
});
- this.application.register('route-map:blog', function() { });
- this.registerRoute('application', Route.extend({
+ this.add('route-map:blog', function() { });
+ this.add('route:application', Route.extend({
model() {
hooks.push('application - application');
}
}));
- this.registerEngine('blog', Engine.extend({
+ this.add('engine:blog', Engine.extend({
init() {
this._super(...arguments);
this.register('template:foo', compile('foo partial'));
@@ -104,8 +104,8 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
}
setupRoutelessEngine(hooks) {
- this.application.register('template:application', compile('Application{{mount "chat-engine"}}'));
- this.registerRoute('application', Route.extend({
+ this.addTemplate('application', 'Application{{mount "chat-engine"}}');
+ this.add('route:application', Route.extend({
model() {
hooks.push('application - application');
}
@@ -115,7 +115,7 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
setupAppAndRoutlessEngineWithPartial(hooks) {
this.setupRoutelessEngine(hooks);
- this.registerEngine('chat-engine', Engine.extend({
+ this.add('engine:chat-engine', Engine.extend({
init() {
this._super(...arguments);
this.register('template:foo', compile('foo partial'));
@@ -135,9 +135,9 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
}
setupEngineWithAttrs(hooks) {
- this.application.register('template:application', compile('Application{{mount "chat-engine"}}'));
+ this.addTemplate('application', 'Application{{mount "chat-engine"}}');
- this.registerEngine('chat-engine', Engine.extend({
+ this.add('engine:chat-engine', Engine.extend({
init() {
this._super(...arguments);
this.register('template:components/foo-bar', compile(`{{partial "troll"}}`));
@@ -172,18 +172,18 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
{{outlet}}
`);
- this.application.register('template:application', sharedTemplate);
- this.registerController('application', Controller.extend({
+ this.add('template:application', sharedTemplate);
+ this.add('controller:application', Controller.extend({
contextType: 'Application',
'ambiguous-curlies': 'Controller Data!'
}));
this.router.map(function() {
this.mount('blog');
});
- this.application.register('route-map:blog', function() { });
+ this.add('route-map:blog', function() { });
- this.registerEngine('blog', Engine.extend({
+ this.add('engine:blog', Engine.extend({
init() {
this._super(...arguments);
@@ -213,20 +213,20 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
layout: sharedLayout
});
- this.application.register('template:application', compile(strip`
+ this.addTemplate('application', strip`
<h1>Application</h1>
{{my-component ambiguous-curlies="Local Data!"}}
{{outlet}}
- `));
+ `);
- this.application.register('component:my-component', sharedComponent);
+ this.add('component:my-component', sharedComponent);
this.router.map(function() {
this.mount('blog');
});
- this.application.register('route-map:blog', function() { });
+ this.add('route-map:blog', function() { });
- this.registerEngine('blog', Engine.extend({
+ this.add('engine:blog', Engine.extend({
init() {
this._super(...arguments);
this.register('template:application', compile(strip`
@@ -336,7 +336,7 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
this.setupAppAndRoutableEngine();
- this.registerEngine('blog', Engine.extend({
+ this.add('engine:blog', Engine.extend({
init() {
this._super(...arguments);
this.register('template:application', compile('Engine{{outlet}}'));
@@ -366,7 +366,6 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
assert.expect(2);
this.setupAppAndRoutableEngine();
- this.application.__registry__.resolver.moduleBasedResolver = true;
this.additionalEngineRegistrations(function() {
this.register('template:application_error', compile('Error! {{model.message}}'));
this.register('route:post', Route.extend({
@@ -388,7 +387,6 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
assert.expect(2);
this.setupAppAndRoutableEngine();
- this.application.__registry__.resolver.moduleBasedResolver = true;
this.additionalEngineRegistrations(function() {
this.register('template:error', compile('Error! {{model.message}}'));
this.register('route:post', Route.extend({
@@ -410,7 +408,6 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
assert.expect(2);
this.setupAppAndRoutableEngine();
- this.application.__registry__.resolver.moduleBasedResolver = true;
this.additionalEngineRegistrations(function() {
this.register('template:post_error', compile('Error! {{model.message}}'));
this.register('route:post', Route.extend({
@@ -432,7 +429,6 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
assert.expect(2);
this.setupAppAndRoutableEngine();
- this.application.__registry__.resolver.moduleBasedResolver = true;
this.additionalEngineRegistrations(function() {
this.register('template:post.error', compile('Error! {{model.message}}'));
this.register('route:post.comments', Route.extend({
@@ -456,7 +452,6 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
let resolveLoading;
this.setupAppAndRoutableEngine();
- this.application.__registry__.resolver.moduleBasedResolver = true;
this.additionalEngineRegistrations(function() {
this.register('template:application_loading', compile('Loading'));
this.register('template:post', compile('Post'));
@@ -523,7 +518,6 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
let resolveLoading;
this.setupAppAndRoutableEngine();
- this.application.__registry__.resolver.moduleBasedResolver = true;
this.additionalEngineRegistrations(function() {
this.register('template:post', compile('{{outlet}}'));
this.register('template:post.comments', compile('Comments'));
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember-glimmer/tests/integration/application/rendering-test.js
|
@@ -8,21 +8,21 @@ import { Component } from 'ember-glimmer';
moduleFor('Application test: rendering', class extends ApplicationTest {
['@test it can render the application template'](assert) {
- this.registerTemplate('application', 'Hello world!');
+ this.addTemplate('application', 'Hello world!');
return this.visit('/').then(() => {
this.assertText('Hello world!');
});
}
['@test it can access the model provided by the route'](assert) {
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
model() {
return ['red', 'yellow', 'blue'];
}
}));
- this.registerTemplate('application', strip`
+ this.addTemplate('application', strip`
<ul>
{{#each model as |item|}}
<li>{{item}}</li>
@@ -53,13 +53,13 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
});
// The "favorite" route will inherit the model
- this.registerRoute('lists.colors', Route.extend({
+ this.add('route:lists.colors', Route.extend({
model() {
return ['red', 'yellow', 'blue'];
}
}));
- this.registerTemplate('lists.colors.favorite', strip`
+ this.addTemplate('lists.colors.favorite', strip`
<ul>
{{#each model as |item|}}
<li>{{item}}</li>
@@ -85,16 +85,16 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
this.route('colors');
});
- this.registerTemplate('application', strip`
+ this.addTemplate('application', strip`
<nav>{{outlet "nav"}}</nav>
<main>{{outlet}}</main>
`);
- this.registerTemplate('nav', strip`
+ this.addTemplate('nav', strip`
<a href="http://emberjs.com/">Ember</a>
`);
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
renderTemplate() {
this.render();
this.render('nav', {
@@ -104,13 +104,13 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
}
}));
- this.registerRoute('colors', Route.extend({
+ this.add('route:colors', Route.extend({
model() {
return ['red', 'yellow', 'blue'];
}
}));
- this.registerTemplate('colors', strip`
+ this.addTemplate('colors', strip`
<ul>
{{#each model as |item|}}
<li>{{item}}</li>
@@ -141,16 +141,16 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
this.route('colors');
});
- this.registerTemplate('application', strip`
+ this.addTemplate('application', strip`
<nav>{{outlet "nav"}}</nav>
<main>{{outlet}}</main>
`);
- this.registerTemplate('nav', strip`
+ this.addTemplate('nav', strip`
<a href="http://emberjs.com/">Ember</a>
`);
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
renderTemplate() {
this.render();
this.render('nav', {
@@ -160,13 +160,13 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
}
}));
- this.registerRoute('colors', Route.extend({
+ this.add('route:colors', Route.extend({
model() {
return ['red', 'yellow', 'blue'];
}
}));
- this.registerTemplate('colors', strip`
+ this.addTemplate('colors', strip`
<ul>
{{#each model as |item|}}
<li>{{item}}</li>
@@ -201,10 +201,10 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
});
});
- this.registerTemplate('a', 'A{{outlet}}');
- this.registerTemplate('b', 'B{{outlet}}');
- this.registerTemplate('b.c', 'C');
- this.registerTemplate('b.d', 'D');
+ this.addTemplate('a', 'A{{outlet}}');
+ this.addTemplate('b', 'B{{outlet}}');
+ this.addTemplate('b.c', 'C');
+ this.addTemplate('b.d', 'D');
return this.visit('/b/c').then(() => {
// this.assertComponentElement(this.firstChild, { content: 'BC' });
@@ -225,13 +225,13 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
this.route('color', { path: '/colors/:color' });
});
- this.registerRoute('color', Route.extend({
+ this.add('route:color', Route.extend({
model(params) {
return params.color;
}
}));
- this.registerTemplate('color', 'color: {{model}}');
+ this.addTemplate('color', 'color: {{model}}');
return this.visit('/colors/red').then(() => {
this.assertComponentElement(this.firstChild, { content: 'color: red' });
@@ -249,16 +249,16 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
this.route('b');
});
- this.registerController('a', Controller.extend({
+ this.add('controller:a', Controller.extend({
value: 'a'
}));
- this.registerController('b', Controller.extend({
+ this.add('controller:b', Controller.extend({
value: 'b'
}));
- this.registerTemplate('a', '{{value}}');
- this.registerTemplate('b', '{{value}}');
+ this.addTemplate('a', '{{value}}');
+ this.addTemplate('b', '{{value}}');
return this.visit('/a').then(() => {
this.assertText('a');
@@ -271,7 +271,7 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
this.route('color', { path: '/colors/:color' });
});
- this.registerRoute('color', Route.extend({
+ this.add('route:color', Route.extend({
model(params) {
return { color: params.color };
},
@@ -281,15 +281,15 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
}
}));
- this.registerController('red', Controller.extend({
+ this.add('controller:red', Controller.extend({
color: 'red'
}));
- this.registerController('green', Controller.extend({
+ this.add('controller:green', Controller.extend({
color: 'green'
}));
- this.registerTemplate('color', 'model color: {{model.color}}, controller color: {{color}}');
+ this.addTemplate('color', 'model color: {{model.color}}, controller color: {{color}}');
return this.visit('/colors/red').then(() => {
this.assertComponentElement(this.firstChild, { content: 'model color: red, controller color: red' });
@@ -307,7 +307,7 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
this.route('b');
});
- this.registerRoute('a', Route.extend({
+ this.add('route:a', Route.extend({
model() {
return 'A';
},
@@ -317,7 +317,7 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
}
}));
- this.registerRoute('b', Route.extend({
+ this.add('route:b', Route.extend({
model() {
return 'B';
},
@@ -327,11 +327,11 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
}
}));
- this.registerController('common', Controller.extend({
+ this.add('controller:common', Controller.extend({
prefix: 'common'
}));
- this.registerTemplate('common', '{{prefix}} {{model}}');
+ this.addTemplate('common', '{{prefix}} {{model}}');
return this.visit('/a').then(() => {
this.assertComponentElement(this.firstChild, { content: 'common A' });
@@ -348,8 +348,8 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
// I wish there was a way to assert that the OutletComponentManager did not
// receive a didCreateElement.
['@test a child outlet is always a fragment']() {
- this.registerTemplate('application', '{{outlet}}');
- this.registerTemplate('index', '{{#if true}}1{{/if}}<div>2</div>');
+ this.addTemplate('application', '{{outlet}}');
+ this.addTemplate('index', '{{#if true}}1{{/if}}<div>2</div>');
return this.visit('/').then(() => {
this.assertComponentElement(this.firstChild, { content: '1<div>2</div>' });
});
@@ -360,13 +360,13 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
this.route('a');
});
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
activate() {
this.transitionTo('a');
}
}));
- this.registerTemplate('a', 'Hello from A!');
+ this.addTemplate('a', 'Hello from A!');
return this.visit('/').then(() => {
this.assertComponentElement(this.firstChild, {
@@ -380,15 +380,15 @@ moduleFor('Application test: rendering', class extends ApplicationTest {
this.route('routeWithError');
});
- this.registerRoute('routeWithError', Route.extend({
+ this.add('route:routeWithError', Route.extend({
model() {
return { name: 'Alex' };
}
}));
- this.registerTemplate('routeWithError', 'Hi {{model.name}} {{x-foo person=model}}');
+ this.addTemplate('routeWithError', 'Hi {{model.name}} {{x-foo person=model}}');
- this.registerComponent('x-foo', {
+ this.addComponent('x-foo', {
ComponentClass: Component.extend({
init() {
this._super(...arguments);
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember-glimmer/tests/integration/components/link-to-test.js
|
@@ -17,7 +17,7 @@ moduleFor('Link-to component', class extends ApplicationTest {
['@test accessing `currentWhen` triggers a deprecation'](assert) {
let component;
- this.registerComponent('link-to', {
+ this.addComponent('link-to', {
ComponentClass: LinkComponent.extend({
init() {
this._super(...arguments);
@@ -26,7 +26,7 @@ moduleFor('Link-to component', class extends ApplicationTest {
})
});
- this.registerTemplate('application', `{{link-to 'Index' 'index'}}`);
+ this.addTemplate('application', `{{link-to 'Index' 'index'}}`);
return this.visit('/').then(() => {
expectDeprecation(() => {
@@ -36,7 +36,7 @@ moduleFor('Link-to component', class extends ApplicationTest {
}
['@test should be able to be inserted in DOM when the router is not present']() {
- this.registerTemplate('application', `{{#link-to 'index'}}Go to Index{{/link-to}}`);
+ this.addTemplate('application', `{{#link-to 'index'}}Go to Index{{/link-to}}`);
return this.visit('/').then(() => {
this.assertText('Go to Index');
@@ -46,8 +46,8 @@ moduleFor('Link-to component', class extends ApplicationTest {
['@test re-renders when title changes']() {
let controller;
- this.registerTemplate('application', '{{link-to title routeName}}');
- this.registerController('application', Controller.extend({
+ this.addTemplate('application', '{{link-to title routeName}}');
+ this.add('controller:application', Controller.extend({
init() {
this._super(...arguments);
controller = this;
@@ -64,8 +64,8 @@ moduleFor('Link-to component', class extends ApplicationTest {
}
['@test escaped inline form (double curlies) escapes link title']() {
- this.registerTemplate('application', `{{link-to title 'index'}}`);
- this.registerController('application', Controller.extend({
+ this.addTemplate('application', `{{link-to title 'index'}}`);
+ this.add('controller:application', Controller.extend({
title: '<b>blah</b>'
}));
@@ -75,8 +75,8 @@ moduleFor('Link-to component', class extends ApplicationTest {
}
['@test escaped inline form with (-html-safe) does not escape link title'](assert) {
- this.registerTemplate('application', `{{link-to (-html-safe title) 'index'}}`);
- this.registerController('application', Controller.extend({
+ this.addTemplate('application', `{{link-to (-html-safe title) 'index'}}`);
+ this.add('controller:application', Controller.extend({
title: '<b>blah</b>'
}));
@@ -87,8 +87,8 @@ moduleFor('Link-to component', class extends ApplicationTest {
}
['@test unescaped inline form (triple curlies) does not escape link title'](assert) {
- this.registerTemplate('application', `{{{link-to title 'index'}}}`);
- this.registerController('application', Controller.extend({
+ this.addTemplate('application', `{{{link-to title 'index'}}}`);
+ this.add('controller:application', Controller.extend({
title: '<b>blah</b>'
}));
@@ -102,8 +102,8 @@ moduleFor('Link-to component', class extends ApplicationTest {
this.router.map(function() {
this.route('profile', { path: '/profile/:id' });
});
- this.registerTemplate('application', `{{#link-to 'profile' otherController}}Text{{/link-to}}`);
- this.registerController('application', Controller.extend({
+ this.addTemplate('application', `{{#link-to 'profile' otherController}}Text{{/link-to}}`);
+ this.add('controller:application', Controller.extend({
otherController: Controller.create({
model: 'foo'
})
@@ -117,9 +117,9 @@ moduleFor('Link-to component', class extends ApplicationTest {
}
['@test able to safely extend the built-in component and use the normal path']() {
- this.registerComponent('custom-link-to', { ComponentClass: LinkComponent.extend() });
- this.registerTemplate('application', `{{#custom-link-to 'index'}}{{title}}{{/custom-link-to}}`);
- this.registerController('application', Controller.extend({
+ this.addComponent('custom-link-to', { ComponentClass: LinkComponent.extend() });
+ this.addTemplate('application', `{{#custom-link-to 'index'}}{{title}}{{/custom-link-to}}`);
+ this.add('controller:application', Controller.extend({
title: 'Hello'
}));
@@ -129,9 +129,9 @@ moduleFor('Link-to component', class extends ApplicationTest {
}
['@test [GH#13432] able to safely extend the built-in component and invoke it inline']() {
- this.registerComponent('custom-link-to', { ComponentClass: LinkComponent.extend() });
- this.registerTemplate('application', `{{custom-link-to title 'index'}}`);
- this.registerController('application', Controller.extend({
+ this.addComponent('custom-link-to', { ComponentClass: LinkComponent.extend() });
+ this.addTemplate('application', `{{custom-link-to title 'index'}}`);
+ this.add('controller:application', Controller.extend({
title: 'Hello'
}));
@@ -145,15 +145,15 @@ moduleFor('Link-to component with query-params', class extends ApplicationTest {
constructor() {
super(...arguments);
- this.registerController('index', Controller.extend({
+ this.add('controller:index', Controller.extend({
queryParams: ['foo'],
foo: '123',
bar: 'yes'
}));
}
['@test populates href with fully supplied query param values'](assert) {
- this.registerTemplate('index', `{{#link-to 'index' (query-params foo='456' bar='NAW')}}Index{{/link-to}}`);
+ this.addTemplate('index', `{{#link-to 'index' (query-params foo='456' bar='NAW')}}Index{{/link-to}}`);
return this.visit('/').then(() => {
this.assertComponentElement(this.firstChild.firstElementChild, {
@@ -165,7 +165,7 @@ moduleFor('Link-to component with query-params', class extends ApplicationTest {
}
['@test populates href with partially supplied query param values, but omits if value is default value']() {
- this.registerTemplate('index', `{{#link-to 'index' (query-params foo='123')}}Index{{/link-to}}`);
+ this.addTemplate('index', `{{#link-to 'index' (query-params foo='123')}}Index{{/link-to}}`);
return this.visit('/').then(() => {
this.assertComponentElement(this.firstChild.firstElementChild, {
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember-glimmer/tests/integration/components/target-action-test.js
|
@@ -277,7 +277,7 @@ moduleFor('Components test: sendAction to a controller', class extends Applicati
});
});
- this.registerComponent('foo-bar', {
+ this.addComponent('foo-bar', {
ComponentClass: Component.extend({
init() {
this._super(...arguments);
@@ -287,53 +287,53 @@ moduleFor('Components test: sendAction to a controller', class extends Applicati
template: `{{val}}`
});
- this.registerController('a', Controller.extend({
+ this.add('controller:a', Controller.extend({
send(actionName, actionContext) {
assert.equal(actionName, 'poke', 'send() method was invoked from a top level controller');
assert.equal(actionContext, 'top', 'action arguments were passed into the top level controller');
}
}));
- this.registerTemplate('a', '{{foo-bar val="a" poke="poke"}}');
+ this.addTemplate('a', '{{foo-bar val="a" poke="poke"}}');
- this.registerRoute('b', Route.extend({
+ this.add('route:b', Route.extend({
actions: {
poke(actionContext) {
assert.ok(true, 'Unhandled action sent to route');
assert.equal(actionContext, 'top no controller');
}
}
}));
- this.registerTemplate('b', '{{foo-bar val="b" poke="poke"}}');
+ this.addTemplate('b', '{{foo-bar val="b" poke="poke"}}');
- this.registerRoute('c', Route.extend({
+ this.add('route:c', Route.extend({
actions: {
poke(actionContext) {
assert.ok(true, 'Unhandled action sent to route');
assert.equal(actionContext, 'top with nested no controller');
}
}
}));
- this.registerTemplate('c', '{{foo-bar val="c" poke="poke"}}{{outlet}}');
+ this.addTemplate('c', '{{foo-bar val="c" poke="poke"}}{{outlet}}');
- this.registerRoute('c.d', Route.extend({}));
+ this.add('route:c.d', Route.extend({}));
- this.registerController('c.d', Controller.extend({
+ this.add('controller:c.d', Controller.extend({
send(actionName, actionContext) {
assert.equal(actionName, 'poke', 'send() method was invoked from a nested controller');
assert.equal(actionContext, 'nested', 'action arguments were passed into the nested controller');
}
}));
- this.registerTemplate('c.d', '{{foo-bar val=".d" poke="poke"}}');
+ this.addTemplate('c.d', '{{foo-bar val=".d" poke="poke"}}');
- this.registerRoute('c.e', Route.extend({
+ this.add('route:c.e', Route.extend({
actions: {
poke(actionContext) {
assert.ok(true, 'Unhandled action sent to route');
assert.equal(actionContext, 'nested no controller');
}
}
}));
- this.registerTemplate('c.e', '{{foo-bar val=".e" poke="poke"}}');
+ this.addTemplate('c.e', '{{foo-bar val=".e" poke="poke"}}');
return this.visit('/a')
.then(() => component.sendAction('poke', 'top'))
@@ -365,7 +365,7 @@ moduleFor('Components test: sendAction to a controller', class extends Applicati
let component;
- this.registerComponent('x-parent', {
+ this.addComponent('x-parent', {
ComponentClass: Component.extend({
actions: {
poke() {
@@ -376,7 +376,7 @@ moduleFor('Components test: sendAction to a controller', class extends Applicati
template: '{{x-child poke="poke"}}'
});
- this.registerComponent('x-child', {
+ this.addComponent('x-child', {
ComponentClass: Component.extend({
init() {
this._super(...arguments);
@@ -385,8 +385,8 @@ moduleFor('Components test: sendAction to a controller', class extends Applicati
})
});
- this.registerTemplate('application', '{{x-parent}}');
- this.registerController('application', Controller.extend({
+ this.addTemplate('application', '{{x-parent}}');
+ this.add('controller:application', Controller.extend({
send(actionName) {
throw new Error('controller action should not be called');
}
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember-glimmer/tests/integration/components/utils-test.js
|
@@ -19,15 +19,15 @@ moduleFor('View tree tests', class extends ApplicationTest {
constructor() {
super();
- this.registerComponent('x-tagless', {
+ this.addComponent('x-tagless', {
ComponentClass: Component.extend({
tagName: ''
}),
template: '<div id="{{id}}">[{{id}}] {{#if isShowing}}{{yield}}{{/if}}</div>'
});
- this.registerComponent('x-toggle', {
+ this.addComponent('x-toggle', {
ComponentClass: Component.extend({
isExpanded: true,
@@ -50,9 +50,9 @@ moduleFor('View tree tests', class extends ApplicationTest {
}
});
- this.registerController('application', ToggleController);
+ this.add('controller:application', ToggleController);
- this.registerTemplate('application', `
+ this.addTemplate('application', `
{{x-tagless id="root-1"}}
{{#x-toggle id="root-2"}}
@@ -72,11 +72,11 @@ moduleFor('View tree tests', class extends ApplicationTest {
{{outlet}}
`);
- this.registerController('index', ToggleController.extend({
+ this.add('controller:index', ToggleController.extend({
isExpanded: false
}));
- this.registerTemplate('index', `
+ this.addTemplate('index', `
{{x-tagless id="root-4"}}
{{#x-toggle id="root-5" isExpanded=false}}
@@ -94,7 +94,7 @@ moduleFor('View tree tests', class extends ApplicationTest {
{{/if}}
`);
- this.registerTemplate('zomg', `
+ this.addTemplate('zomg', `
{{x-tagless id="root-7"}}
{{#x-toggle id="root-8"}}
@@ -110,7 +110,7 @@ moduleFor('View tree tests', class extends ApplicationTest {
{{/x-toggle}}
`);
- this.registerTemplate('zomg.lol', `
+ this.addTemplate('zomg.lol', `
{{x-toggle id="inner-10"}}
`);
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember-glimmer/tests/integration/mount-test.js
|
@@ -36,7 +36,7 @@ moduleFor('{{mount}} test', class extends ApplicationTest {
let engineRegistrations = this.engineRegistrations = {};
- this.registerEngine('chat', Engine.extend({
+ this.add('engine:chat', Engine.extend({
router: null,
init() {
@@ -48,7 +48,7 @@ moduleFor('{{mount}} test', class extends ApplicationTest {
}
}));
- this.registerTemplate('index', '{{mount "chat"}}');
+ this.addTemplate('index', '{{mount "chat"}}');
}
['@test it boots an engine, instantiates its application controller, and renders its application template'](assert) {
@@ -88,8 +88,8 @@ moduleFor('{{mount}} test', class extends ApplicationTest {
this.route('route-with-mount');
});
- this.registerTemplate('index', '');
- this.registerTemplate('route-with-mount', '{{mount "chat"}}');
+ this.addTemplate('index', '');
+ this.addTemplate('route-with-mount', '{{mount "chat"}}');
this.engineRegistrations['template:application'] = compile('hi {{person.name}} [{{component-with-backtracking-set person=person}}]', { moduleName: 'application' });
this.engineRegistrations['controller:application'] = Controller.extend({
@@ -123,23 +123,23 @@ moduleFor('{{mount}} test', class extends ApplicationTest {
this.route('bound-engine-name');
});
let controller;
- this.registerController('bound-engine-name', Controller.extend({
+ this.add('controller:bound-engine-name', Controller.extend({
engineName: null,
init() {
this._super();
controller = this;
}
}));
- this.registerTemplate('bound-engine-name', '{{mount engineName}}');
+ this.addTemplate('bound-engine-name', '{{mount engineName}}');
- this.registerEngine('foo', Engine.extend({
+ this.add('engine:foo', Engine.extend({
router: null,
init() {
this._super(...arguments);
this.register('template:application', compile('<h2>Foo Engine</h2>', { moduleName: 'application' }));
}
}));
- this.registerEngine('bar', Engine.extend({
+ this.add('engine:bar', Engine.extend({
router: null,
init() {
this._super(...arguments);
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember/tests/routing/query_params_test.js
|
@@ -25,7 +25,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
let appModelCount = 0;
let promiseResolve;
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
queryParams: {
appomg: {
defaultValue: 'applol'
@@ -42,7 +42,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
let actionName = typeof loadingReturn !== 'undefined' ? 'loading' : 'ignore';
let indexModelCount = 0;
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
queryParams: {
omg: {
refreshModel: true
@@ -107,7 +107,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
});
});
- this.registerRoute('parent.child', Route.extend({
+ this.add('route:parent.child', Route.extend({
afterModel() {
this.transitionTo('parent.sibling');
}
@@ -144,7 +144,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
['@test Query params can map to different url keys configured on the controller'](assert) {
assert.expect(6);
- this.registerController('index', Controller.extend({
+ this.add('controller:index', Controller.extend({
queryParams: [{ foo: 'other_foo', bar: { as: 'other_bar' } }],
foo: 'FOO',
bar: 'BAR'
@@ -173,7 +173,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
['@test Routes have a private overridable serializeQueryParamKey hook'](assert) {
assert.expect(2);
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
serializeQueryParamKey: StringUtils.dasherize
}));
@@ -232,7 +232,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index');
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
model(params) {
assert.deepEqual(params, { foo: 'bar' });
}
@@ -250,7 +250,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index');
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
model(params) {
assert.deepEqual(params, { foo: 'bar', id: 'baz' });
}
@@ -268,7 +268,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index');
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
model(params) {
assert.deepEqual(params, { foo: 'baz', id: 'boo' });
}
@@ -302,15 +302,15 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.route('about');
});
- this.registerTemplate('home', `<h3>{{link-to 'About' 'about' (query-params lol='wat') id='link-to-about'}}</h3>`);
- this.registerTemplate('about', `<h3>{{link-to 'Home' 'home' (query-params foo='naw')}}</h3>`);
- this.registerTemplate('cats.index', `<h3>{{link-to 'Cats' 'cats' (query-params name='domino') id='cats-link'}}</h3>`);
+ this.addTemplate('home', `<h3>{{link-to 'About' 'about' (query-params lol='wat') id='link-to-about'}}</h3>`);
+ this.addTemplate('about', `<h3>{{link-to 'Home' 'home' (query-params foo='naw')}}</h3>`);
+ this.addTemplate('cats.index', `<h3>{{link-to 'Cats' 'cats' (query-params name='domino') id='cats-link'}}</h3>`);
let homeShouldBeCreated = false;
let aboutShouldBeCreated = false;
let catsIndexShouldBeCreated = false;
- this.registerRoute('home', Route.extend({
+ this.add('route:home', Route.extend({
setup() {
homeShouldBeCreated = true;
this._super(...arguments);
@@ -324,7 +324,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
}
});
- this.registerRoute('about', Route.extend({
+ this.add('route:about', Route.extend({
setup() {
aboutShouldBeCreated = true;
this._super(...arguments);
@@ -338,7 +338,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
}
});
- this.registerRoute('cats.index', Route.extend({
+ this.add('route:cats.index', Route.extend({
model() {
return [];
},
@@ -351,7 +351,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
}
}));
- this.registerController('cats.index', Controller.extend({
+ this.add('controller:cats.index', Controller.extend({
queryParams: ['breed', 'name'],
breed: 'Golden',
name: null,
@@ -385,7 +385,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('application');
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
setupController(controller) {
assert.equal(controller.get('foo'), 'YEAH', 'controller\'s foo QP property set before setupController called');
}
@@ -399,7 +399,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('application', { faz: 'foo' });
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
setupController(controller) {
assert.equal(controller.get('faz'), 'YEAH', 'controller\'s foo QP property set before setupController called');
}
@@ -417,7 +417,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index');
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
model(params, transition) {
assert.deepEqual(this.paramsFor('index'), { something: 'baz', foo: 'bar' }, 'could retrieve params for index');
}
@@ -435,7 +435,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index');
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
model(params, transition) {
assert.deepEqual(this.paramsFor('index'), { something: 'baz', foo: 'boo' }, 'could retrieve params for index');
}
@@ -453,7 +453,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index', 'foo', false);
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
model(params, transition) {
assert.deepEqual(this.paramsFor('index'), { something: 'baz', foo: false }, 'could retrieve params for index');
}
@@ -471,7 +471,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index', 'foo', true);
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
model(params, transition) {
assert.deepEqual(this.paramsFor('index'), { something: 'baz', foo: false }, 'could retrieve params for index');
}
@@ -486,13 +486,13 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('application', 'appomg', 'applol');
this.setSingleQPController('index', 'omg', 'lol');
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
model(params) {
assert.deepEqual(params, { appomg: 'applol' });
}
}));
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
model(params) {
assert.deepEqual(params, { omg: 'lol' });
assert.deepEqual(this.paramsFor('application'), { appomg: 'applol' });
@@ -508,13 +508,13 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('application', 'appomg', 'applol');
this.setSingleQPController('index', 'omg', 'lol');
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
model(params) {
assert.deepEqual(params, { appomg: 'appyes' });
}
}));
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
model(params) {
assert.deepEqual(params, { omg: 'yes' });
assert.deepEqual(this.paramsFor('application'), { appomg: 'appyes' });
@@ -531,14 +531,14 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index', 'omg', 'lol');
let appModelCount = 0;
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
model(params) {
appModelCount++;
}
}));
let indexModelCount = 0;
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
queryParams: {
omg: {
refreshModel: true
@@ -574,7 +574,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index', 'steely', 'lel');
let refreshCount = 0;
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
queryParams: {
alex: {
refreshModel: true
@@ -601,7 +601,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('application', 'appomg', 'applol');
this.setSingleQPController('index', 'omg', 'lol');
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
queryParams: {
omg: {
refreshModel: true
@@ -616,7 +616,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
}
['@test queryParams are updated when a controller property is set and the route is refreshed. Issue #13263 '](assert) {
- this.registerTemplate('application', '<button id="test-button" {{action \'increment\'}}>Increment</button><span id="test-value">{{foo}}</span>{{outlet}}');
+ this.addTemplate('application', '<button id="test-button" {{action \'increment\'}}>Increment</button><span id="test-value">{{foo}}</span>{{outlet}}');
this.setSingleQPController('application', 'foo', 1, {
actions: {
@@ -627,7 +627,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
}
});
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
actions: {
refreshRoute() {
this.refresh();
@@ -655,14 +655,14 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index', 'omg', 'lol');
let appModelCount = 0;
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
model(params) {
appModelCount++;
}
}));
let indexModelCount = 0;
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
queryParams: EmberObject.create({
unknownProperty(keyName) {
return { refreshModel: true };
@@ -697,7 +697,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index', 'omg', 'lol');
let indexModelCount = 0;
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
queryParams: {
omg: {
refreshModel: true
@@ -730,7 +730,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('application', 'alex', 'matchneer');
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
queryParams: {
alex: {
replace: true
@@ -748,11 +748,11 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
['@test Route query params config can be configured using property name instead of URL key'](assert) {
assert.expect(2);
- this.registerController('application', Controller.extend({
+ this.add('controller:application', Controller.extend({
queryParams: [{ commitBy: 'commit_by' }]
}));
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
queryParams: {
commitBy: {
replace: true
@@ -770,13 +770,13 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
['@test An explicit replace:false on a changed QP always wins and causes a pushState'](assert) {
assert.expect(3);
- this.registerController('application', Controller.extend({
+ this.add('controller:application', Controller.extend({
queryParams: ['alex', 'steely'],
alex: 'matchneer',
steely: 'dan'
}));
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
queryParams: {
alex: {
replace: true
@@ -801,8 +801,8 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
}
['@test can opt into full transition by setting refreshModel in route queryParams when transitioning from child to parent'](assert) {
- this.registerTemplate('parent', '{{outlet}}');
- this.registerTemplate('parent.child', '{{link-to \'Parent\' \'parent\' (query-params foo=\'change\') id=\'parent-link\'}}');
+ this.addTemplate('parent', '{{outlet}}');
+ this.addTemplate('parent.child', '{{link-to \'Parent\' \'parent\' (query-params foo=\'change\') id=\'parent-link\'}}');
this.router.map(function() {
this.route('parent', function() {
@@ -811,7 +811,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
});
let parentModelCount = 0;
- this.registerRoute('parent', Route.extend({
+ this.add('route:parent', Route.extend({
model() {
parentModelCount++;
},
@@ -837,7 +837,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('application', 'alex', 'matchneer');
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
queryParams: EmberObject.create({
unknownProperty(keyName) {
// We are simulating all qps requiring refresh
@@ -862,7 +862,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index', 'omg', 'lol');
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
setupController(controller) {
assert.ok(true, 'setupController called');
controller.set('omg', 'OVERRIDE');
@@ -889,7 +889,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index', 'omg', ['lol']);
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
setupController(controller) {
assert.ok(true, 'setupController called');
controller.set('omg', ['OVERRIDE']);
@@ -930,7 +930,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
});
});
- this.registerTemplate('application', '{{link-to \'A\' \'abc.def\' (query-params foo=\'123\') id=\'one\'}}{{link-to \'B\' \'abc.def.zoo\' (query-params foo=\'123\' bar=\'456\') id=\'two\'}}{{outlet}}');
+ this.addTemplate('application', '{{link-to \'A\' \'abc.def\' (query-params foo=\'123\') id=\'one\'}}{{link-to \'B\' \'abc.def.zoo\' (query-params foo=\'123\' bar=\'456\') id=\'two\'}}{{outlet}}');
this.setSingleQPController('abc.def', 'foo', 'lol');
this.setSingleQPController('abc.def.zoo', 'bar', 'haha');
@@ -966,7 +966,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
}
['@test transitionTo supports query params (multiple)'](assert) {
- this.registerController('index', Controller.extend({
+ this.add('controller:index', Controller.extend({
queryParams: ['foo', 'bar'],
foo: 'lol',
bar: 'wat'
@@ -1003,7 +1003,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
['@test setting QP to empty string doesn\'t generate null in URL'](assert) {
assert.expect(1);
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
queryParams: {
foo: {
defaultValue: '123'
@@ -1024,7 +1024,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('index', 'foo', false);
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
model(params) {
assert.equal(params.foo, true, 'model hook received foo as boolean true');
}
@@ -1042,7 +1042,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
['@test Query param without value are empty string'](assert) {
assert.expect(1);
- this.registerController('index', Controller.extend({
+ this.add('controller:index', Controller.extend({
queryParams: ['foo'],
foo: ''
}));
@@ -1153,7 +1153,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
});
let modelCount = 0;
- this.registerRoute('home', Route.extend({
+ this.add('route:home', Route.extend({
model() {
modelCount++;
}
@@ -1185,7 +1185,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
// unless we return a copy of the params hash.
this.setSingleQPController('application', 'woot', 'wat');
- this.registerRoute('other', Route.extend({
+ this.add('route:other', Route.extend({
model(p, trans) {
let m = meta(trans.params.application);
assert.ok(!m.peekWatching('woot'), 'A meta object isn\'t constructed for this params POJO');
@@ -1204,13 +1204,13 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
woot: undefined
});
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
model(p, trans) {
return { woot: true };
}
}));
- this.registerRoute('index', Route.extend({
+ this.add('route:index', Route.extend({
setupController(controller, model) {
assert.deepEqual(model, { woot: true }, 'index route inherited model route from parent route');
}
@@ -1222,7 +1222,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
['@test opting into replace does not affect transitions between routes'](assert) {
assert.expect(5);
- this.registerTemplate('application', '{{link-to \'Foo\' \'foo\' id=\'foo-link\'}}{{link-to \'Bar\' \'bar\' id=\'bar-no-qp-link\'}}{{link-to \'Bar\' \'bar\' (query-params raytiley=\'isthebest\') id=\'bar-link\'}}{{outlet}}');
+ this.addTemplate('application', '{{link-to \'Foo\' \'foo\' id=\'foo-link\'}}{{link-to \'Bar\' \'bar\' id=\'bar-no-qp-link\'}}{{link-to \'Bar\' \'bar\' (query-params raytiley=\'isthebest\') id=\'bar-link\'}}{{outlet}}');
this.router.map(function() {
this.route('foo');
@@ -1231,7 +1231,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.setSingleQPController('bar', 'raytiley', 'israd');
- this.registerRoute('bar', Route.extend({
+ this.add('route:bar', Route.extend({
queryParams: {
raytiley: {
replace: true
@@ -1266,13 +1266,13 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.route('example');
});
- this.registerTemplate('application', '{{link-to \'Example\' \'example\' (query-params foo=undefined) id=\'the-link\'}}');
+ this.addTemplate('application', '{{link-to \'Example\' \'example\' (query-params foo=undefined) id=\'the-link\'}}');
this.setSingleQPController('example', 'foo', undefined, {
foo: undefined
});
- this.registerRoute('example', Route.extend({
+ this.add('route:example', Route.extend({
model(params) {
assert.deepEqual(params, { foo: undefined });
}
@@ -1302,7 +1302,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
['@test warn user that Route\'s queryParams configuration must be an Object, not an Array'](assert) {
assert.expect(1);
- this.registerRoute('application', Route.extend({
+ this.add('route:application', Route.extend({
queryParams: [
{ commitBy: { replace: true } }
]
@@ -1320,7 +1320,7 @@ moduleFor('Query Params - main', class extends QueryParamTestCase {
this.route('constructor');
});
- this.registerRoute('constructor', Route.extend({
+ this.add('route:constructor', Route.extend({
queryParams: {
foo: {
defaultValue: '123'
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember/tests/routing/query_params_test/model_dependent_state_with_query_params_test.js
|
@@ -94,7 +94,7 @@ class ModelDependentQPTestCase extends QueryParamTestCase {
assert.expect(32);
- this.registerTemplate('application', `{{#each articles as |a|}} {{link-to 'Article' '${articleLookup}' a.id id=a.id}} {{/each}}`);
+ this.addTemplate('application', `{{#each articles as |a|}} {{link-to 'Article' '${articleLookup}' a.id id=a.id}} {{/each}}`);
return this.boot().then(() => {
this.expectedModelHookParams = { id: 'a-1', q: 'wat', z: 0 };
@@ -233,7 +233,7 @@ class ModelDependentQPTestCase extends QueryParamTestCase {
}
});
- this.registerTemplate('about', `{{link-to 'A' '${commentsLookup}' 'a-1' id='one'}} {{link-to 'B' '${commentsLookup}' 'a-2' id='two'}}`);
+ this.addTemplate('about', `{{link-to 'A' '${commentsLookup}' 'a-1' id='one'}} {{link-to 'B' '${commentsLookup}' 'a-2' id='two'}}`);
return this.visitApplication().then(() => {
this.transitionTo(commentsLookup, 'a-1');
@@ -272,13 +272,13 @@ moduleFor('Query Params - model-dependent state', class extends ModelDependentQP
let articles = emberA([{ id: 'a-1' }, { id: 'a-2' }, { id: 'a-3' }]);
- this.registerController('application', Controller.extend({
+ this.add('controller:application', Controller.extend({
articles
}));
let self = this;
let assert = this.assert;
- this.registerRoute('article', Route.extend({
+ this.add('route:article', Route.extend({
model(params) {
if (self.expectedModelHookParams) {
assert.deepEqual(params, self.expectedModelHookParams, 'the ArticleRoute model hook received the expected merged dynamic segment + query params hash');
@@ -288,18 +288,18 @@ moduleFor('Query Params - model-dependent state', class extends ModelDependentQP
}
}));
- this.registerController('article', Controller.extend({
+ this.add('controller:article', Controller.extend({
queryParams: ['q', 'z'],
q: 'wat',
z: 0
}));
- this.registerController('comments', Controller.extend({
+ this.add('controller:comments', Controller.extend({
queryParams: 'page',
page: 1
}));
- this.registerTemplate('application', '{{#each articles as |a|}} 1{{link-to \'Article\' \'article\' a id=a.id}} {{/each}} {{outlet}}');
+ this.addTemplate('application', '{{#each articles as |a|}} 1{{link-to \'Article\' \'article\' a id=a.id}} {{/each}} {{outlet}}');
}
visitApplication() {
@@ -356,13 +356,13 @@ moduleFor('Query Params - model-dependent state (nested)', class extends ModelDe
let site_articles = emberA([{ id: 'a-1' }, { id: 'a-2' }, { id: 'a-3' }]);
- this.registerController('application', Controller.extend({
+ this.add('controller:application', Controller.extend({
articles: site_articles
}));
let self = this;
let assert = this.assert;
- this.registerRoute('site.article', Route.extend({
+ this.add('route:site.article', Route.extend({
model(params) {
if (self.expectedModelHookParams) {
assert.deepEqual(params, self.expectedModelHookParams, 'the ArticleRoute model hook received the expected merged dynamic segment + query params hash');
@@ -372,18 +372,18 @@ moduleFor('Query Params - model-dependent state (nested)', class extends ModelDe
}
}));
- this.registerController('site.article', Controller.extend({
+ this.add('controller:site.article', Controller.extend({
queryParams: ['q', 'z'],
q: 'wat',
z: 0
}));
- this.registerController('site.article.comments', Controller.extend({
+ this.add('controller:site.article.comments', Controller.extend({
queryParams: 'page',
page: 1
}));
- this.registerTemplate('application', '{{#each articles as |a|}} {{link-to \'Article\' \'site.article\' a id=a.id}} {{/each}} {{outlet}}');
+ this.addTemplate('application', '{{#each articles as |a|}} {{link-to \'Article\' \'site.article\' a id=a.id}} {{/each}} {{outlet}}');
}
visitApplication() {
@@ -440,7 +440,7 @@ moduleFor('Query Params - model-dependent state (nested & more than 1 dynamic se
let sites = emberA([{ id: 's-1' }, { id: 's-2' }, { id: 's-3' }]);
let site_articles = emberA([{ id: 'a-1' }, { id: 'a-2' }, { id: 'a-3' }]);
- this.registerController('application', Controller.extend({
+ this.add('controller:application', Controller.extend({
siteArticles: site_articles,
sites,
allSitesAllArticles: computed({
@@ -460,7 +460,7 @@ moduleFor('Query Params - model-dependent state (nested & more than 1 dynamic se
let self = this;
let assert = this.assert;
- this.registerRoute('site', Route.extend({
+ this.add('route:site', Route.extend({
model(params) {
if (self.expectedSiteModelHookParams) {
assert.deepEqual(params, self.expectedSiteModelHookParams, 'the SiteRoute model hook received the expected merged dynamic segment + query params hash');
@@ -470,7 +470,7 @@ moduleFor('Query Params - model-dependent state (nested & more than 1 dynamic se
}
}));
- this.registerRoute('site.article', Route.extend({
+ this.add('route:site.article', Route.extend({
model(params) {
if (self.expectedArticleModelHookParams) {
assert.deepEqual(params, self.expectedArticleModelHookParams, 'the SiteArticleRoute model hook received the expected merged dynamic segment + query params hash');
@@ -480,23 +480,23 @@ moduleFor('Query Params - model-dependent state (nested & more than 1 dynamic se
}
}));
- this.registerController('site', Controller.extend({
+ this.add('controller:site', Controller.extend({
queryParams: ['country'],
country: 'au'
}));
- this.registerController('site.article', Controller.extend({
+ this.add('controller:site.article', Controller.extend({
queryParams: ['q', 'z'],
q: 'wat',
z: 0
}));
- this.registerController('site.article.comments', Controller.extend({
+ this.add('controller:site.article.comments', Controller.extend({
queryParams: ['page'],
page: 1
}));
- this.registerTemplate('application', '{{#each allSitesAllArticles as |a|}} {{#link-to \'site.article\' a.site_id a.article_id id=a.id}}Article [{{a.site_id}}] [{{a.article_id}}]{{/link-to}} {{/each}} {{outlet}}');
+ this.addTemplate('application', '{{#each allSitesAllArticles as |a|}} {{#link-to \'site.article\' a.site_id a.article_id id=a.id}}Article [{{a.site_id}}] [{{a.article_id}}]{{/link-to}} {{/each}} {{outlet}}');
}
visitApplication() {
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember/tests/routing/query_params_test/overlapping_query_params_test.js
|
@@ -113,8 +113,8 @@ moduleFor('Query Params - overlapping query param property names', class extends
let parentController = Controller.extend({
queryParams: { page: 'page' }
});
- this.registerController('parent', parentController);
- this.registerRoute('parent.child', Route.extend({controllerName: 'parent'}));
+ this.add('controller:parent', parentController);
+ this.add('route:parent.child', Route.extend({controllerName: 'parent'}));
return this.setupBase('/parent').then(() => {
this.transitionTo('parent.child', { queryParams: { page: 2 } });
@@ -140,11 +140,11 @@ moduleFor('Query Params - overlapping query param property names', class extends
page: 1
});
- this.registerController('parent', Controller.extend(HasPage, {
+ this.add('controller:parent', Controller.extend(HasPage, {
queryParams: { page: 'yespage' }
}));
- this.registerController('parent.child', Controller.extend(HasPage));
+ this.add('controller:parent.child', Controller.extend(HasPage));
return this.setupBase().then(() => {
this.assertCurrentPath('/parent/child');
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember/tests/routing/query_params_test/query_param_async_get_handler_test.js
|
@@ -59,7 +59,7 @@ moduleFor('Query Params - async get handler', class extends QueryParamTestCase {
this.setSingleQPController('post');
let setupAppTemplate = () => {
- this.registerTemplate('application', `
+ this.addTemplate('application', `
{{link-to 'Post' 'post' 1337 (query-params foo='bar') class='post-link'}}
{{link-to 'Post' 'post' 7331 (query-params foo='boo') class='post-link'}}
{{outlet}}
@@ -202,13 +202,13 @@ moduleFor('Query Params - async get handler', class extends QueryParamTestCase {
this.route('example');
});
- this.registerTemplate('application', '{{link-to \'Example\' \'example\' (query-params foo=undefined) id=\'the-link\'}}');
+ this.addTemplate('application', '{{link-to \'Example\' \'example\' (query-params foo=undefined) id=\'the-link\'}}');
this.setSingleQPController('example', 'foo', undefined, {
foo: undefined
});
- this.registerRoute('example', Route.extend({
+ this.add('route:example', Route.extend({
model(params) {
assert.deepEqual(params, { foo: undefined });
}
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember/tests/routing/query_params_test/query_params_paramless_link_to_test.js
|
@@ -6,9 +6,9 @@ moduleFor('Query Params - paramless link-to', class extends QueryParamTestCase {
testParamlessLinks(assert, routeName) {
assert.expect(1);
- this.registerTemplate(routeName, '{{link-to \'index\' \'index\' id=\'index-link\'}}');
+ this.addTemplate(routeName, '{{link-to \'index\' \'index\' id=\'index-link\'}}');
- this.registerController(routeName, Controller.extend({
+ this.add(`controller:${routeName}`, Controller.extend({
queryParams: ['foo'],
foo: 'wat'
}));
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember/tests/routing/query_params_test/shared_state_test.js
|
@@ -20,24 +20,24 @@ moduleFor('Query Params - shared service state', class extends QueryParamTestCas
this.route('dashboard');
});
- this.application.register('service:filters', Service.extend({
+ this.add('service:filters', Service.extend({
shared: true
}));
- this.registerController('home', Controller.extend({
+ this.add('controller:home', Controller.extend({
filters: Ember.inject.service()
}));
- this.registerController('dashboard', Controller.extend({
+ this.add('controller:dashboard', Controller.extend({
filters: Ember.inject.service(),
queryParams: [
{ 'filters.shared': 'shared' }
]
}));
- this.registerTemplate('application', `{{link-to 'Home' 'home' }} <div> {{outlet}} </div>`);
- this.registerTemplate('home', `{{link-to 'Dashboard' 'dashboard' }}{{input type="checkbox" id='filters-checkbox' checked=(mut filters.shared) }}`);
- this.registerTemplate('dashboard', `{{link-to 'Home' 'home' }}`);
+ this.addTemplate('application', `{{link-to 'Home' 'home' }} <div> {{outlet}} </div>`);
+ this.addTemplate('home', `{{link-to 'Dashboard' 'dashboard' }}{{input type="checkbox" id='filters-checkbox' checked=(mut filters.shared) }}`);
+ this.addTemplate('dashboard', `{{link-to 'Home' 'home' }}`);
}
visitApplication() {
return this.visit('/');
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember/tests/routing/router_service_test/basic_test.js
|
@@ -72,7 +72,7 @@ if (isFeatureEnabled('ember-routing-router-service')) {
['@test RouterService#rootURL is correctly set to a custom value'](assert) {
assert.expect(1);
- this.registerRoute('parent.index', Route.extend({
+ this.add('route:parent.index', Route.extend({
init() {
this._super();
set(this.router, 'rootURL', '/homepage');
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember/tests/routing/router_service_test/currenturl_lifecycle_test.js
|
@@ -43,11 +43,11 @@ if (isFeatureEnabled('ember-routing-router-service')) {
ROUTE_NAMES.forEach((name) => {
let routeName = `parent.${name}`;
- this.registerRoute(routeName, InstrumentedRoute.extend());
- this.registerTemplate(routeName, '{{current-url}}');
+ this.add(`route:${routeName}`, InstrumentedRoute.extend());
+ this.addTemplate(routeName, '{{current-url}}');
});
- this.registerComponent('current-url', {
+ this.addComponent('current-url', {
ComponentClass: Component.extend({
routerService: inject.service('router'),
currentURL: readOnly('routerService.currentURL')
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember/tests/routing/router_service_test/replaceWith_test.js
|
@@ -15,7 +15,7 @@ if (isFeatureEnabled('ember-routing-router-service')) {
let testCase = this;
testCase.state = [];
- this.application.register('location:test', NoneLocation.extend({
+ this.add('location:test', NoneLocation.extend({
setURL(path) {
testCase.state.push(path);
this.set('path', path);
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember/tests/routing/router_service_test/transitionTo_test.js
|
@@ -22,7 +22,7 @@ if (isFeatureEnabled('ember-routing-router-service')) {
let testCase = this;
testCase.state = [];
- this.application.register('location:test', NoneLocation.extend({
+ this.add('location:test', NoneLocation.extend({
setURL(path) {
testCase.state.push(path);
this.set('path', path);
@@ -100,9 +100,9 @@ if (isFeatureEnabled('ember-routing-router-service')) {
let componentInstance;
- this.registerTemplate('parent.index', '{{foo-bar}}');
+ this.addTemplate('parent.index', '{{foo-bar}}');
- this.registerComponent('foo-bar', {
+ this.addComponent('foo-bar', {
ComponentClass: Component.extend({
routerService: inject.service('router'),
init() {
@@ -132,9 +132,9 @@ if (isFeatureEnabled('ember-routing-router-service')) {
let componentInstance;
- this.registerTemplate('parent.index', '{{foo-bar}}');
+ this.addTemplate('parent.index', '{{foo-bar}}');
- this.registerComponent('foo-bar', {
+ this.addComponent('foo-bar', {
ComponentClass: Component.extend({
routerService: inject.service('router'),
init() {
@@ -165,10 +165,10 @@ if (isFeatureEnabled('ember-routing-router-service')) {
let componentInstance;
let dynamicModel = { id: 1, contents: 'much dynamicism' };
- this.registerTemplate('parent.index', '{{foo-bar}}');
- this.registerTemplate('dynamic', '{{model.contents}}');
+ this.addTemplate('parent.index', '{{foo-bar}}');
+ this.addTemplate('dynamic', '{{model.contents}}');
- this.registerComponent('foo-bar', {
+ this.addComponent('foo-bar', {
ComponentClass: Component.extend({
routerService: inject.service('router'),
init() {
@@ -201,16 +201,16 @@ if (isFeatureEnabled('ember-routing-router-service')) {
let componentInstance;
let dynamicModel = { id: 1, contents: 'much dynamicism' };
- this.registerRoute('dynamic', Route.extend({
+ this.add('route:dynamic', Route.extend({
model() {
return dynamicModel;
}
}));
- this.registerTemplate('parent.index', '{{foo-bar}}');
- this.registerTemplate('dynamic', '{{model.contents}}');
+ this.addTemplate('parent.index', '{{foo-bar}}');
+ this.addTemplate('dynamic', '{{model.contents}}');
- this.registerComponent('foo-bar', {
+ this.addComponent('foo-bar', {
ComponentClass: Component.extend({
routerService: inject.service('router'),
init() {
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/ember/tests/routing/router_service_test/urlFor_test.js
|
@@ -176,7 +176,7 @@ if (isFeatureEnabled('ember-routing-router-service')) {
let expectedURL;
let dynamicModel = { id: 1 };
- this.registerRoute('dynamic', Route.extend({
+ this.add('route:dynamic', Route.extend({
model() {
return dynamicModel;
}
@@ -221,7 +221,7 @@ if (isFeatureEnabled('ember-routing-router-service')) {
let queryParams = buildQueryParams({ foo: 'bar' });
let dynamicModel = { id: 1 };
- this.registerRoute('dynamic', Route.extend({
+ this.add('route:dynamic', Route.extend({
model() {
return dynamicModel;
}
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/internal-test-helpers/lib/test-cases/abstract-application.js
|
@@ -5,6 +5,7 @@ import { Router } from 'ember-routing';
import { compile } from 'ember-template-compiler';
import AbstractTestCase from './abstract';
+import { ModuleBasedResolver } from '../test-resolver';
import { runDestroy } from '../run';
export default class AbstractApplicationTestCase extends AbstractTestCase {
@@ -13,17 +14,21 @@ export default class AbstractApplicationTestCase extends AbstractTestCase {
this.element = jQuery('#qunit-fixture')[0];
- this.application = run(Application, 'create', this.applicationOptions);
+ let { applicationOptions } = this;
+ this.application = run(Application, 'create', applicationOptions);
- this.router = this.application.Router = Router.extend(this.routerOptions);
+ this.resolver = applicationOptions.Resolver.lastInstance;
+
+ this.add('router:main', Router.extend(this.routerOptions));
this.applicationInstance = null;
}
get applicationOptions() {
return {
rootElement: '#qunit-fixture',
- autoboot: false
+ autoboot: false,
+ Resolver: ModuleBasedResolver
};
}
@@ -33,15 +38,16 @@ export default class AbstractApplicationTestCase extends AbstractTestCase {
};
}
+ get router() {
+ return this.application.resolveRegistration('router:main');
+ }
+
get appRouter() {
return this.applicationInstance.lookup('router:main');
}
teardown() {
- if (this.applicationInstance) {
- runDestroy(this.applicationInstance);
- }
-
+ runDestroy(this.applicationInstance);
runDestroy(this.application);
}
@@ -65,33 +71,26 @@ export default class AbstractApplicationTestCase extends AbstractTestCase {
return compile(...arguments);
}
- registerRoute(name, route) {
- this.application.register(`route:${name}`, route);
+ add(specifier, factory) {
+ this.resolver.add(specifier, factory);
}
- registerTemplate(name, template) {
- this.application.register(`template:${name}`, this.compile(template, {
- moduleName: name
+ addTemplate(templateName, templateString) {
+ this.resolver.add(`template:${templateName}`, this.compile(templateString, {
+ moduleName: templateName
}));
}
- registerComponent(name, { ComponentClass = null, template = null }) {
+ addComponent(name, { ComponentClass = null, template = null }) {
if (ComponentClass) {
- this.application.register(`component:${name}`, ComponentClass);
+ this.resolver.add(`component:${name}`, ComponentClass);
}
if (typeof template === 'string') {
- this.application.register(`template:components/${name}`, this.compile(template, {
+ this.resolver.add(`template:components/${name}`, this.compile(template, {
moduleName: `components/${name}`
}));
}
}
- registerController(name, controller) {
- this.application.register(`controller:${name}`, controller);
- }
-
- registerEngine(name, engine) {
- this.application.register(`engine:${name}`, engine);
- }
}
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/internal-test-helpers/lib/test-cases/query-param.js
|
@@ -11,7 +11,7 @@ export default class QueryParamTestCase extends ApplicationTestCase {
let testCase = this;
testCase.expectedPushURL = null;
testCase.expectedReplaceURL = null;
- this.application.register('location:test', NoneLocation.extend({
+ this.add('location:test', NoneLocation.extend({
setURL(path) {
if (testCase.expectedReplaceURL) {
testCase.assert.ok(false, 'pushState occurred but a replaceState was expected');
@@ -76,7 +76,7 @@ export default class QueryParamTestCase extends ApplicationTestCase {
@method setSingleQPController
*/
setSingleQPController(routeName, param = 'foo', defaultValue = 'bar', options = {}) {
- this.registerController(routeName, Controller.extend({
+ this.add(`controller:${routeName}`, Controller.extend({
queryParams: [param],
[param]: defaultValue
}, options));
@@ -89,7 +89,7 @@ export default class QueryParamTestCase extends ApplicationTestCase {
@method setMappedQPController
*/
setMappedQPController(routeName, prop = 'page', urlKey = 'parentPage', defaultValue = 1, options = {}) {
- this.registerController(routeName, Controller.extend({
+ this.add(`controller:${routeName}`, Controller.extend({
queryParams: {
[prop]: urlKey
},
| true |
Other
|
emberjs
|
ember.js
|
0296f161b6e976719c11255dafaa055cbca3e9ec.json
|
Change the ApplicationTest to TestResolver
|
packages/internal-test-helpers/lib/test-resolver.js
|
@@ -9,6 +9,9 @@ class Resolver {
return this._registered[specifier];
}
add(specifier, factory) {
+ if (specifier.indexOf(':') === -1) {
+ throw new Error('Specifiers added to the resolver must be in the format of type:name');
+ }
return this._registered[specifier] = factory;
}
addTemplate(templateName, template) {
| true |
Other
|
emberjs
|
ember.js
|
e53c8d247965820b066eb1166f0ea3e055852fc2.json
|
Convert application_test to test resolver
|
packages/ember-application/tests/system/application_test.js
|
@@ -24,389 +24,404 @@ import {
_loaded
} from 'ember-runtime';
import { compile } from 'ember-template-compiler';
-import { setTemplates, setTemplate } from 'ember-glimmer';
+import { setTemplates } from 'ember-glimmer';
import { privatize as P } from 'container';
import {
verifyInjection,
verifyRegistration
} from '../test-helpers/registry-check';
+import { assign } from 'ember-utils';
+import {
+ moduleFor,
+ ApplicationTestCase,
+ AbstractTestCase,
+ AutobootApplicationTestCase
+} from 'internal-test-helpers';
let { trim } = jQuery;
+let secondApp;
+
+moduleFor('Ember.Application, autobooting multiple apps', class extends ApplicationTestCase {
+ constructor() {
+ jQuery('#qunit-fixture').html(`
+ <div id="one">
+ <div id="one-child">HI</div>
+ </div>
+ <div id="two">HI</div>
+ `);
+ super();
+ }
-let app, application, originalLookup, originalDebug, originalWarn;
-
-QUnit.module('Ember.Application', {
- setup() {
- originalLookup = context.lookup;
- originalDebug = getDebugFunction('debug');
- originalWarn = getDebugFunction('warn');
+ get applicationOptions() {
+ return assign(super.applicationOptions, {
+ rootElement: '#one',
+ router: null,
+ autoboot: true
+ });
+ }
- jQuery('#qunit-fixture').html('<div id=\'one\'><div id=\'one-child\'>HI</div></div><div id=\'two\'>HI</div>');
- application = run(() => Application.create({ rootElement: '#one', router: null }));
- },
+ buildSecondApplication(options) {
+ let myOptions = assign(this.applicationOptions, options);
+ return this.secondApp = Application.create(myOptions);
+ }
teardown() {
- jQuery('#qunit-fixture').empty();
- setDebugFunction('debug', originalDebug);
- setDebugFunction('warn', originalWarn);
-
- context.lookup = originalLookup;
+ super.teardown();
- if (application) {
- run(application, 'destroy');
- }
-
- if (app) {
- run(app, 'destroy');
+ if (this.secondApp) {
+ run(this.secondApp, 'destroy');
}
}
-});
-QUnit.test('you can make a new application in a non-overlapping element', function() {
- app = run(() => Application.create({ rootElement: '#two', router: null }));
+ [`@test you can make a new application in a non-overlapping element`](assert) {
+ let app = run(() => this.buildSecondApplication({
+ rootElement: '#two'
+ }));
- run(app, 'destroy');
- ok(true, 'should not raise');
-});
+ run(app, 'destroy');
+ assert.ok(true, 'should not raise');
+ }
-QUnit.test('you cannot make a new application that is a parent of an existing application', function() {
- expectAssertion(() => {
- run(() => Application.create({ rootElement: '#qunit-fixture' }));
- });
-});
+ [`@test you cannot make a new application that is a parent of an existing application`]() {
+ expectAssertion(() => {
+ run(() => this.buildSecondApplication({
+ rootElement: '#qunit-fixture'
+ }));
+ });
+ }
-QUnit.test('you cannot make a new application that is a descendant of an existing application', function() {
- expectAssertion(() => {
- run(() => Application.create({ rootElement: '#one-child' }));
- });
-});
+ [`@test you cannot make a new application that is a descendant of an existing application`]() {
+ expectAssertion(() => {
+ run(() => this.buildSecondApplication({
+ rootElement: '#one-child'
+ }));
+ });
+ }
-QUnit.test('you cannot make a new application that is a duplicate of an existing application', function() {
- expectAssertion(() => {
- run(() => Application.create({ rootElement: '#one' }));
- });
-});
+ [`@test you cannot make a new application that is a duplicate of an existing application`]() {
+ expectAssertion(() => {
+ run(() => this.buildSecondApplication({
+ rootElement: '#one'
+ }));
+ });
+ }
-QUnit.test('you cannot make two default applications without a rootElement error', function() {
- expectAssertion(() => {
- run(() => Application.create({ router: false }));
- });
+ [`@test you cannot make two default applications without a rootElement error`]() {
+ expectAssertion(() => {
+ run(() => this.buildSecondApplication());
+ });
+ }
});
-QUnit.test('acts like a namespace', function() {
- let lookup = context.lookup = {};
+moduleFor('Ember.Application', class extends ApplicationTestCase {
- app = run(() => {
- return lookup.TestApp = Application.create({ rootElement: '#two', router: false });
- });
+ ['@test includes deprecated access to `application.registry`'](assert) {
+ assert.expect(3);
- setNamespaceSearchDisabled(false);
- app.Foo = EmberObject.extend();
- equal(app.Foo.toString(), 'TestApp.Foo', 'Classes pick up their parent namespace');
-});
+ assert.ok(typeof this.application.registry.register === 'function', '#registry.register is available as a function');
-QUnit.test('includes deprecated access to `application.registry`', function() {
- expect(3);
+ this.application.__registry__.register = function() {
+ assert.ok(true, '#register alias is called correctly');
+ };
- ok(typeof application.registry.register === 'function', '#registry.register is available as a function');
+ expectDeprecation(() => {
+ this.application.registry.register();
+ }, /Using `Application.registry.register` is deprecated. Please use `Application.register` instead./);
+ }
- application.__registry__.register = function() {
- ok(true, '#register alias is called correctly');
- };
+ [`@test builds a registry`](assert) {
+ let {application} = this;
+ assert.strictEqual(application.resolveRegistration('application:main'), application, `application:main is registered`);
+ assert.deepEqual(application.registeredOptionsForType('component'), { singleton: false }, `optionsForType 'component'`);
+ assert.deepEqual(application.registeredOptionsForType('view'), { singleton: false }, `optionsForType 'view'`);
+ verifyRegistration(application, 'controller:basic');
+ verifyRegistration(application, '-view-registry:main');
+ verifyInjection(application, 'view', '_viewRegistry', '-view-registry:main');
+ verifyInjection(application, 'route', '_topLevelViewTemplate', 'template:-outlet');
+ verifyRegistration(application, 'route:basic');
+ verifyRegistration(application, 'event_dispatcher:main');
+ verifyInjection(application, 'router:main', 'namespace', 'application:main');
+ verifyInjection(application, 'view:-outlet', 'namespace', 'application:main');
+
+ verifyRegistration(application, 'location:auto');
+ verifyRegistration(application, 'location:hash');
+ verifyRegistration(application, 'location:history');
+ verifyRegistration(application, 'location:none');
+
+ verifyInjection(application, 'controller', 'target', 'router:main');
+ verifyInjection(application, 'controller', 'namespace', 'application:main');
+
+ verifyRegistration(application, P`-bucket-cache:main`);
+ verifyInjection(application, 'router', '_bucketCache', P`-bucket-cache:main`);
+ verifyInjection(application, 'route', '_bucketCache', P`-bucket-cache:main`);
+
+ verifyInjection(application, 'route', 'router', 'router:main');
+
+ verifyRegistration(application, 'component:-text-field');
+ verifyRegistration(application, 'component:-text-area');
+ verifyRegistration(application, 'component:-checkbox');
+ verifyRegistration(application, 'component:link-to');
+
+ verifyRegistration(application, 'service:-routing');
+ verifyInjection(application, 'service:-routing', 'router', 'router:main');
+
+ // DEBUGGING
+ verifyRegistration(application, 'resolver-for-debugging:main');
+ verifyInjection(application, 'container-debug-adapter:main', 'resolver', 'resolver-for-debugging:main');
+ verifyInjection(application, 'data-adapter:main', 'containerDebugAdapter', 'container-debug-adapter:main');
+ verifyRegistration(application, 'container-debug-adapter:main');
+ verifyRegistration(application, 'component-lookup:main');
+
+ verifyRegistration(application, 'service:-glimmer-environment');
+ verifyRegistration(application, 'service:-dom-changes');
+ verifyRegistration(application, 'service:-dom-tree-construction');
+ verifyInjection(application, 'service:-glimmer-environment', 'appendOperations', 'service:-dom-tree-construction');
+ verifyInjection(application, 'service:-glimmer-environment', 'updateOperations', 'service:-dom-changes');
+ verifyInjection(application, 'renderer', 'env', 'service:-glimmer-environment');
+ verifyRegistration(application, 'view:-outlet');
+ verifyRegistration(application, 'renderer:-dom');
+ verifyRegistration(application, 'renderer:-inert');
+ verifyRegistration(application, P`template:components/-default`);
+ verifyRegistration(application, 'template:-outlet');
+ verifyInjection(application, 'view:-outlet', 'template', 'template:-outlet');
+ verifyInjection(application, 'template', 'env', 'service:-glimmer-environment');
+ assert.deepEqual(application.registeredOptionsForType('helper'), { instantiate: false }, `optionsForType 'helper'`);
+ }
- expectDeprecation(() => {
- application.registry.register();
- }, /Using `Application.registry.register` is deprecated. Please use `Application.register` instead./);
});
-QUnit.test('builds a registry', function() {
- strictEqual(application.resolveRegistration('application:main'), application, `application:main is registered`);
- deepEqual(application.registeredOptionsForType('component'), { singleton: false }, `optionsForType 'component'`);
- deepEqual(application.registeredOptionsForType('view'), { singleton: false }, `optionsForType 'view'`);
- verifyRegistration(application, 'controller:basic');
- verifyRegistration(application, '-view-registry:main');
- verifyInjection(application, 'view', '_viewRegistry', '-view-registry:main');
- verifyInjection(application, 'route', '_topLevelViewTemplate', 'template:-outlet');
- verifyRegistration(application, 'route:basic');
- verifyRegistration(application, 'event_dispatcher:main');
- verifyInjection(application, 'router:main', 'namespace', 'application:main');
- verifyInjection(application, 'view:-outlet', 'namespace', 'application:main');
-
- verifyRegistration(application, 'location:auto');
- verifyRegistration(application, 'location:hash');
- verifyRegistration(application, 'location:history');
- verifyRegistration(application, 'location:none');
-
- verifyInjection(application, 'controller', 'target', 'router:main');
- verifyInjection(application, 'controller', 'namespace', 'application:main');
-
- verifyRegistration(application, P`-bucket-cache:main`);
- verifyInjection(application, 'router', '_bucketCache', P`-bucket-cache:main`);
- verifyInjection(application, 'route', '_bucketCache', P`-bucket-cache:main`);
-
- verifyInjection(application, 'route', 'router', 'router:main');
-
- verifyRegistration(application, 'component:-text-field');
- verifyRegistration(application, 'component:-text-area');
- verifyRegistration(application, 'component:-checkbox');
- verifyRegistration(application, 'component:link-to');
-
- verifyRegistration(application, 'service:-routing');
- verifyInjection(application, 'service:-routing', 'router', 'router:main');
-
- // DEBUGGING
- verifyRegistration(application, 'resolver-for-debugging:main');
- verifyInjection(application, 'container-debug-adapter:main', 'resolver', 'resolver-for-debugging:main');
- verifyInjection(application, 'data-adapter:main', 'containerDebugAdapter', 'container-debug-adapter:main');
- verifyRegistration(application, 'container-debug-adapter:main');
- verifyRegistration(application, 'component-lookup:main');
-
- verifyRegistration(application, 'service:-glimmer-environment');
- verifyRegistration(application, 'service:-dom-changes');
- verifyRegistration(application, 'service:-dom-tree-construction');
- verifyInjection(application, 'service:-glimmer-environment', 'appendOperations', 'service:-dom-tree-construction');
- verifyInjection(application, 'service:-glimmer-environment', 'updateOperations', 'service:-dom-changes');
- verifyInjection(application, 'renderer', 'env', 'service:-glimmer-environment');
- verifyRegistration(application, 'view:-outlet');
- verifyRegistration(application, 'renderer:-dom');
- verifyRegistration(application, 'renderer:-inert');
- verifyRegistration(application, P`template:components/-default`);
- verifyRegistration(application, 'template:-outlet');
- verifyInjection(application, 'view:-outlet', 'template', 'template:-outlet');
- verifyInjection(application, 'template', 'env', 'service:-glimmer-environment');
- deepEqual(application.registeredOptionsForType('helper'), { instantiate: false }, `optionsForType 'helper'`);
-});
+moduleFor('Ember.Application, default resolver with autoboot', class extends AutobootApplicationTestCase {
-const originalLogVersion = ENV.LOG_VERSION;
+ constructor() {
+ super();
+ this.originalLookup = context.lookup;
+ }
-QUnit.module('Ember.Application initialization', {
teardown() {
- if (app) {
- run(app, 'destroy');
- }
+ context.lookup = this.originalLookup;
+ super.teardown();
setTemplates({});
- ENV.LOG_VERSION = originalLogVersion;
}
-});
-
-QUnit.test('initialized application goes to initial route', function() {
- run(() => {
- app = Application.create({
- rootElement: '#qunit-fixture'
- });
-
- app.Router.reopen({
- location: 'none'
- });
-
- app.register('template:application',
- compile('{{outlet}}')
- );
-
- setTemplate('index', compile(
- '<h1>Hi from index</h1>'
- ));
- });
- equal(jQuery('#qunit-fixture h1').text(), 'Hi from index');
-});
+ createApplication(options) {
+ let myOptions = assign({
+ Resolver: DefaultResolver
+ }, options);
+ return super.createApplication(myOptions);
+ }
-QUnit.test('ready hook is called before routing begins', function() {
- expect(2);
+ [`@test acts like a namespace`](assert) {
+ let lookup = context.lookup = {};
- run(() => {
- function registerRoute(application, name, callback) {
- let route = EmberRoute.extend({
- activate: callback
- });
+ run(() => {
+ lookup.TestApp = this.createApplication();
+ });
- application.register('route:' + name, route);
- }
+ setNamespaceSearchDisabled(false);
+ let Foo = this.application.Foo = EmberObject.extend();
+ assert.equal(Foo.toString(), 'TestApp.Foo', 'Classes pick up their parent namespace');
+ }
- let MyApplication = Application.extend({
- ready() {
- registerRoute(this, 'index', () => {
- ok(true, 'last-minute route is activated');
- });
- }
+ [`@test can specify custom router`](assert) {
+ let MyRouter = Router.extend();
+ run(() => {
+ let app = this.createApplication();
+ app.Router = MyRouter;
});
+ assert.ok(
+ this.application.__deprecatedInstance__.lookup('router:main') instanceof MyRouter,
+ 'application resolved the correct router'
+ );
+ }
- app = MyApplication.create({
- rootElement: '#qunit-fixture'
+ [`@test Minimal Application initialized with just an application template`](assert) {
+ jQuery('#qunit-fixture').html('<script type="text/x-handlebars">Hello World</script>');
+ run(() => {
+ this.createApplication();
});
- app.Router.reopen({
- location: 'none'
- });
+ equal(trim(jQuery('#qunit-fixture').text()), 'Hello World');
+ }
- registerRoute(app, 'application', () => ok(true, 'normal route is activated'));
- });
});
-QUnit.test('initialize application via initialize call', function() {
- run(() => {
- app = Application.create({
- rootElement: '#qunit-fixture'
- });
+moduleFor('Ember.Application, autobooting', class extends AutobootApplicationTestCase {
- app.Router.reopen({
- location: 'none'
- });
+ constructor() {
+ super();
+ this.originalLogVersion = ENV.LOG_VERSION;
+ this.originalDebug = getDebugFunction('debug');
+ this.originalWarn = getDebugFunction('warn');
+ }
- setTemplate('application', compile(
- '<h1>Hello!</h1>'
- ));
- });
+ teardown() {
+ setDebugFunction('warn', this.originalWarn);
+ setDebugFunction('debug', this.originalDebug);
+ ENV.LOG_VERSION = this.originalLogVersion;
+ super.teardown();
+ }
- // This is not a public way to access the container; we just
- // need to make some assertions about the created router
- let router = app.__container__.lookup('router:main');
- equal(router instanceof Router, true, 'Router was set from initialize call');
- equal(router.location instanceof NoneLocation, true, 'Location was set from location implementation name');
-});
+ createApplication(options, MyApplication) {
+ let application = super.createApplication(options, MyApplication);
+ this.add('router:main', Router.extend({
+ location: 'none'
+ }));
+ return application;
+ }
-QUnit.test('initialize application with stateManager via initialize call from Router class', function() {
- run(() => {
- app = Application.create({
- rootElement: '#qunit-fixture'
+ [`@test initialized application goes to initial route`](assert) {
+ run(() => {
+ this.createApplication();
+ this.addTemplate('application', '{{outlet}}');
+ this.addTemplate('index', '<h1>Hi from index</h1>');
});
- app.Router.reopen({
- location: 'none'
- });
+ assert.equal(jQuery('#qunit-fixture h1').text(), 'Hi from index');
+ }
- app.register('template:application', compile('<h1>Hello!</h1>'));
- });
+ [`@test ready hook is called before routing begins`](assert) {
+ assert.expect(2);
- let router = app.__container__.lookup('router:main');
- equal(router instanceof Router, true, 'Router was set from initialize call');
- equal(jQuery('#qunit-fixture h1').text(), 'Hello!');
-});
+ run(() => {
+ function registerRoute(application, name, callback) {
+ let route = EmberRoute.extend({
+ activate: callback
+ });
-QUnit.test('ApplicationView is inserted into the page', function() {
- run(() => {
- app = Application.create({
- rootElement: '#qunit-fixture'
- });
+ application.register('route:' + name, route);
+ }
- setTemplate('application', compile('<h1>Hello!</h1>'));
+ let MyApplication = Application.extend({
+ ready() {
+ registerRoute(this, 'index', () => {
+ assert.ok(true, 'last-minute route is activated');
+ });
+ }
+ });
- app.ApplicationController = Controller.extend();
+ let app = this.createApplication({}, MyApplication);
- app.Router.reopen({
- location: 'none'
+ registerRoute(app, 'application', () => ok(true, 'normal route is activated'));
});
- });
-
- equal(jQuery('#qunit-fixture h1').text(), 'Hello!');
-});
+ }
-QUnit.test('Minimal Application initialized with just an application template', function() {
- jQuery('#qunit-fixture').html('<script type="text/x-handlebars">Hello World</script>');
- app = run(() => {
- return Application.create({
- rootElement: '#qunit-fixture'
+ [`@test initialize application via initialize call`](assert) {
+ run(() => {
+ this.createApplication();
});
- });
+ // This is not a public way to access the container; we just
+ // need to make some assertions about the created router
+ let router = this.application.__deprecatedInstance__.lookup('router:main');
+ assert.equal(router instanceof Router, true, 'Router was set from initialize call');
+ assert.equal(router.location instanceof NoneLocation, true, 'Location was set from location implementation name');
+ }
- equal(trim(jQuery('#qunit-fixture').text()), 'Hello World');
-});
+ [`@test initialize application with stateManager via initialize call from Router class`](assert) {
+ run(() => {
+ this.createApplication();
+ this.addTemplate('application', '<h1>Hello!</h1>');
+ });
+ // This is not a public way to access the container; we just
+ // need to make some assertions about the created router
+ let router = this.application.__deprecatedInstance__.lookup('router:main');
+ assert.equal(router instanceof Router, true, 'Router was set from initialize call');
+ assert.equal(jQuery('#qunit-fixture h1').text(), 'Hello!');
+ }
-QUnit.test('enable log of libraries with an ENV var', function() {
- if (EmberDev && EmberDev.runningProdBuild) {
- ok(true, 'Logging does not occur in production builds');
- return;
+ [`@test Application Controller backs the appplication template`](assert) {
+ run(() => {
+ this.createApplication();
+ this.addTemplate('application', '<h1>{{greeting}}</h1>');
+ this.add('controller:application', Controller.extend({
+ greeting: 'Hello!'
+ }));
+ });
+ assert.equal(jQuery('#qunit-fixture h1').text(), 'Hello!');
}
- let messages = [];
+ [`@test enable log of libraries with an ENV var`](assert) {
+ if (EmberDev && EmberDev.runningProdBuild) {
+ assert.ok(true, 'Logging does not occur in production builds');
+ return;
+ }
- ENV.LOG_VERSION = true;
+ let messages = [];
- setDebugFunction('debug', message => messages.push(message));
+ ENV.LOG_VERSION = true;
- libraries.register('my-lib', '2.0.0a');
+ setDebugFunction('debug', message => messages.push(message));
- app = run(() => {
- return Application.create({
- rootElement: '#qunit-fixture'
- });
- });
+ libraries.register('my-lib', '2.0.0a');
- equal(messages[1], 'Ember : ' + VERSION);
- equal(messages[2], 'jQuery : ' + jQuery().jquery);
- equal(messages[3], 'my-lib : ' + '2.0.0a');
+ run(() => {
+ this.createApplication();
+ });
- libraries.deRegister('my-lib');
-});
+ assert.equal(messages[1], 'Ember : ' + VERSION);
+ assert.equal(messages[2], 'jQuery : ' + jQuery().jquery);
+ assert.equal(messages[3], 'my-lib : ' + '2.0.0a');
-QUnit.test('disable log version of libraries with an ENV var', function() {
- let logged = false;
+ libraries.deRegister('my-lib');
+ }
- ENV.LOG_VERSION = false;
+ [`@test disable log of version of libraries with an ENV var`](assert) {
+ let logged = false;
- setDebugFunction('debug', () => logged = true);
+ ENV.LOG_VERSION = false;
- jQuery('#qunit-fixture').empty();
+ setDebugFunction('debug', () => logged = true);
- run(() => {
- app = Application.create({
- rootElement: '#qunit-fixture'
+ run(() => {
+ this.createApplication();
});
- app.Router.reopen({
- location: 'none'
- });
- });
+ assert.ok(!logged, 'library version logging skipped');
+ }
- ok(!logged, 'library version logging skipped');
-});
+ [`@test can resolve custom router`](assert) {
+ let CustomRouter = Router.extend();
-QUnit.test('can resolve custom router', function() {
- let CustomRouter = Router.extend();
+ run(() => {
+ this.createApplication();
+ this.add('router:main', CustomRouter);
+ });
- let Resolver = DefaultResolver.extend({
- resolveMain(parsedName) {
- if (parsedName.type === 'router') {
- return CustomRouter;
- } else {
- return this._super(parsedName);
- }
- }
- });
+ assert.ok(
+ this.application.__deprecatedInstance__.lookup('router:main') instanceof CustomRouter,
+ 'application resolved the correct router'
+ );
+ }
- app = run(() => {
- return Application.create({
- Resolver
+ [`@test does not leak itself in onLoad._loaded`](assert) {
+ assert.equal(_loaded.application, undefined);
+ run(() => this.createApplication());
+ assert.equal(_loaded.application, this.application);
+ run(this.application, 'destroy');
+ assert.equal(_loaded.application, undefined);
+ }
+
+ [`@test can build a registry via Ember.Application.buildRegistry() --- simulates ember-test-helpers`](assert) {
+ let namespace = EmberObject.create({
+ Resolver: { create: function() { } }
});
- });
- ok(app.__container__.lookup('router:main') instanceof CustomRouter, 'application resolved the correct router');
-});
+ let registry = Application.buildRegistry(namespace);
-QUnit.test('can specify custom router', function() {
- app = run(() => {
- return Application.create({
- Router: Router.extend()
- });
- });
+ assert.equal(registry.resolve('application:main'), namespace);
+ }
- ok(app.__container__.lookup('router:main') instanceof Router, 'application resolved the correct router');
});
-QUnit.test('does not leak itself in onLoad._loaded', function() {
- equal(_loaded.application, undefined);
- let app = run(Application, 'create');
- equal(_loaded.application, app);
- run(app, 'destroy');
- equal(_loaded.application, undefined);
-});
+moduleFor('Ember.Application#buildRegistry', class extends AbstractTestCase {
-QUnit.test('can build a registry via Ember.Application.buildRegistry() --- simulates ember-test-helpers', function(assert) {
- let namespace = EmberObject.create({
- Resolver: { create: function() { } }
- });
+ [`@test can build a registry via Ember.Application.buildRegistry() --- simulates ember-test-helpers`](assert) {
+ let namespace = EmberObject.create({
+ Resolver: { create() { } }
+ });
+
+ let registry = Application.buildRegistry(namespace);
- let registry = Application.buildRegistry(namespace);
+ assert.equal(registry.resolve('application:main'), namespace);
+ }
- assert.equal(registry.resolve('application:main'), namespace);
});
| true |
Other
|
emberjs
|
ember.js
|
e53c8d247965820b066eb1166f0ea3e055852fc2.json
|
Convert application_test to test resolver
|
packages/internal-test-helpers/lib/index.js
|
@@ -28,3 +28,9 @@ export { default as QueryParamTestCase } from './test-cases/query-param';
export { default as AbstractRenderingTestCase } from './test-cases/abstract-rendering';
export { default as RenderingTestCase } from './test-cases/rendering';
export { default as RouterTestCase } from './test-cases/router';
+export { default as AutobootApplicationTestCase } from './test-cases/autoboot-application';
+
+export {
+ default as TestResolver,
+ ModuleBasedResolver as ModuleBasedTestResolver
+} from './test-resolver';
| true |
Other
|
emberjs
|
ember.js
|
e53c8d247965820b066eb1166f0ea3e055852fc2.json
|
Convert application_test to test resolver
|
packages/internal-test-helpers/lib/test-cases/autoboot-application.js
|
@@ -0,0 +1,33 @@
+import AbstractTestCase from './abstract';
+import TestResolver from '../test-resolver';
+import { Application } from 'ember-application';
+import { assign } from 'ember-utils';
+import { runDestroy } from '../run';
+
+export default class AutobootApplicationTestCase extends AbstractTestCase {
+
+ teardown() {
+ runDestroy(this.application);
+ super.teardown();
+ }
+
+ createApplication(options, MyApplication=Application) {
+ let myOptions = assign({
+ rootElement: '#qunit-fixture',
+ Resolver: TestResolver
+ }, options);
+ let application = this.application = MyApplication.create(myOptions);
+ this.resolver = myOptions.Resolver.lastInstance;
+ return application;
+ }
+
+ add(specifier, factory) {
+ this.resolver.add(specifier, factory);
+ }
+
+ addTemplate(templateName, templateString) {
+ this.resolver.addTemplate(templateName, templateString);
+ }
+
+}
+
| true |
Other
|
emberjs
|
ember.js
|
e53c8d247965820b066eb1166f0ea3e055852fc2.json
|
Convert application_test to test resolver
|
packages/internal-test-helpers/lib/test-resolver.js
|
@@ -0,0 +1,40 @@
+import { compile } from 'ember-template-compiler';
+
+class Resolver {
+ constructor() {
+ this._registered = {};
+ this.constructor.lastInstance = this;
+ }
+ resolve(specifier) {
+ return this._registered[specifier];
+ }
+ add(specifier, factory) {
+ return this._registered[specifier] = factory;
+ }
+ addTemplate(templateName, template) {
+ let templateType = typeof template;
+ if (templateType !== 'string') {
+ throw new Error(`You called addTemplate for "${templateName}" with a template argument of type of '${templateType}'. addTemplate expects an argument of an uncompiled template as a string.`);
+ }
+ return this._registered[`template:${templateName}`] = compile(template, {
+ moduleName: templateName
+ });
+ }
+ static create() {
+ return new this();
+ }
+}
+
+export default Resolver;
+
+/*
+ * A resolver with moduleBasedResolver = true handles error and loading
+ * substates differently than a standard resolver.
+ */
+class ModuleBasedResolver extends Resolver {
+ get moduleBasedResolver() {
+ return true;
+ }
+}
+
+export { ModuleBasedResolver }
| true |
Other
|
emberjs
|
ember.js
|
56dcecfd09231b18c7cafeb3d2e2c17222d87cb8.json
|
Remove unnecessary comments
|
packages/ember/tests/routing/query_params_test/model_dependent_state_with_query_params_test.js
|
@@ -75,7 +75,7 @@ class ModelDependentQPTestCase extends QueryParamTestCase {
assert.equal(this.controller.get('q'), 'lol');
assert.equal(this.controller.get('z'), 0);
assert.equal(this.$link1.attr('href'), `${urlPrefix}/a-1?q=lol`);
- assert.equal(this.$link2.attr('href'), `${urlPrefix}/a-2?q=lol`); // fail
+ assert.equal(this.$link2.attr('href'), `${urlPrefix}/a-2?q=lol`);
assert.equal(this.$link3.attr('href'), `${urlPrefix}/a-3`);
this.expectedModelHookParams = { id: 'a-3', q: 'lol', z: 123 };
@@ -530,7 +530,7 @@ moduleFor('Query Params - model-dependent state (nested & more than 1 dynamic se
}
['@test query params have \'model\' stickiness by default'](assert) {
- assert.expect(59); // Insane.
+ assert.expect(59);
return this.boot().then(() => {
run(this.links['s-1-a-1'], 'click');
@@ -599,7 +599,7 @@ moduleFor('Query Params - model-dependent state (nested & more than 1 dynamic se
}
['@test query params have \'model\' stickiness by default (url changes)'](assert) {
- assert.expect(88); // INSANE.
+ assert.expect(88);
return this.boot().then(() => {
this.expectedSiteModelHookParams = { site_id: 's-1', country: 'au' };
@@ -700,7 +700,7 @@ moduleFor('Query Params - model-dependent state (nested & more than 1 dynamic se
}
['@test query params have \'model\' stickiness by default (params-based transitions)'](assert) {
- assert.expect(118); // <-- INSANE! Like why is this even a thing?
+ assert.expect(118);
return this.boot().then(() => {
this.expectedSiteModelHookParams = { site_id: 's-1', country: 'au' };
| false |
Other
|
emberjs
|
ember.js
|
cce1f08a9f8b7a0ecca3574d43be98691d761afe.json
|
Rollup more leaf packages
|
ember-cli-build.js
|
@@ -42,10 +42,10 @@ const SHOULD_ROLLUP = true;
module.exports = function(options) {
let tokenizer = simpleHTMLTokenizerES();
- let container = emberPkgES('container');
+ let container = emberPkgES('container', SHOULD_ROLLUP, ['ember-debug', 'ember-utils', 'ember-environment']);
let emberMetal = emberPkgES('ember-metal', SHOULD_ROLLUP, ['ember-debug', 'ember-environment', 'ember-utils', '@glimmer/reference', 'require', 'backburner', 'ember-console']);
- let emberEnvironment = emberPkgES('ember-environment');
- let emberConsole = emberPkgES('ember-console');
+ let emberEnvironment = emberPkgES('ember-environment', SHOULD_ROLLUP);
+ let emberConsole = emberPkgES('ember-console', SHOULD_ROLLUP, ['ember-environment']);
let emberMain = emberPkgES('ember');
let emberViews = emberPkgES('ember-views');
let emberApplication = emberPkgES('ember-application');
@@ -54,7 +54,7 @@ module.exports = function(options) {
let emberRouting = emberPkgES('ember-routing');
let emberGlimmer = emberGlimmerES();
let internalTestHelpers = emberPkgES('internal-test-helpers');
- let emberUtils = emberPkgES('ember-utils');
+ let emberUtils = emberPkgES('ember-utils', SHOULD_ROLLUP);
let emberTemplateCompiler = emberPkgES('ember-template-compiler');
let backburner = backburnerES();
let glimmerWireFormat = glimmerPkgES('@glimmer/wire-format', ['@glimmer/util']);
| true |
Other
|
emberjs
|
ember.js
|
cce1f08a9f8b7a0ecca3574d43be98691d761afe.json
|
Rollup more leaf packages
|
packages/container/tests/container_test.js
|
@@ -1,7 +1,7 @@
import { getOwner, OWNER } from 'ember-utils';
import { ENV } from 'ember-environment';
import { get } from 'ember-metal';
-import { Registry } from '../index';
+import { Registry } from '..';
import { factory } from 'internal-test-helpers';
import { isFeatureEnabled } from 'ember-debug';
import { LOOKUP_FACTORY, FACTORY_FOR } from 'container';
| true |
Other
|
emberjs
|
ember.js
|
cce1f08a9f8b7a0ecca3574d43be98691d761afe.json
|
Rollup more leaf packages
|
packages/container/tests/registry_test.js
|
@@ -1,4 +1,4 @@
-import { Registry } from '../index';
+import { Registry } from '..';
import { factory } from 'internal-test-helpers';
QUnit.module('Registry');
| true |
Other
|
emberjs
|
ember.js
|
cce1f08a9f8b7a0ecca3574d43be98691d761afe.json
|
Rollup more leaf packages
|
packages/ember-utils/tests/assign_test.js
|
@@ -1,4 +1,4 @@
-import assign from '../assign';
+import { assign } from '..';
QUnit.module('Ember.assign');
| true |
Other
|
emberjs
|
ember.js
|
cce1f08a9f8b7a0ecca3574d43be98691d761afe.json
|
Rollup more leaf packages
|
packages/ember-utils/tests/can_invoke_test.js
|
@@ -1,4 +1,4 @@
-import { canInvoke } from '../index';
+import { canInvoke } from '..';
let obj;
| true |
Other
|
emberjs
|
ember.js
|
cce1f08a9f8b7a0ecca3574d43be98691d761afe.json
|
Rollup more leaf packages
|
packages/ember-utils/tests/checkHasSuper_test.js
|
@@ -1,5 +1,5 @@
import { environment } from 'ember-environment';
-import { checkHasSuper } from '../index';
+import { checkHasSuper } from '..';
QUnit.module('checkHasSuper');
| true |
Other
|
emberjs
|
ember.js
|
cce1f08a9f8b7a0ecca3574d43be98691d761afe.json
|
Rollup more leaf packages
|
packages/ember-utils/tests/generate_guid_test.js
|
@@ -1,4 +1,4 @@
-import { generateGuid } from '../index';
+import { generateGuid } from '..';
QUnit.module('Ember.generateGuid');
| true |
Other
|
emberjs
|
ember.js
|
cce1f08a9f8b7a0ecca3574d43be98691d761afe.json
|
Rollup more leaf packages
|
packages/ember-utils/tests/guid_for_test.js
|
@@ -1,6 +1,6 @@
import {
guidFor
-} from '../index';
+} from '..';
QUnit.module('guidFor');
| true |
Other
|
emberjs
|
ember.js
|
cce1f08a9f8b7a0ecca3574d43be98691d761afe.json
|
Rollup more leaf packages
|
packages/ember-utils/tests/inspect_test.js
|
@@ -1,4 +1,4 @@
-import { inspect } from '../index';
+import { inspect } from '..';
// Symbol is not defined on pre-ES2015 runtimes, so this let's us safely test
// for it's existence (where a simple `if (Symbol)` would ReferenceError)
| true |
Other
|
emberjs
|
ember.js
|
cce1f08a9f8b7a0ecca3574d43be98691d761afe.json
|
Rollup more leaf packages
|
packages/ember-utils/tests/make_array_test.js
|
@@ -1,4 +1,4 @@
-import makeArray from '../make-array';
+import { makeArray } from '..';
QUnit.module('Ember.makeArray');
| true |
Other
|
emberjs
|
ember.js
|
cce1f08a9f8b7a0ecca3574d43be98691d761afe.json
|
Rollup more leaf packages
|
packages/ember-utils/tests/to-string-test.js
|
@@ -1,4 +1,4 @@
-import { toString } from '../index';
+import { toString } from '..';
QUnit.module('ember-utils toString');
| true |
Other
|
emberjs
|
ember.js
|
cce1f08a9f8b7a0ecca3574d43be98691d761afe.json
|
Rollup more leaf packages
|
packages/ember-utils/tests/try_invoke_test.js
|
@@ -1,4 +1,4 @@
-import { tryInvoke } from '../index';
+import { tryInvoke } from '..';
let obj;
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
.eslintrc.js
|
@@ -1,13 +1,6 @@
var fs = require('fs');
var path = require('path');
-function isEmberJSBuildLinked() {
- var emberjsBuildPath = path.dirname(require.resolve('emberjs-build'));
- var emberjsBuildLinked = emberjsBuildPath.indexOf(__dirname + '/node_modules') === -1;
-
- return emberjsBuildLinked;
-}
-
var options = {
root: true,
parserOptions: {
@@ -51,17 +44,4 @@ var options = {
},
};
-if (isEmberJSBuildLinked()) {
- delete options.plugins;
-
- for (var ruleName in options.rules) {
- var ruleParts = ruleName.split('ember-internal/');
-
- if (ruleParts.length > 1) {
- options.rules[ruleParts[1]] = options.rules[ruleName];
- delete options.rules[ruleName];
- }
- }
-}
-
module.exports = options;
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
bin/run-tests.js
|
@@ -3,7 +3,7 @@
var RSVP = require('rsvp');
var spawn = require('child_process').spawn;
var chalk = require('chalk');
-var getFeatures = require('../ember-cli-build').getFeatures;
+var FEATURES = require('../broccoli/features');
var getPackages = require('../lib/packages');
var runInSequence = require('../lib/run-in-sequence');
@@ -90,7 +90,7 @@ function runInPhantom(url, retries, resolve, reject) {
var testFunctions = [];
function generateEachPackageTests() {
- var features = getFeatures();
+ var features = FEATURES;
var packages = getPackages(features);
Object.keys(packages).forEach(function(packageName) {
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/addon.js
|
@@ -0,0 +1,17 @@
+'use strict';
+/* eslint-env node */
+
+const Funnel = require('broccoli-funnel');
+const semver = require('semver');
+
+module.exports = function addon(name, project) {
+ let addon = project.findAddonByName(name);
+ let tree = addon.treeFor('addon');
+ let options = {};
+
+ if (semver.lt(project.emberCLIVersion(), '2.13.0')) {
+ options.srcDir = 'modules';
+ }
+
+ return new Funnel(tree, options);
+}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/babel-helpers.js
|
@@ -0,0 +1,19 @@
+'use strict';
+/* eslint-env node */
+const Funnel = require('broccoli-funnel');
+
+module.exports = function(env) {
+ let file;
+ if (env === 'debug') {
+ file = 'external-helpers-dev.js';
+ } else if (env === 'prod') {
+ file = 'external-helpers-prod.js'
+ }
+
+ return new Funnel('packages/external-helpers/lib', {
+ files: [file],
+ getDestinationPath() {
+ return 'ember-babel.js';
+ }
+ });
+}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/bootstrap-modules.js
|
@@ -0,0 +1,26 @@
+'use strict';
+/* eslint-env node */
+
+const WriteFile = require('broccoli-file-creator');
+
+function defaultExport(moduleExport) {
+ return `(function (m) { if (typeof module === "object" && module.exports) { module.exports = m } }(requireModule('${moduleExport}').default));\n`
+}
+
+function sideeffects(moduleExport) {
+ return `requireModule('${moduleExport}')`
+}
+
+function umd(moduleExport) {
+ return `(function (m) { if (typeof module === "object" && module.exports) { module.exports = m } }(requireModule('${moduleExport}')));\n`
+}
+
+module.exports = function bootstrapModule(moduleExport, type = 'sideeffects') {
+ let moduleType = {
+ default: defaultExport,
+ umd,
+ sideeffects
+ }
+
+ return new WriteFile('bootstrap', moduleType[type](moduleExport));
+}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/concat-bundle.js
|
@@ -0,0 +1,28 @@
+'use strict';
+/* eslint-env node */
+
+const concat = require('broccoli-concat');
+
+module.exports = function(tree, options) {
+ let { outputFile, hasBootstrap } = options;
+
+ if (typeof hasBootstrap !== 'boolean') {
+ hasBootstrap = true;
+ }
+
+ let footerFiles = [];
+
+ if (hasBootstrap) {
+ footerFiles = ['bootstrap']
+ }
+
+ return concat(tree, {
+ header: '(function() {',
+ outputFile: outputFile,
+ headerFiles: ['license.js', 'loader.js'],
+ footerFiles: footerFiles,
+ inputFiles: ['**/*'],
+ annotation: outputFile,
+ footer: '}());'
+ });
+}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/features.js
|
@@ -0,0 +1,39 @@
+'use strict';
+/* eslint-env node */
+
+function getFeatures(isDebug) {
+ let features = Object.assign({}, require('../features').features);
+ let featureName;
+
+ if (process.env.BUILD_TYPE === 'alpha') {
+ for (featureName in features) {
+ if (features[featureName] === null) {
+ features[featureName] = false;
+ }
+ }
+ }
+
+ if (process.env.OVERRIDE_FEATURES) {
+ var forcedFeatures = process.env.OVERRIDE_FEATURES.split(',');
+ for (var i = 0; i < forcedFeatures.length; i++) {
+ featureName = forcedFeatures[i];
+
+ features[featureName] = true;
+ }
+ }
+
+ features['ember-glimmer-allow-backtracking-rerender'] = false;
+
+ if (process.env.ALLOW_BACKTRACKING) {
+ features['ember-glimmer-allow-backtracking-rerender'] = true;
+ features['ember-glimmer-detect-backtracking-rerender'] = false;
+ }
+
+ features['mandatory-setter'] = isDebug;
+ features['ember-glimmer-detect-backtracking-rerender'] = isDebug;
+
+ return features;
+}
+
+module.exports.RELEASE = getFeatures(false);
+module.exports.DEBUG = getFeatures(true);
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/find-lib.js
|
@@ -0,0 +1,19 @@
+/* eslint-env node */
+"use strict";
+
+const path = require('path');
+
+module.exports = function findLib(name, libPath) {
+ let packagePath = path.join(name, 'package');
+ let packageRoot = path.dirname(require.resolve(packagePath));
+
+ libPath = libPath || getLibPath(packagePath);
+
+ return path.resolve(packageRoot, libPath);
+};
+
+function getLibPath(packagePath) {
+ let packageJson = require(packagePath);
+
+ return path.dirname(packageJson['module'] || packageJson['main']);
+}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/funnel-lib.js
|
@@ -0,0 +1,19 @@
+/* eslint-env node */
+"use strict";
+
+const Funnel = require('broccoli-funnel');
+const findLib = require('./find-lib');
+
+module.exports = function funnelLib(name) {
+
+ let libPath, options;
+ if (arguments.length > 2) {
+ libPath = arguments[1];
+ options = arguments[2];
+ } else {
+ options = arguments[1];
+ }
+
+
+ return new Funnel(findLib(name, libPath), options);
+}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/glimmer-template-compiler.js
|
@@ -0,0 +1,38 @@
+/* eslint-env node */
+'use strict';
+
+const Filter = require('broccoli-persistent-filter');
+const { stripIndent } = require('common-tags');
+
+GlimmerTemplatePrecompiler.prototype = Object.create(Filter.prototype);
+
+function GlimmerTemplatePrecompiler (inputTree, options) {
+ if (!(this instanceof GlimmerTemplatePrecompiler)) {
+ return new GlimmerTemplatePrecompiler(inputTree, options);
+ }
+
+ Filter.call(this, inputTree, {});
+
+ this.inputTree = inputTree;
+ if (!options.glimmer) {
+ throw new Error('No glimmer option provided!');
+ }
+ this.precompile = options.glimmer.precompile;
+}
+
+GlimmerTemplatePrecompiler.prototype.extensions = ['hbs'];
+GlimmerTemplatePrecompiler.prototype.targetExtension = 'js';
+
+GlimmerTemplatePrecompiler.prototype.baseDir = function() {
+ return __dirname;
+};
+
+GlimmerTemplatePrecompiler.prototype.processString = function(content, relativePath) {
+ var compiled = this.precompile(content, { meta: { moduleName: relativePath } });
+ return stripIndent`
+ import template from '../template';
+ export default template(${compiled});
+ `;
+};
+
+module.exports = GlimmerTemplatePrecompiler;
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/lint.js
|
@@ -0,0 +1,7 @@
+const ESLint = require('broccoli-lint-eslint');
+
+module.exports = function _lint(tree) {
+ return new ESLint(tree, {
+ testGenerator: 'qunit'
+ });
+}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/minify.js
|
@@ -0,0 +1,34 @@
+const Funnel = require('broccoli-funnel');
+const Uglify = require('broccoli-uglify-js');
+const path = require('path');
+
+module.exports = function _minify(tree, name) {
+ let minified = new Uglify(tree, {
+ sourceMapConfig: {
+ enable: false
+ },
+ mangle: true,
+ compress: {
+ // this is adversely affects heuristics for IIFE eval
+ negate_iife: false,
+ // limit sequences because of memory issues during parsing
+ sequences: 30
+ },
+ output: {
+ // no difference in size
+ // and much easier to debug
+ semicolons: false
+ }
+ });
+
+ return new Funnel(minified, {
+ getDestinationPath(relativePath) {
+ let ext = path.extname(relativePath);
+ if (ext === '.map') {
+ return `${name}.map`
+ }
+ return `${name}.js`;
+ },
+ annotation: name
+ });
+}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/packages.js
|
@@ -0,0 +1,276 @@
+'use strict';
+/* eslint-env node */
+const { readFileSync } = require('fs');
+const path = require('path');
+const Rollup = require('broccoli-rollup');
+const Funnel = require('broccoli-funnel');
+const findLib = require('./find-lib');
+const funnelLib = require('./funnel-lib');
+const { VERSION } = require('./version');
+const WriteFile = require('broccoli-file-creator');
+const StringReplace = require('broccoli-string-replace');
+const { RELEASE, DEBUG } = require('./features');
+const GlimmerTemplatePrecompiler = require('./glimmer-template-compiler');
+const VERSION_PLACEHOLDER = /VERSION_STRING_PLACEHOLDER/g;
+
+module.exports.routerES = function _routerES() {
+ return new Rollup(findLib('router_js', 'lib'), {
+ rollup: {
+ external: ['route-recognizer', 'rsvp'],
+ entry: 'router.js',
+ plugins: [{
+ transform(code, id) {
+ if (/[^t][^e][^r]\/router\.js$/.test(id)) {
+ code += 'export { Transition } from \'./router/transition\';\n'
+ } else if (/\/router\/handler-info\/[^\/]+\.js$/.test(id)) {
+ code = code.replace(/\'router\//g, '\'../');
+ }
+ code = code.replace(/import\ Promise\ from \'rsvp\/promise\'/g, 'import { Promise } from \'rsvp\'')
+ return {
+ code: code,
+ map: { mappings: '' }
+ };
+ }
+ }],
+ targets: [{
+ dest: 'router.js',
+ format: 'es'
+ }]
+ },
+ annotation: 'router.js'
+ });
+}
+
+
+module.exports.jquery = function _jquery() {
+ return new Funnel(findLib('jquery'), {
+ files: ['jquery.js'],
+ destDir: 'jquery',
+ annotation: 'jquery'
+ });
+}
+
+module.exports.internalLoader = function _internalLoader() {
+ return new Funnel('packages/loader/lib', {
+ files: ['index.js'],
+ getDestinationPath() {
+ return 'loader.js';
+ },
+ annotation: 'internal loader'
+ });
+}
+
+module.exports.qunit = function _qunit() {
+ return new Funnel(findLib('qunitjs'), {
+ files: ['qunit.js', 'qunit.css'],
+ destDir: 'qunit',
+ annotation: 'qunit'
+ });
+}
+
+module.exports.glimmerDependencyInjectionES = function _glimmerDependencyInjectionES() {
+ return new Rollup(findLib('@glimmer/di', 'dist/modules/es2017'), {
+ rollup: {
+ entry: 'index.js',
+ dest: '@glimmer/di.js',
+ external: ['@glimmer/util'],
+ format: 'es',
+ exports: 'named'
+ }
+ });
+}
+
+module.exports.emberGlimmerES = function _emberGlimmerES() {
+ let pkg = new Funnel('packages/ember-glimmer/lib', {
+ include: ['**/*.js', '**/*.hbs'],
+ destDir: 'ember-glimmer'
+ });
+
+ return new GlimmerTemplatePrecompiler(pkg, {
+ persist: true,
+ glimmer: require('@glimmer/compiler'),
+ annotation: 'ember-glimmer es'
+ });
+}
+
+module.exports.handlebarsES = function _handlebars() {
+ return new Rollup(findLib('handlebars', 'lib'), {
+ rollup: {
+ entry: 'handlebars/compiler/base.js',
+ dest: 'handlebars.js',
+ format: 'es',
+ exports: 'named',
+ plugins: [handlebarsFix()]
+ },
+ annotation: 'handlebars'
+ })
+}
+
+function handlebarsFix() {
+ var HANDLEBARS_PARSER = /\/parser.js$/;
+ return {
+ load: function(id) {
+ if (HANDLEBARS_PARSER.test(id)) {
+ var code = readFileSync(id, 'utf8');
+ return {
+ code: code
+ .replace('exports.__esModule = true;', '')
+ .replace('exports[\'default\'] = handlebars;', 'export default handlebars;'),
+
+ map: { mappings: null }
+ };
+ }
+ }
+ }
+}
+
+module.exports.rsvpES = function _rsvpES() {
+ let lib = path.resolve(path.dirname(require.resolve('rsvp')), '../lib');
+ return new Rollup(lib, {
+ rollup: {
+ entry: 'rsvp.js',
+ dest: 'rsvp.js',
+ format: 'es',
+ exports: 'named'
+ },
+ annotation: 'rsvp.js'
+ });
+}
+
+module.exports.backburnerES = function _backburnerES() {
+ return funnelLib('backburner.js', 'dist/es6', {
+ files: ['backburner.js'],
+ annotation: 'backburner es'
+ });
+}
+
+module.exports.dagES = function _dagES() {
+ return funnelLib('dag-map', {
+ files: ['dag-map.js'],
+ annotation: 'dag-map es'
+ });
+}
+
+module.exports.routeRecognizerES = function _routeRecognizerES() {
+ return funnelLib('route-recognizer', {
+ files: ['route-recognizer.es.js'],
+ getDestinationPath() {
+ return 'route-recognizer.js'
+ },
+ annotation: 'route-recognizer es'
+ });
+}
+
+
+module.exports.simpleHTMLTokenizerES = function _simpleHTMLTokenizerES() {
+ return new Rollup(findLib('simple-html-tokenizer', 'dist/es6'), {
+ rollup: {
+ entry: 'index.js',
+ dest: 'simple-html-tokenizer.js',
+ format: 'es',
+ exports: 'named'
+ },
+ annotation: 'simple-html-tokenizer es'
+ })
+}
+
+module.exports.emberPkgES = function _emberPkgES(name, rollup, externs) {
+ if (rollup) {
+ return new Rollup(`packages/${name}/lib`, {
+ rollup: {
+ entry: 'index.js',
+ dest: `${name}.js`,
+ external: externs,
+ format: 'es',
+ exports: 'named'
+ }
+ });
+ }
+
+ return new Funnel(`packages/${name}/lib`, {
+ exclude: ['.gitkeep'],
+ destDir: name,
+ annotation: `${name} es`
+ });
+}
+
+module.exports.glimmerPkgES = function _glimmerPkgES(name, externs = []) {
+ return new Rollup(findLib(name, 'dist/modules'), {
+ rollup: {
+ entry: 'index.js',
+ dest: `${name}.js`,
+ external: externs,
+ format: 'es',
+ exports: 'named'
+ },
+ annotation: `${name} es`
+ });
+}
+
+module.exports.emberTestsES = function _emberTestES(name) {
+ return new Funnel(`packages/${name}/tests`, {
+ exclude: ['.gitkeep'],
+ destDir: `${name}/tests`,
+ annotation: `${name} tests es`
+ });
+}
+
+module.exports.nodeModuleUtils = function _nodeModuleUtils() {
+ return new Funnel('packages/node-module/lib', {
+ files: ['index.js']
+ });
+}
+
+module.exports.emberVersionES = function _emberVersionES() {
+ let content = 'export default ' + JSON.stringify(VERSION) + ';\n';
+ return new WriteFile('ember/version.js', content, {
+ annotation: 'ember/version'
+ });
+}
+
+module.exports.emberLicense = function _emberLicense() {
+ let license = new Funnel('generators', {
+ files: ['license.js'],
+ annotation: 'license'
+ });
+
+ return new StringReplace(license, {
+ files: ['license.js'],
+ patterns: [{
+ match: VERSION_PLACEHOLDER,
+ replacement: VERSION
+ }],
+ annotation: 'license'
+ });
+}
+
+module.exports.emberFeaturesES = function _emberFeaturesES(production = false) {
+ let content = 'export default ' + JSON.stringify(production ? RELEASE : DEBUG) + ';\n';
+ return new WriteFile('ember/features.js', content, {
+ annotation: `ember/features ${production ? 'production' : 'debug' }`
+ });
+}
+
+module.exports.packageManagerJSONs = function _packageManagerJSONs() {
+ var packageJsons = new Funnel('config/package_manager_files', {
+ include: ['*.json'],
+ destDir: '/',
+ annotation: 'package.json'
+ });
+
+ packageJsons = new StringReplace(packageJsons, {
+ patterns: [{
+ match: VERSION_PLACEHOLDER,
+ replacement: VERSION
+ }],
+ files: ['*.json']
+ });
+ packageJsons._annotation = 'package.json VERSION';
+ return packageJsons;
+}
+
+module.exports.nodeTests = function _nodeTests() {
+ return new Funnel('tests', {
+ include: ['**/*/*.js']
+ });
+}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/test-index-html.js
|
@@ -0,0 +1,25 @@
+'use strict';
+/* eslint-env node */
+const Funnel = require('broccoli-funnel');
+const StringReplace = require('broccoli-string-replace');
+const FEATURES = require('./features');
+
+module.exports = function testIndexHTML() {
+ let index = new Funnel('tests', {
+ files: ['index.html'],
+ destDir: 'tests',
+ annotation: 'tests/index.html'
+ });
+ index = new StringReplace(index, {
+ files: ['tests/index.html'],
+ patterns: [{
+ match: /\{\{DEV_FEATURES\}\}/g,
+ replacement: JSON.stringify(FEATURES.DEBUG)
+ }, {
+ match: /\{\{PROD_FEATURES\}\}/g,
+ replacement: JSON.stringify(FEATURES.RELEASE)
+ }],
+ });
+ index._annotation = 'tests/index.html FEATURES';
+ return index;
+}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/to-amd.js
|
@@ -0,0 +1,30 @@
+'use strict';
+/* eslint-env node */
+
+const resolveModuleSource = require('amd-name-resolver').moduleResolve;
+const Babel = require('broccoli-babel-transpiler');
+const enifed = require('./transforms/transform-define');
+const stripClassCallCheck = require('./transforms/strip-class-call-check');
+const injectNodeGlobals = require('./transforms/inject-node-globals');
+
+module.exports = function toAmd(tree, _options) {
+ let options = Object.assign({
+ environment: 'development'
+ }, _options);
+ options.moduleIds = true;
+ options.resolveModuleSource = resolveModuleSource;
+ options.sourceMap = 'inline';
+ options.plugins = [
+ injectNodeGlobals,
+ ['transform-es2015-modules-amd', { noInterop: true, strict: true }],
+ enifed
+ ];
+
+ if (options.environment === 'production') {
+ options.plugins.unshift([stripClassCallCheck, { source: 'ember-babel' }]);
+ }
+
+ delete options.environment;
+
+ return new Babel(tree, options);
+}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/to-es5.js
|
@@ -0,0 +1,51 @@
+'use strict';
+/* eslint-env node */
+
+const Babel = require('broccoli-babel-transpiler');
+const injectBabelHelpers = require('./transforms/inject-babel-helpers');
+const { RELEASE, DEBUG } = require('./features');
+
+module.exports = function toES5(tree, _options) {
+ let options = Object.assign({
+ environment: 'developement'
+ }, _options);
+ options.plugins = [
+ injectBabelHelpers,
+ ['feature-flags', {
+ import: {
+ name: 'isFeatureEnabled',
+ module: 'ember-debug'
+ },
+ features: options.environment === 'production' ? RELEASE : DEBUG
+ }],
+ ['transform-es2015-template-literals', {loose: true}],
+ ['transform-es2015-arrow-functions'],
+ ['transform-es2015-destructuring', {loose: true}],
+ ['transform-es2015-spread', {loose: true}],
+ ['transform-es2015-parameters'],
+ ['transform-es2015-computed-properties', {loose: true}],
+ ['transform-es2015-shorthand-properties'],
+ ['transform-es2015-block-scoping'],
+ ['check-es2015-constants'],
+ ['transform-es2015-classes', {loose: true}],
+ ['transform-proto-to-assign'],
+ ];
+
+ if (options.inlineHelpers) {
+ options.plugins.shift();
+ delete options.inlineHelpers;
+ }
+
+ if (options.environment === 'production') {
+ options.plugins.push([
+ 'filter-imports', {
+ 'ember-debug/deprecate': ['deprecate'],
+ 'ember-debug': ['assert', 'debug', 'deprecate', 'info', 'runInDebug', 'warn', 'debugSeal', 'debugFreeze']
+ }
+ ]);
+ }
+
+ delete options.environment;
+
+ return new Babel(tree, options);
+}
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/transforms/inject-babel-helpers.js
|
@@ -0,0 +1,19 @@
+'use strict';
+/* eslint-env node */
+
+function injectBabelHelpers(babel) {
+ let { types: t } = babel;
+ return {
+ pre(file) {
+ file.set('helperGenerator', function (name) {
+ return file.addImport('ember-babel', name, name);
+ });
+ }
+ };
+}
+
+injectBabelHelpers.baseDir = function() {
+ return 'babel-core';
+}
+
+module.exports = injectBabelHelpers;
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/transforms/inject-node-globals.js
|
@@ -0,0 +1,52 @@
+function injectNodeGlobals({ types: t }) {
+ let requireId;
+ let importDecl;
+ let moduleId;
+ return {
+ name: 'inject require',
+ visitor: {
+ Program: {
+ enter(path, state) {
+ requireId = path.scope.globals.require;
+ moduleId = path.scope.globals.module;
+
+ if (requireId || moduleId) {
+
+ let specifiers = [];
+ let source = t.stringLiteral(this.file.resolveModuleSource('node-module'));
+
+ if (requireId) {
+ delete path.scope.globals.require;
+ specifiers.push(t.importSpecifier(requireId, t.identifier('require')));
+ }
+
+ if (moduleId) {
+ delete path.scope.globals.module;
+ specifiers.push(t.importSpecifier(moduleId, t.identifier('module')));
+ }
+
+ importDecl = t.importDeclaration(specifiers, source);
+ path.unshiftContainer('body', importDecl);
+ }
+
+ },
+ exit(path, state) {
+ if (requireId) {
+ path.scope.rename("require");
+ }
+ }
+ },
+ ImportDeclaration(path) {
+ if (path.node === importDecl) {
+ path.scope.registerDeclaration(path);
+ }
+ }
+ }
+ }
+}
+
+injectNodeGlobals.baseDir = function() {
+ return 'babel-plugin-transform-es2015-modules-amd';
+}
+
+module.exports = injectNodeGlobals;
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/transforms/strip-class-call-check.js
|
@@ -0,0 +1,66 @@
+// TODO there are like 3 things that do this
+
+function stripClassCallCheck() {
+ let _specifier;
+ let decl;
+ return {
+ name: 'remove classCallCheck',
+ visitor: {
+ Program: {
+ enter(path, state) {
+ let { source } = state.opts;
+ let body = path.get('body');
+ for (const part of body) {
+ if (part.isImportDeclaration() && part.node.source.value === 'ember-babel') {
+ let specifiers = part.get('specifiers');
+
+ for (const specifier of specifiers) {
+ if (specifier.node.imported.name === 'classCallCheck') {
+ _specifier = specifier;
+ decl = part;
+ break;
+ }
+ }
+ }
+ }
+ },
+ exit(path) {
+ if (!_specifier) {
+ return;
+ }
+
+ _specifier.remove();
+
+ let specifiers = decl.get('specifiers');
+
+ if (specifiers.length === 0) {
+ decl.remove()
+ }
+
+ _specifier = null;
+ decl = null;
+ }
+ },
+ CallExpression(path) {
+ if (!_specifier) {
+ return;
+ }
+
+ if (_specifier.node === null) {
+ console.log(_specifier);
+ }
+
+ if (_specifier && path.node.callee.name === _specifier.node.local.name) {
+ path.remove();
+ }
+ }
+ }
+ }
+}
+
+
+stripClassCallCheck.baseDir = function() {
+ return 'babel-core';
+}
+
+module.exports = stripClassCallCheck;
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/transforms/transform-define.js
|
@@ -0,0 +1,30 @@
+'use strict';
+/* eslint-env node */
+
+function transformDefine(babel) {
+ let { types: t } = babel;
+ return {
+ name: 'transform define',
+ visitor: {
+ Program: {
+ exit(path) {
+ let [expressionStatement] = path.node.body;
+
+ if (
+ t.isExpressionStatement(expressionStatement) &&
+ t.isCallExpression(expressionStatement.expression) &&
+ expressionStatement.expression.callee.name === 'define'
+ ) {
+ expressionStatement.expression.callee.name = 'enifed';
+ }
+ }
+ }
+ }
+ }
+}
+
+transformDefine.baseDir = function() {
+ return 'babel-plugin-transform-es2015-modules-amd';
+}
+
+module.exports = transformDefine;
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
broccoli/version.js
|
@@ -0,0 +1,19 @@
+'use strict';
+/* eslint-env node */
+
+const getGitInfo = require('git-repo-info');
+const path = require('path');
+
+module.exports.VERSION = (() => {
+ let info = getGitInfo(path.resolve(__dirname, '..'));
+ if (info.tag) {
+ console.log('herr');
+ return info.tag.replace(/^v/, '');
+ }
+
+ let packageVersion = require('../package.json').version;
+ let sha = info.sha || '';
+ let prefix = `${packageVersion}-${(process.env.BUILD_TYPE || info.branch)}`;
+
+ return `${prefix}+${sha.slice(0, 8)}`;
+})();
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
ember-cli-build.js
|
@@ -6,428 +6,399 @@
//
// DISABLE_ES3=true DISABLE_JSCS=true DISABLE_JSHINT=true DISABLE_MIN=true DISABLE_DEREQUIRE=true ember serve --environment=production
-var fs = require('fs');
-var path = require('path');
-
-var EmberBuild = require('emberjs-build');
-var getPackages = require('./lib/packages');
-var getGitInfo = require('git-repo-info');
-
-var applyFeatureFlags = require('babel-plugin-feature-flags');
-var filterImports = require('babel-plugin-filter-imports');
-
-var vendoredPackage = require('emberjs-build/lib/vendored-package');
-var htmlbarsPackage = require('emberjs-build/lib/htmlbars-package');
-var replaceVersion = require('emberjs-build/lib/utils/replace-version');
-
-var Funnel = require('broccoli-funnel');
-var Rollup = require('broccoli-rollup');
-var mergeTrees = require('broccoli-merge-trees');
-var replace = require('broccoli-string-replace');
-var uglify = require('broccoli-uglify-sourcemap');
-
-var rollupEnifed = {
- transformBundle(code, options) {
- return {
- code: code.replace(/\bdefine\(/, 'enifed('),
- map: { mappings: null }
- };
- }
-};
+const MergeTrees = require('broccoli-merge-trees');
+const babelHelpers = require('./broccoli/babel-helpers');
+const bootstrapModule = require('./broccoli/bootstrap-modules');
+const addon = require('./broccoli/addon');
+const concat = require('./broccoli/concat-bundle');
+const testIndexHTML = require('./broccoli/test-index-html');
+const toAMD = require('./broccoli/to-amd');
+const toES5 = require('./broccoli/to-es5');
+const minify = require('./broccoli/minify');
+const lint = require('./broccoli/lint');
+const {
+ routerES,
+ jquery,
+ internalLoader,
+ qunit,
+ glimmerDependencyInjectionES,
+ emberGlimmerES,
+ handlebarsES,
+ rsvpES,
+ simpleHTMLTokenizerES,
+ backburnerES,
+ dagES,
+ routeRecognizerES,
+ emberPkgES,
+ glimmerPkgES,
+ emberTestsES,
+ nodeModuleUtils,
+ emberVersionES,
+ emberLicense,
+ emberFeaturesES,
+ packageManagerJSONs,
+ nodeTests
+} = require('./broccoli/packages');
+const SHOULD_ROLLUP = true;
-function dag() {
- var es = new Funnel(path.dirname(require.resolve('dag-map')), {
- files: ['dag-map.js'],
- annotation: 'dag-map.js'
+module.exports = function(options) {
+ let tokenizer = simpleHTMLTokenizerES();
+ let container = emberPkgES('container');
+ let emberMetal = emberPkgES('ember-metal', SHOULD_ROLLUP, ['ember-debug', 'ember-environment', 'ember-utils', '@glimmer/reference', 'require', 'backburner', 'ember-console']);
+ let emberEnvironment = emberPkgES('ember-environment');
+ let emberConsole = emberPkgES('ember-console');
+ let emberMain = emberPkgES('ember');
+ let emberViews = emberPkgES('ember-views');
+ let emberApplication = emberPkgES('ember-application');
+ let emberRuntime = emberPkgES('ember-runtime');
+ let emberExtensionSupport = emberPkgES('ember-extension-support');
+ let emberRouting = emberPkgES('ember-routing');
+ let emberGlimmer = emberGlimmerES();
+ let internalTestHelpers = emberPkgES('internal-test-helpers');
+ let emberUtils = emberPkgES('ember-utils');
+ let emberTemplateCompiler = emberPkgES('ember-template-compiler');
+ let backburner = backburnerES();
+ let glimmerWireFormat = glimmerPkgES('@glimmer/wire-format', ['@glimmer/util']);
+ let glimmerSyntax = glimmerPkgES('@glimmer/syntax', ['handlebars', 'simple-html-tokenizer']);
+ let glimmerUtil = glimmerPkgES('@glimmer/util');
+ let glimmerCompiler = glimmerPkgES('@glimmer/compiler', ['@glimmer/util', '@glimmer/wire-format', '@glimmer/syntax']);
+ let glimmerReference = glimmerPkgES('@glimmer/reference', ['@glimmer/util']);
+ let glimmerRuntime = glimmerPkgES('@glimmer/runtime', ['@glimmer/util', '@glimmer/reference', '@glimmer/wire-format']);
+ let containerTests = emberTestsES('container');
+ let emberMainTests = emberTestsES('ember');
+ let emberMetalTests = emberTestsES('ember-metal');
+ let emberTemplateCompilerTests = emberTestsES('ember-template-compiler');
+ let emberGlimmerTests = emberTestsES('ember-glimmer');
+ let emberApplicationTests = emberTestsES('ember-application');
+ let emberDebugTests = emberTestsES('ember-debug');
+ let emberRuntimeTests = emberTestsES('ember-runtime');
+ let emberExtensionSupportTests = emberTestsES('ember-extension-support');
+ let emberRoutingTests = emberTestsES('ember-routing');
+ let emberUtilsTests = emberTestsES('ember-utils');
+ let emberTestingTests = emberTestsES('ember-testing');
+ let internalTestHelpersTests = emberTestsES('internal-test-helpers');
+ let emberDebug = emberPkgES('ember-debug');
+ let emberTesting = emberPkgES('ember-testing');
+ let inlineParser = handlebarsES();
+ let loader = internalLoader();
+ let rsvp = rsvpES();
+ let license = emberLicense();
+ let nodeModule = nodeModuleUtils();
+ let ENV = process.env.EMBER_ENV || 'development';
+ let debugFeatures = emberFeaturesES();
+ let productionFeatures = emberFeaturesES(true);
+ let version = emberVersionES();
+
+ let emberBaseESNext = [
+ glimmerWireFormat,
+ glimmerUtil,
+ glimmerReference,
+ glimmerRuntime,
+ container,
+ emberConsole,
+ emberViews,
+ emberDebug,
+ emberMetal,
+ emberEnvironment,
+ emberMain,
+ emberApplication,
+ emberRuntime,
+ emberExtensionSupport,
+ emberRouting,
+ emberUtils,
+ emberGlimmer,
+ rsvp,
+ backburner,
+ version,
+ dagES(),
+ routerES(),
+ routeRecognizerES(),
+ glimmerDependencyInjectionES(),
+ glimmerPkgES('@glimmer/node', ['@glimmer/runtime']),
+ bootstrapModule('ember')
+ ];
+
+ let emberTemplateCompilerESNext = [
+ container,
+ emberEnvironment,
+ emberConsole,
+ emberTemplateCompiler,
+ emberUtils,
+ emberDebug,
+ debugFeatures,
+ emberMetal,
+ version,
+ tokenizer,
+ inlineParser,
+ glimmerRuntime,
+ backburner,
+ glimmerWireFormat,
+ glimmerSyntax,
+ glimmerUtil,
+ glimmerCompiler,
+ glimmerReference
+ ];
+
+ let emberDebugESNext = [
+ ...emberBaseESNext,
+ debugFeatures,
+ emberTemplateCompiler,
+ emberTesting,
+ inlineParser
+ ];
+
+ let tests = [
+ internalTestHelpers,
+ containerTests,
+ emberMainTests,
+ emberMetalTests,
+ emberTemplateCompilerTests,
+ emberGlimmerTests,
+ emberApplicationTests,
+ emberDebugTests,
+ emberRuntimeTests,
+ emberExtensionSupportTests,
+ emberRoutingTests,
+ emberUtilsTests,
+ emberTestingTests,
+ internalTestHelpersTests
+ ];
+
+ let emberTestsESNext = [
+ ...tests,
+ ...tests.map(lint),
+ addon('ember-dev', options.project)
+ ];
+
+ let emberTestingESNext = [
+ emberTesting,
+ emberDebug
+ ];
+
+ let testHarness = [
+ testIndexHTML(),
+ jquery(),
+ qunit()
+ ];
+
+ let emberProdTestsESNext = [...emberTestsESNext];
+
+ emberTestingESNext.push(babelHelpers('debug'));
+ emberDebugESNext.push(babelHelpers('debug'));
+
+ // ESNext
+ emberDebugESNext = new MergeTrees(emberDebugESNext, {
+ annotation: 'ember.debug es next'
});
- return new Rollup(es, {
- rollup: {
- plugins: [rollupEnifed],
- entry: 'dag-map.js',
- dest: 'dag-map.js',
- format: 'amd',
- moduleId: 'dag-map',
- exports: 'named'
- },
- annotation: 'dag-map.js'
+
+ emberTemplateCompilerESNext = new MergeTrees(emberTemplateCompilerESNext, {
+ annotation: 'ember-template-compiler es next'
});
-}
-
-function backburner() {
- var dist = path.dirname(require.resolve('backburner.js'));
- dist = path.join(dist, 'es6');
- return new Rollup(new Funnel(dist, {
- files: ['backburner.js']
- }), {
- rollup: {
- plugins: [rollupEnifed],
- entry: 'backburner.js',
- dest: 'backburner.js',
- format: 'amd',
- moduleId: 'backburner',
- exports: 'named'
- },
- annotation: 'backburner.js'
+
+ emberTestsESNext = new MergeTrees(emberTestsESNext, {
+ annotation: 'ember-tests es next'
});
-}
-
-function rsvp() {
- var transpileES6 = require('emberjs-build/lib/utils/transpile-es6');
- var lib = path.resolve(path.dirname(require.resolve('rsvp')), '../lib');
- var rollup = new Rollup(lib, {
- rollup: {
- entry: 'rsvp.js',
- dest: 'rsvp.js',
- format: 'es',
- exports: 'named'
- },
- annotation: 'rsvp.js'
+
+ emberTestingESNext = new MergeTrees(emberTestingESNext, {
+ annotation: 'ember-testing es next'
});
- return transpileES6(rollup);
-}
-
-function routeRecognizer() {
- var packageJson = require('route-recognizer/package');
- var packageDir = path.dirname(require.resolve('route-recognizer/package'));
- var entry = path.join(packageDir, packageJson['module'] || packageJson['jsnext:main'] || packageJson['main'].replace(/dist\//, 'dist/es6/'));
- var basename = path.basename(entry);
- var es6 = new Funnel(path.dirname(entry), {
- files: [ basename ]
+
+ // ES5
+
+ let emberDebugES5 = toES5(emberDebugESNext, {
+ annotation: 'ember.debug es5'
});
- return new Rollup(es6, {
- rollup: {
- plugins: [rollupEnifed],
- entry: basename,
- dest: 'route-recognizer.js',
- format: 'amd',
- moduleId: 'route-recognizer',
- exports: 'named'
- },
- annotation: 'route-recognizer.js'
+
+ let emberTemplateCompilerES5 = toES5(emberTemplateCompilerESNext, {
+ inlineHelpers: true,
+ annotation: 'ember-template-compiler es5'
});
-}
-function buildPackage(name, options) {
- options = options ? options : {};
- var packageJson = require(name + '/package');
- var packageDir = path.dirname(require.resolve(name + '/package'));
+ let emberTestsES5 = toES5(emberTestsESNext, {
+ annotation: 'ember-tests es5'
+ });
- if (options.entry && !options.srcDir) {
- throw new Error('If resolving from a non-package.json entry point, you must supply the srcDirectory.');
- }
+ let emberTestingES5 = toES5(emberTestingESNext, {
+ annotation: 'ember-testing es5'
+ });
- var entryModule = packageJson['module'] || packageJson['jsnext:main'] || packageJson['main'].replace(/dist\//, 'dist/es6/');
- var funnelDir = path.join(packageDir, options.entry ? options.srcDir : path.dirname(entryModule));
- var sourceEntry = options.entry ? options.entry : path.basename(entryModule);
+ // AMD
- var es6 = new Funnel(funnelDir, {
- include: ['**/*.js' ]
+ let emberDebugAMD = toAMD(emberDebugES5, {
+ annotation: 'ember.debug amd'
});
- var moduleId = options.moduleId ? options.moduleId : name;
- var destination = options.dest ? options.dest + '.js': moduleId + '.js';
- var external = options.external ? options.external : [];
- var plugins = options.plugins ? options.plugins : [];
- var rolledUp = new Rollup(es6, {
- rollup: {
- external: external,
- entry: sourceEntry,
- dest: destination,
- plugins: plugins,
- format: 'es',
- moduleId: moduleId,
- exports: 'named'
- },
- annotation: destination
+
+ let emberTemplateCompilerAMD = toAMD(emberTemplateCompilerES5, {
+ annotation: 'ember-template-compiler amd'
});
- var transpileES6 = require('emberjs-build/lib/utils/transpile-es6');
+ let emberTestsAMD = toAMD(emberTestsES5, {
+ annotation: 'ember-tests amd'
+ });
- return transpileES6(rolledUp, name, {
- stripRuntimeChecks: true
+ let emberTestingAMD = toAMD(emberTestingES5, {
+ annotation: 'ember-testing amd'
});
-}
-
-function router() {
- return new Rollup(path.resolve(path.dirname(require.resolve('router_js')), '../lib'), {
- rollup: {
- plugins: [rollupEnifed],
- external: ['route-recognizer', 'rsvp'],
- entry: 'router.js',
- dest: 'router.js',
- format: 'amd',
- moduleId: 'router',
- exports: 'named'
- },
- annotation: 'router.js'
+
+ // Bundling
+
+ let emberDebugBundle = new MergeTrees([
+ license,
+ loader,
+ emberDebugAMD,
+ nodeModule
+ ]);
+
+ let emberTemplateCompilerBundle = new MergeTrees([
+ license,
+ loader,
+ emberTemplateCompilerAMD,
+ nodeModule,
+ bootstrapModule('ember-template-compiler', 'umd')
+ ]);
+
+ let emberTestingBundle = new MergeTrees([
+ license,
+ loader,
+ emberTestingAMD,
+ nodeModule,
+ bootstrapModule('ember-testing')
+ ]);
+
+ let emberTestsBundle = new MergeTrees([
+ license,
+ loader,
+ emberTestsAMD,
+ nodeModule
+ ]);
+
+ emberDebugBundle = concat(emberDebugBundle, {
+ outputFile: 'ember.debug.js'
});
-}
-var featuresJson = fs.readFileSync('./features.json', { encoding: 'utf8' });
+ emberTemplateCompilerBundle = concat(emberTemplateCompilerBundle, {
+ outputFile: 'ember-template-compiler.js'
+ });
-function getFeatures(environment) {
- var features = JSON.parse(featuresJson).features;
- var featureName;
+ emberTestsBundle = concat(emberTestsBundle, {
+ outputFile: 'ember-tests.js',
+ hasBootstrap: false
+ });
- if (process.env.BUILD_TYPE === 'alpha') {
- for (featureName in features) {
- if (features[featureName] === null) {
- features[featureName] = false;
- }
- }
- }
+ emberTestingBundle = concat(emberTestingBundle, {
+ outputFile: 'ember-testing.js'
+ });
- if (process.env.OVERRIDE_FEATURES) {
- var forcedFeatures = process.env.OVERRIDE_FEATURES.split(',');
- for (var i = 0; i < forcedFeatures.length; i++) {
- featureName = forcedFeatures[i];
+ let prodDist = [];
- features[featureName] = true;
- }
- }
+ if (ENV === 'production') {
+ let emberRuntimeESNext = [
+ rsvp,
+ container,
+ emberEnvironment,
+ emberConsole,
+ emberMetal,
+ babelHelpers('debug')
+ ];
- features['ember-glimmer-allow-backtracking-rerender'] = false;
+ emberBaseESNext.push(babelHelpers('prod'));
- if (process.env.ALLOW_BACKTRACKING) {
- features['ember-glimmer-allow-backtracking-rerender'] = true;
- features['ember-glimmer-detect-backtracking-rerender'] = false;
- }
+ emberRuntimeESNext = new MergeTrees(emberRuntimeESNext, {
+ annotation: 'ember-runtime es next'
+ });
- var isDevelopment = (environment === 'development');
-
- features['mandatory-setter'] = isDevelopment;
- features['ember-glimmer-detect-backtracking-rerender'] = isDevelopment;
-
- return features;
-}
-
-function babelConfigFor(environment) {
- var plugins = [];
- var features = getFeatures(environment);
- var includeDevHelpers = true;
-
- plugins.push(applyFeatureFlags({
- imports: [
- { module: 'ember-debug/features' },
- { module: 'ember-debug', name: 'isFeatureEnabled' },
- ],
- features: features
- }));
-
- var isProduction = (environment === 'production');
- if (isProduction) {
- includeDevHelpers = false;
- plugins.push(filterImports({
- 'ember-debug/deprecate': ['deprecate'],
- 'ember-debug': ['assert', 'debug', 'deprecate', 'info', 'runInDebug', 'warn', 'debugSeal', 'debugFreeze']
- }));
- }
+ let emberRuntimeES5 = toES5(emberRuntimeESNext, {
+ annotation: 'ember-runtime es5'
+ });
- return {
- plugins: plugins,
- includeDevHelpers: includeDevHelpers,
- helperWhiteList: [
- 'inherits',
- 'class-call-check',
- 'tagged-template-literal-loose',
- 'slice',
- 'defaults',
- 'create-class',
- 'interop-export-wildcard'
- ]
- };
-}
-
-function getVersion() {
- var projectPath = process.cwd();
- var info = getGitInfo(projectPath);
- if (info.tag) {
- return info.tag.replace(/^v/, '');
- }
+ let emberRuntimeAMD = toAMD(emberRuntimeES5, {
+ annotation: 'ember-runtime amd'
+ });
- var packageVersion = require(path.join(projectPath, 'package.json')).version;
- var sha = info.sha || '';
- var prefix = packageVersion + '-' + (process.env.BUILD_TYPE || info.branch || process.env.TRAVIS_BRANCH);
+ let emberRuntimeBundle = new MergeTrees([
+ license,
+ loader,
+ emberRuntimeAMD,
+ nodeModule,
+ bootstrapModule('ember-runtime', 'default')
+ ]);
- prefix = prefix.replace('master', 'canary');
+ emberRuntimeBundle = concat(emberRuntimeBundle, {
+ outputFile: 'ember-runtime.js'
+ });
- return prefix + '+' + sha.slice(0, 8);
-}
+ prodDist.push(emberRuntimeBundle);
-// non bundled vendor
-function jquery() {
- var jquery = require.resolve('jquery');
- return new Funnel(path.dirname(jquery), {
- files: ['jquery.js'],
- destDir: 'jquery',
- annotation: 'jquery/jquery.js'
- });
-}
-
-// TEST files
-function qunit() {
- var qunitjs = require.resolve('qunitjs');
- return new Funnel(path.dirname(qunitjs), {
- files: ['qunit.js', 'qunit.css'],
- destDir: 'qunit',
- annotation: 'qunit/qunit.{js|css}'
- });
-}
-
-function handlebarsFix() {
- var HANDLEBARS_PARSER = /\/parser.js$/;
- return {
- load: function(id) {
- if (HANDLEBARS_PARSER.test(id)) {
- var code = fs.readFileSync(id, 'utf8');
- return {
- code: code
- .replace('exports.__esModule = true;', '')
- .replace('exports[\'default\'] = handlebars;', 'export default handlebars;'),
-
- map: { mappings: null }
- };
- }
- }
- }
-}
+ emberProdTestsESNext.push(babelHelpers('prod'));
-function treeForAddon(project, name) {
- var addon = project.findAddonByName(name);
- var tree = addon.treeFor('addon');
+ emberBaseESNext.push(productionFeatures);
- return new Funnel(tree, {
- srcDir: 'modules'
- });
-}
-
-function getESLintRulePaths() {
- var emberjsBuildPath = path.dirname(require.resolve('emberjs-build'));
- var emberjsBuildLinked = emberjsBuildPath.indexOf(__dirname + '/node_modules') === -1;
-
- if (emberjsBuildLinked) {
- var rulePath = path.join(
- path.dirname(require.resolve('eslint-plugin-ember-internal')),
- 'rules'
- );
- return [rulePath];
- }
+ let emberProdBaseESNext = new MergeTrees(emberBaseESNext, {
+ annotation: 'ember.prod es next'
+ });
- return [];
-}
+ emberProdTestsESNext = new MergeTrees(emberProdTestsESNext, {
+ annotation: 'ember-tests.prod es next'
+ });
-module.exports = function(options) {
- var features = getFeatures();
- var version = getVersion();
-
- var vendorPackages = {
- 'ember-dev': treeForAddon(options.project, 'ember-dev'),
- 'external-helpers': vendoredPackage('external-helpers'),
- 'loader': vendoredPackage('loader'),
- 'rsvp': rsvp(),
- 'backburner': backburner(),
- 'router': router(),
- 'dag-map': dag(),
- 'route-recognizer': routeRecognizer(),
- 'simple-html-tokenizer': buildPackage('simple-html-tokenizer'),
-
- '@glimmer/compiler': buildPackage('@glimmer/compiler', {
- external: ['@glimmer/syntax', '@glimmer/wire-format', '@glimmer/util']
- }),
- '@glimmer/di': buildPackage('@glimmer/di', { external: ['@glimmer/util'] }),
- '@glimmer/reference': buildPackage('@glimmer/reference', { external: ['@glimmer/util'] }),
- '@glimmer/runtime': buildPackage('@glimmer/runtime', {
- external: ['@glimmer/util',
- '@glimmer/reference',
- '@glimmer/wire-format',
- '@glimmer/syntax']
- }),
- '@glimmer/node': buildPackage('@glimmer/node', { external: ['@glimmer/runtime'] }),
- '@glimmer/syntax': buildPackage('@glimmer/syntax', { external: ['handlebars', 'simple-html-tokenizer'] }),
- '@glimmer/util': buildPackage('@glimmer/util', { external: [] }),
- '@glimmer/wire-format': buildPackage('@glimmer/wire-format', { external: ['@glimmer/util'] }),
- 'handlebars': buildPackage('handlebars', {
- srcDir: 'lib',
- entry: 'handlebars/compiler/base.js',
- plugins: [handlebarsFix()]
- }) // inlined parser
- };
-
- // Replace _getBowerTree with one from npm
- EmberBuild.prototype._getBowerTree = function getBowerTree() {
- return mergeTrees([
- qunit(),
- jquery(),
- replaceVersion(new Funnel('config/package_manager_files', {
- destDir: '/'
- }), {
- version: version
- })
- ]);
- };
-
- EmberBuild.prototype._minifySourceTree = function (tree, options) {
- var srcFile = options.srcFile;
- var destFile = options.destFile;
- var files = [ srcFile ];
- var mapSrcFile = srcFile.slice(0, -2) + 'map';
- var mapDestFile = destFile.slice(0, -2) + 'map';
- if (options.enableSourceMaps) {
- files.push(mapSrcFile);
- }
- // because broccoli-uglify-sourcemap doesn't use persistent filter
- var reducedTree = new Funnel(tree, {
- annotation: 'reduce for minify',
- files: files
+ let emberProdES5 = toES5(emberProdBaseESNext, {
+ environment: 'production',
+ annotation: 'ember.prod es5'
});
- var minifiedTree = new uglify(reducedTree, {
- sourceMapConfig: {
- enabled: options.enableSourceMaps
- },
- mangle: true,
- compress: {
- // this is adversely affects heuristics for IIFE eval
- negate_iife: false,
- // limit sequences because of memory issues during parsing
- sequences: 30
- },
- output: {
- // no difference in size
- // and much easier to debug
- semicolons: false
- }
+
+ let emberProdTestsES5 = toES5(emberProdTestsESNext, {
+ environment: 'production',
+ annotation: 'ember-test.prod es5'
});
- return new Funnel(minifiedTree, {
- annotation: 'rename minified',
- files: files,
- getDestinationPath: function(relativePath) {
- if (relativePath === srcFile) {
- return destFile;
- }
- if (relativePath === mapSrcFile) {
- return mapDestFile;
- }
- return relativePath;
- }
+
+ let emberProdAMD = toAMD(emberProdES5, {
+ environment: 'production',
+ annotation: 'ember.prod amd'
});
- };
-
- var emberBuild = new EmberBuild({
- babel: {
- development: babelConfigFor('development'),
- production: babelConfigFor('production')
- },
- eslintRulePaths: getESLintRulePaths(),
- features: {
- development: getFeatures('development'),
- production: getFeatures('production')
- },
- glimmer: require('@glimmer/compiler'),
- packages: getPackages(features),
- vendoredPackages: vendorPackages,
- version: version
- });
- return emberBuild.getDistTrees();
-};
+ let emberProdTestsAMD = toAMD(emberProdTestsES5, {
+ environment: 'production',
+ annotation: 'ember-test.prod amd'
+ });
+
+ let emberProdBundle = new MergeTrees([
+ emberProdAMD,
+ loader,
+ license,
+ nodeModule
+ ]);
+
+ let emberProdTestsBundle = new MergeTrees([
+ emberProdTestsAMD,
+ license,
+ loader,
+ nodeModule
+ ]);
+
+ emberProdBundle = concat(emberProdBundle, {
+ outputFile: 'ember.prod.js',
+ });
+
+ emberProdTestsBundle = concat(emberProdTestsBundle, {
+ outputFile: 'ember-tests.prod.js',
+ hasBootstrap: false
+ });
+
+ let emberMinBundle = minify(emberProdBundle, 'ember.min');
+
+ prodDist.push(emberProdBundle, emberProdTestsBundle, emberMinBundle);
+ }
-module.exports.getFeatures = getFeatures;
+ let dist = [
+ emberDebugBundle,
+ emberTemplateCompilerBundle,
+ emberTestingBundle,
+ emberTestsBundle,
+ packageManagerJSONs(),
+ nodeTests(),
+ ...testHarness,
+ ...prodDist
+ ];
+
+ return new MergeTrees(dist);
+};
\ No newline at end of file
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
lib/packages.js
|
@@ -7,7 +7,7 @@ module.exports = function(features) {
'ember-metal': { trees: null, requirements: ['ember-environment', 'ember-utils'], vendorRequirements: ['backburner'] },
'ember-debug': { trees: null, requirements: [] },
'ember-runtime': { trees: null, vendorRequirements: ['rsvp'], requirements: ['container', 'ember-environment', 'ember-console', 'ember-metal'] },
- 'ember-views': { trees: null, requirements: ['ember-runtime'] },
+ 'ember-views': { trees: null, requirements: ['ember-runtime'], skipTests: true },
'ember-extension-support': { trees: null, requirements: ['ember-application'] },
'ember-testing': { trees: null, requirements: ['ember-application', 'ember-routing'], testing: true },
'ember-template-compiler': {
| true |
Other
|
emberjs
|
ember.js
|
c845e809f64a719175546afe50118496f93237af.json
|
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
|
package.json
|
@@ -55,17 +55,36 @@
"resolve": "^1.1.7",
"rsvp": "^3.4.0",
"simple-dom": "^0.3.0",
- "simple-html-tokenizer": "^0.3.0"
+ "simple-html-tokenizer": "^0.4.0"
},
"devDependencies": {
"aws-sdk": "~2.2.43",
- "babel-plugin-feature-flags": "^0.2.3",
- "babel-plugin-filter-imports": "~0.2.0",
- "backburner.js": "^0.3.1",
- "broccoli-rollup": "^1.0.3",
- "broccoli-string-replace": "^0.1.1",
+ "babel-plugin-check-es2015-constants": "^6.22.0",
+ "babel-plugin-feature-flags": "^0.3.1",
+ "babel-plugin-filter-imports": "^0.3.1",
+ "babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
+ "babel-plugin-transform-es2015-block-scoping": "^6.23.0",
+ "babel-plugin-transform-es2015-classes": "^6.23.0",
+ "babel-plugin-transform-es2015-computed-properties": "^6.22.0",
+ "babel-plugin-transform-es2015-destructuring": "^6.23.0",
+ "babel-plugin-transform-es2015-modules-amd": "^6.24.0",
+ "babel-plugin-transform-es2015-parameters": "^6.23.0",
+ "babel-plugin-transform-es2015-shorthand-properties": "^6.22.0",
+ "babel-plugin-transform-es2015-spread": "^6.22.0",
+ "babel-plugin-transform-es2015-template-literals": "^6.22.0",
+ "babel-plugin-transform-proto-to-assign": "^6.23.0",
+ "babel-template": "^6.23.0",
+ "backburner.js": "^0.4.0",
+ "broccoli-babel-transpiler": "next",
+ "broccoli-concat": "^3.2.2",
+ "broccoli-file-creator": "^1.1.1",
+ "broccoli-lint-eslint": "^3.2.0",
+ "broccoli-rollup": "^1.1.3",
+ "broccoli-string-replace": "^0.1.2",
+ "broccoli-uglify-js": "^0.2.0",
"broccoli-uglify-sourcemap": "^1.4.2",
"chalk": "^1.1.1",
+ "common-tags": "^1.4.0",
"dag-map": "^2.0.1",
"ember-cli": "2.10.0",
"ember-cli-blueprint-test-helpers": "^0.12.0",
@@ -74,21 +93,22 @@
"ember-cli-yuidoc": "0.8.4",
"ember-dev": "github:emberjs/ember-dev#eace534",
"ember-publisher": "0.0.7",
- "emberjs-build": "0.20.0",
- "eslint-plugin-ember-internal": "^1.0.1",
+ "eslint-plugin-ember-internal": "^1.1.0",
"express": "^4.5.0",
"finalhandler": "^0.4.0",
"git-repo-info": "^1.1.4",
"git-repo-version": "^0.3.1",
"github": "^0.2.3",
"glob": "^5.0.13",
"html-differ": "^1.3.4",
+ "lodash.uniq": "^4.5.0",
"mocha": "^2.4.5",
"qunit-extras": "^1.5.0",
"qunit-phantomjs-runner": "^2.2.0",
"qunitjs": "^1.22.0",
"route-recognizer": "^0.3.0",
"router_js": "^1.2.4",
+ "semver": "^5.3.0",
"serve-static": "^1.10.0",
"simple-dom": "^0.3.0",
"testem": "^1.14.2"
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.