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
ab27246721029814ca3feb1264d09f3965b7d734.json
Add blueprints for MU instance initializer
node-tests/fixtures/instance-initializer-test/module-unification/dummy.js
@@ -0,0 +1,25 @@ +import Application from '@ember/application'; +import { run } from '@ember/runloop'; +import { initialize } from 'dummy/init/instance-initializers/foo'; +import { module, test } from 'qunit'; + +module('Unit | Instance Initializer | foo', { + beforeEach() { + run(() => { + this.application = Application.create(); + this.appInstance = this.application.buildInstance(); + }); + }, + afterEach() { + run(this.appInstance, 'destroy'); + run(this.application, 'destroy'); + } +}); + +// Replace this with your real tests. +test('it works', function(assert) { + initialize(this.appInstance); + + // you would normally confirm the results of the initializer here + assert.ok(true); +});
true
Other
emberjs
ember.js
ab27246721029814ca3feb1264d09f3965b7d734.json
Add blueprints for MU instance initializer
node-tests/fixtures/instance-initializer-test/module-unification/mocha.js
@@ -0,0 +1,30 @@ +import { expect } from 'chai'; +import { describe, it, beforeEach } from 'mocha'; +import Application from '@ember/application'; +import { run } from '@ember/runloop'; +import { initialize } from 'my-app/init/instance-initializers/foo'; +import destroyApp from '../../helpers/destroy-app'; + +describe('Unit | Instance Initializer | foo', function() { + let application, appInstance; + + beforeEach(function() { + run(function() { + application = Application.create(); + appInstance = application.buildInstance(); + }); + }); + + afterEach(function() { + run(appInstance, 'destroy'); + destroyApp(application); + }); + + // Replace this with your real tests. + it('works', function() { + initialize(appInstance); + + // you would normally confirm the results of the initializer here + expect(true).to.be.ok; + }); +});
true
Other
emberjs
ember.js
ab27246721029814ca3feb1264d09f3965b7d734.json
Add blueprints for MU instance initializer
node-tests/fixtures/instance-initializer-test/module-unification/rfc232.js
@@ -0,0 +1,28 @@ +import Application from '@ember/application'; + +import { initialize } from 'my-app/init/instance-initializers/foo'; +import { module, test } from 'qunit'; +import { run } from '@ember/runloop'; + +module('Unit | Instance Initializer | foo', function(hooks) { + hooks.beforeEach(function() { + this.TestApplication = Application.extend(); + this.TestApplication.instanceInitializer({ + name: 'initializer under test', + initialize + }); + this.application = this.TestApplication.create({ autoboot: false }); + this.instance = this.application.buildInstance(); + }); + hooks.afterEach(function() { + run(this.application, 'destroy'); + run(this.instance, 'destroy'); + }); + + // Replace this with your real tests. + test('it works', async function(assert) { + await this.instance.boot(); + + assert.ok(true); + }); +});
true
Other
emberjs
ember.js
2765c4806f805100cf2ab8693eb7bb9a31922df1.json
Add v3.6.0-beta.4 to CHANGELOG [ci skip] (cherry picked from commit 0f0f59d3606d615338dd8f6efb6aafac7a00ed46)
CHANGELOG.md
@@ -1,5 +1,11 @@ # Ember Changelog +### v3.6.0-beta.4 (November 12, 2018) + +- [#17184](https://github.com/emberjs/ember.js/pull/17184) [BUGFIX] Ensures removeAllListeners does not break subsequent adds +- [#17186](https://github.com/emberjs/ember.js/pull/17186) [BUGFIX] Fix RouteInfo QP mutability +- [#17192](https://github.com/emberjs/ember.js/pull/17192) [BUGFIX] currentRoute should respect substates + ### v3.6.0-beta.3 (November 5, 2018) - [#17169](https://github.com/emberjs/ember.js/pull/17169) [BUGFIX] Add default implementations of Component lifecycle hooks
false
Other
emberjs
ember.js
08ff5b991e2a42ab20adaa8d939ec680a3055c67.json
remove redundant arg flipping in Evented#one
packages/@ember/-internals/runtime/lib/mixins/evented.js
@@ -94,11 +94,6 @@ export default Mixin.create({ @public */ one(name, target, method) { - if (!method) { - method = target; - target = null; - } - addListener(this, name, target, method, true); return this; },
false
Other
emberjs
ember.js
0f55cd9d21a6de8202e3d761b00f0d9e95d5501e.json
Add v3.6.0-beta.3 to CHANGELOG [ci skip] (cherry picked from commit bf773e88fe2960d7d9e45f8dd3eb1354777b5df9)
CHANGELOG.md
@@ -1,5 +1,11 @@ # Ember Changelog +### v3.6.0-beta.3 (November 5, 2018) + +- [#17169](https://github.com/emberjs/ember.js/pull/17169) [BUGFIX] Add default implementations of Component lifecycle hooks +- [#17165](https://github.com/emberjs/ember.js/pull/17165) [BUGFIX] Fix RouteInfo.find and transition.froms +- [#17180](https://github.com/emberjs/ember.js/pull/17180) [BUGFIX] Router Service State should be correct in events + ### v3.6.0-beta.2 (October 29, 2018) - [#17130](https://github.com/emberjs/ember.js/pull/17130) [BUGFIX] Ensure that timers scheduled after a system sleep are fired properly.
false
Other
emberjs
ember.js
313ce30dfaea576f126dd02a067864756f06567b.json
Add some missing CHANGELOG entries [ci skip] (cherry picked from commit 6e0f477f1cf5d6b5a9bf476a1d43408039619521)
CHANGELOG.md
@@ -4,6 +4,8 @@ - [#17130](https://github.com/emberjs/ember.js/pull/17130) [BUGFIX] Ensure that timers scheduled after a system sleep are fired properly. - [#17137](https://github.com/emberjs/ember.js/pull/17137) [BUGFIX] Assert when local variables shadow modifier invocations +- [#17132](https://github.com/emberjs/ember.js/pull/17132) [BUGFIX] Assert when local variables shadow helper invocations +- [#17135](https://github.com/emberjs/ember.js/pull/17135) [BUGFIX] Ensure local variables win over helper invocations - [#16923](https://github.com/emberjs/ember.js/pull/16923) [BUGFIX] ES6 classes on/removeListener and observes/removeObserver interop v2 - [#17128](https://github.com/emberjs/ember.js/pull/17128) [BUGFIX] Fix sourcemaping issues due to multiple sourcemap directives. - [#17115](https://github.com/emberjs/ember.js/pull/17115) [BUGFIX] Pass the event parameter to sendAction @@ -13,7 +15,7 @@ - [#16956](https://github.com/emberjs/ember.js/pull/16956) [DEPRECATION] Deprecate Ember.merge - [#16795](https://github.com/emberjs/ember.js/pull/16795) [FEATURE] Native Class Constructor Update (see [emberjs/rfcs#337](https://github.com/emberjs/rfcs/blob/master/text/0337-native-class-constructor-update.md) -- [#16865](https://github.com/emberjs/ember.js/pull/16865) / [#16899](https://github.com/emberjs/ember.js/pull/16899) / [#16914](https://github.com/emberjs/ember.js/pull/16914) / [#16897](https://github.com/emberjs/ember.js/pull/16897) / [#16913](https://github.com/emberjs/ember.js/pull/16913) / [#16894](https://github.com/emberjs/ember.js/pull/16894) / [#16896](https://github.com/emberjs/ember.js/pull/16896) [BUGFIX] Support RFC 232 and RFC 268 style tests with Mocha blueprints +- [#16865](https://github.com/emberjs/ember.js/pull/16865) / [#16899](https://github.com/emberjs/ember.js/pull/16899) / [#16914](https://github.com/emberjs/ember.js/pull/16914) / [#16897](https://github.com/emberjs/ember.js/pull/16897) / [#16913](https://github.com/emberjs/ember.js/pull/16913) / [#16894](https://github.com/emberjs/ember.js/pull/16894) / [#16896](https://github.com/emberjs/ember.js/pull/16896) [BUGFIX] Support RFC 232 and RFC 268 style tests with Mocha blueprints - [#17025](https://github.com/emberjs/ember.js/pull/17025) / [#17034](https://github.com/emberjs/ember.js/pull/17034) / [#17036](https://github.com/emberjs/ember.js/pull/17036) / [#17038](https://github.com/emberjs/ember.js/pull/17038) / [#17040](https://github.com/emberjs/ember.js/pull/17040) / [#17041](https://github.com/emberjs/ember.js/pull/17041) / [#17061](https://github.com/emberjs/ember.js/pull/17061) [FEATURE] Final stage of the router service RFC (see [emberjs/rfcs#95](https://github.com/emberjs/rfcs/blob/master/text/0095-router-service.md) - [#17051](https://github.com/emberjs/ember.js/pull/17051) Update glimmer-vm packages to 0.36.4
false
Other
emberjs
ember.js
b05f4da9b5c7cca4f1badc021a8ebb0183380906.json
Adjust browser class name
bin/run-tests-browser-runner.js
@@ -4,7 +4,7 @@ const puppeteer = require('puppeteer'); const chalk = require('chalk'); const fs = require('fs'); -module.exports = class BroswerRunner { +module.exports = class BrowserRunner { constructor() { this.resolveTest = undefined; this.rejectTest = undefined;
true
Other
emberjs
ember.js
b05f4da9b5c7cca4f1badc021a8ebb0183380906.json
Adjust browser class name
bin/run-tests.js
@@ -31,8 +31,8 @@ let browserRunner; function getBrowserRunner() { if (browserRunner === undefined) { // requires new node - let BroswerRunner = require('./run-tests-browser-runner'); - browserRunner = new BroswerRunner(); + let BrowserRunner = require('./run-tests-browser-runner'); + browserRunner = new BrowserRunner(); } return browserRunner; }
true
Other
emberjs
ember.js
e2352e6071af9c1a0865478d24f8f2c44778ebc8.json
Fix incorrect date in CHANGELOG [ci skip]
CHANGELOG.md
@@ -1,6 +1,6 @@ # Ember Changelog -### v3.6.0-beta.2 (October 27, 2018) +### v3.6.0-beta.2 (October 29, 2018) - [#17130](https://github.com/emberjs/ember.js/pull/17130) [BUGFIX] Ensure that timers scheduled after a system sleep are fired properly. - [#17137](https://github.com/emberjs/ember.js/pull/17137) [BUGFIX] Assert when local variables shadow modifier invocations
false
Other
emberjs
ember.js
e529ae76a1582b2213f8dc723db17e1dad8628b7.json
Add v3.6.0-beta.2 to CHANGELOG [ci skip] (cherry picked from commit 596bdee3434f7d1a5369f0b11a870e38e56a7bf0)
CHANGELOG.md
@@ -1,5 +1,14 @@ # Ember Changelog +### v3.6.0-beta.2 (October 27, 2018) + +- [#17130](https://github.com/emberjs/ember.js/pull/17130) [BUGFIX] Ensure that timers scheduled after a system sleep are fired properly. +- [#17137](https://github.com/emberjs/ember.js/pull/17137) [BUGFIX] Assert when local variables shadow modifier invocations +- [#16923](https://github.com/emberjs/ember.js/pull/16923) [BUGFIX] ES6 classes on/removeListener and observes/removeObserver interop v2 +- [#17128](https://github.com/emberjs/ember.js/pull/17128) [BUGFIX] Fix sourcemaping issues due to multiple sourcemap directives. +- [#17115](https://github.com/emberjs/ember.js/pull/17115) [BUGFIX] Pass the event parameter to sendAction +- [#17153](https://github.com/emberjs/ember.js/pull/17153) [BUGFIX] Blueprints can generate components with a single word name + ### v3.6.0-beta.1 (October 8, 2018) - [#16956](https://github.com/emberjs/ember.js/pull/16956) [DEPRECATION] Deprecate Ember.merge
false
Other
emberjs
ember.js
19f5c8919052d1acea9147b341dbbc8009c34f59.json
Add 3.4.6 and 3.5.1 to the CHANGELOG.md. [ci skip]
CHANGELOG.md
@@ -8,11 +8,24 @@ - [#17025](https://github.com/emberjs/ember.js/pull/17025) / [#17034](https://github.com/emberjs/ember.js/pull/17034) / [#17036](https://github.com/emberjs/ember.js/pull/17036) / [#17038](https://github.com/emberjs/ember.js/pull/17038) / [#17040](https://github.com/emberjs/ember.js/pull/17040) / [#17041](https://github.com/emberjs/ember.js/pull/17041) / [#17061](https://github.com/emberjs/ember.js/pull/17061) [FEATURE] Final stage of the router service RFC (see [emberjs/rfcs#95](https://github.com/emberjs/rfcs/blob/master/text/0095-router-service.md) - [#17051](https://github.com/emberjs/ember.js/pull/17051) Update glimmer-vm packages to 0.36.4 +### v3.5.1 (October 29, 2018) + +- [#17028](https://github.com/emberjs/ember.js/pull/17028) Mark `defineProperty` as public (yet low level) API. +- [#17115](https://github.com/emberjs/ember.js/pull/17115) [BUGFIX] Pass the event parameter to sendAction +- [#17128](https://github.com/emberjs/ember.js/pull/17128) [BUGFIX] Fix sourcemaping issues due to multiple sourcemap directives. +- [#17130](https://github.com/emberjs/ember.js/pull/17130) [BUGFIX] Ensure that timers scheduled after a system sleep are fired properly. + ### v3.5.0 (October 8, 2018) - [#16978](https://github.com/emberjs/ember.js/pull/16978) [BUGFIX] Properly teardown alias - [#16877](https://github.com/emberjs/ember.js/pull/16877) [CLEANUP] Allow routes to be named "array" and "object" +### v3.4.6 (October 29, 2018) + +- [#17115](https://github.com/emberjs/ember.js/pull/17115) [BUGFIX] Ensure `{{input` continues to pass the event to the actions that it fires. +- [#17128](https://github.com/emberjs/ember.js/pull/17128) [BUGFIX] Fix invalid sourcemap declarations. +- [#17130](https://github.com/emberjs/ember.js/pull/17130) [BUGFIX] Ensure that timers scheduled after a system sleep are fired properly. + ### v3.4.5 (October 4, 2018) - [#17029](https://github.com/emberjs/ember.js/pull/17029) [BUGFIX] Update backburner.js to 2.4.0.
false
Other
emberjs
ember.js
e7263d43e4454746c46b15d4faef805af8b883d1.json
Remove extraneous variable. Return inside if/else
packages/@ember/-internals/utils/lib/cache.ts
@@ -8,17 +8,14 @@ export default class Cache<T, V> { } get(key: T): V { - let value; if (this.store.has(key)) { this.hits++; - value = this.store.get(key); + return this.store.get(key); } else { this.misses++; - value = this.set(key, this.func(key)); + return this.set(key, this.func(key)); } - - return value; } set(key: T, value: V) {
false
Other
emberjs
ember.js
196a208a83edb2f4a88c42116a20631ca8bcb1fa.json
Change logic to remove variable that is never read
packages/@ember/-internals/utils/lib/cache.ts
@@ -8,11 +8,11 @@ export default class Cache<T, V> { } get(key: T): V { - let value = this.store.get(key); + let value; if (this.store.has(key)) { this.hits++; - return this.store.get(key); + value = this.store.get(key); } else { this.misses++; value = this.set(key, this.func(key));
false
Other
emberjs
ember.js
05301603cdb00f800473ca3d8eb941ea63254f07.json
add test for setComponentManager with a factory
packages/@ember/-internals/glimmer/tests/integration/custom-component-manager-test.js
@@ -8,28 +8,27 @@ import { import { setComponentManager, capabilities } from '@ember/-internals/glimmer'; if (GLIMMER_CUSTOM_COMPONENT_MANAGER) { - class ComponentManagerTest extends RenderingTest { - constructor(assert) { - super(...arguments); + let BasicComponentManager = EmberObject.extend({ + capabilities: capabilities('3.4'), - this.registerComponentManager( - 'basic', - EmberObject.extend({ - capabilities: capabilities('3.4'), + createComponent(factory, args) { + return factory.create({ args }); + }, - createComponent(factory, args) { - return factory.create({ args }); - }, + updateComponent(component, args) { + set(component, 'args', args); + }, - updateComponent(component, args) { - set(component, 'args', args); - }, + getContext(component) { + return component; + }, + }); - getContext(component) { - return component; - }, - }) - ); + class ComponentManagerTest extends RenderingTest { + constructor(assert) { + super(...arguments); + + this.registerComponentManager('basic', BasicComponentManager); this.registerComponentManager( 'instrumented-full', @@ -94,6 +93,24 @@ if (GLIMMER_CUSTOM_COMPONENT_MANAGER) { this.assertHTML(`<p>hello world</p>`); } + ['@test it can render a basic component with custom component manager with a factory']() { + let ComponentClass = setComponentManager( + () => BasicComponentManager.create(), + EmberObject.extend({ + greeting: 'hello', + }) + ); + + this.registerComponent('foo-bar', { + template: `<p>{{greeting}} world</p>`, + ComponentClass, + }); + + this.render('{{foo-bar}}'); + + this.assertHTML(`<p>hello world</p>`); + } + ['@test it can have no template context']() { this.registerComponentManager( 'pseudo-template-only',
false
Other
emberjs
ember.js
101322cdc5cb4bc669322d9f4c117de3c7dd228d.json
Add tests for current AST plugin format. We had previously only tested the legacy plugin format, and I went to look for a reference plugin in the "new style" and was surprised that there wasn't one in the tests. I fixed that mistake in this commit... :D
packages/ember-template-compiler/tests/system/compile_options_test.js
@@ -28,7 +28,7 @@ moduleFor( ); let customTransformCounter = 0; -class CustomTransform { +class LegacyCustomTransform { constructor(options) { customTransformCounter++; this.options = options; @@ -56,6 +56,26 @@ class CustomTransform { } } +function customTransform() { + customTransformCounter++; + + return { + name: 'remove-data-test', + + visitor: { + ElementNode(node) { + for (var i = 0; i < node.attributes.length; i++) { + let attribute = node.attributes[i]; + + if (attribute.name === 'data-test') { + node.attributes.splice(i, 1); + } + } + }, + }, + }; +} + class CustomPluginsTests extends RenderingTestCase { afterEach() { customTransformCounter = 0; @@ -77,20 +97,43 @@ class CustomPluginsTests extends RenderingTestCase { } } +moduleFor( + 'ember-template-compiler: registerPlugin with a custom plugins in legacy format', + class extends CustomPluginsTests { + beforeEach() { + registerPlugin('ast', LegacyCustomTransform); + } + + afterEach() { + unregisterPlugin('ast', LegacyCustomTransform); + return super.afterEach(); + } + + ['@test custom registered plugins are deduplicated'](assert) { + registerPlugin('ast', LegacyCustomTransform); + this.registerTemplate( + 'application', + '<div data-test="foo" data-blah="derp" class="hahaha"></div>' + ); + assert.equal(customTransformCounter, 1, 'transform should only be instantiated once'); + } + } +); + moduleFor( 'ember-template-compiler: registerPlugin with a custom plugins', class extends CustomPluginsTests { beforeEach() { - registerPlugin('ast', CustomTransform); + registerPlugin('ast', customTransform); } afterEach() { - unregisterPlugin('ast', CustomTransform); + unregisterPlugin('ast', customTransform); return super.afterEach(); } ['@test custom registered plugins are deduplicated'](assert) { - registerPlugin('ast', CustomTransform); + registerPlugin('ast', customTransform); this.registerTemplate( 'application', '<div data-test="foo" data-blah="derp" class="hahaha"></div>' @@ -100,14 +143,28 @@ moduleFor( } ); +moduleFor( + 'ember-template-compiler: custom plugins in legacy format passed to compile', + class extends RenderingTestCase { + // override so that we can provide custom AST plugins to compile + compile(templateString) { + return compile(templateString, { + plugins: { + ast: [LegacyCustomTransform], + }, + }); + } + } +); + moduleFor( 'ember-template-compiler: custom plugins passed to compile', class extends RenderingTestCase { // override so that we can provide custom AST plugins to compile compile(templateString) { return compile(templateString, { plugins: { - ast: [CustomTransform], + ast: [customTransform], }, }); }
false
Other
emberjs
ember.js
8bc9483d6e5f5c138246aa2e39e5d7715dcb5f32.json
Share more stuff between custom managers
packages/@ember/-internals/glimmer/index.ts
@@ -307,4 +307,5 @@ export { default as OutletView } from './lib/views/outlet'; export { capabilities } from './lib/component-managers/custom'; export { setComponentManager, getComponentManager } from './lib/utils/custom-component-manager'; export { setModifierManager, getModifierManager } from './lib/utils/custom-modifier-manager'; +export { capabilities as modifierCapabilties } from './lib/modifiers/custom'; export { isSerializationFirstNode } from './lib/utils/serialization-first-node-helpers';
true
Other
emberjs
ember.js
8bc9483d6e5f5c138246aa2e39e5d7715dcb5f32.json
Share more stuff between custom managers
packages/@ember/-internals/glimmer/lib/component-managers/custom.ts
@@ -22,6 +22,7 @@ import { Destroyable } from '@glimmer/util'; import Environment from '../environment'; import RuntimeResolver from '../resolver'; import { OwnedTemplate } from '../template'; +import { ManagerArgs, valueForCapturedArgs } from '../utils/managers'; import { RootReference } from '../utils/references'; import AbstractComponentManager from './abstract'; @@ -64,15 +65,10 @@ export interface Capabilities { destructor: boolean; } -export interface CustomComponentManagerArgs { - named: Dict<Opaque>; - positional: Opaque[]; -} - export interface ManagerDelegate<ComponentInstance> { capabilities: Capabilities; - createComponent(factory: Opaque, args: CustomComponentManagerArgs): ComponentInstance; - updateComponent(instance: ComponentInstance, args: CustomComponentManagerArgs): void; + createComponent(factory: Opaque, args: ManagerArgs): ComponentInstance; + updateComponent(instance: ComponentInstance, args: ManagerArgs): void; getContext(instance: ComponentInstance): Opaque; } @@ -104,12 +100,6 @@ export interface ComponentArguments { named: Dict<Opaque>; } -function valueForCapturedArgs(args: CapturedArguments): CustomComponentManagerArgs { - return { - named: args.named.value(), - positional: args.positional.value(), - }; -} /** The CustomComponentManager allows addons to provide custom component implementations that integrate seamlessly into Ember. This is accomplished
true
Other
emberjs
ember.js
8bc9483d6e5f5c138246aa2e39e5d7715dcb5f32.json
Share more stuff between custom managers
packages/@ember/-internals/glimmer/lib/modifiers/custom.ts
@@ -1,16 +1,19 @@ import { Factory } from '@ember/-internals/owner'; -import { Dict, Opaque } from '@glimmer/interfaces'; +import { Opaque } from '@glimmer/interfaces'; import { Tag } from '@glimmer/reference'; import { Arguments, CapturedArguments, ModifierManager } from '@glimmer/runtime'; +import { ManagerArgs, valueForCapturedArgs } from '../utils/managers'; export interface CustomModifierDefinitionState<ModifierInstance> { ModifierClass: Factory<ModifierInstance>; name: string; delegate: ModifierManagerDelegate<ModifierInstance>; } +export interface Capabilities {} + // Currently there are no capabilities for modifiers -export function capabilities() { +export function capabilities(_managerAPI: string, _optionalFeatures?: {}): Capabilities { return {}; } @@ -19,7 +22,7 @@ export class CustomModifierDefinition<ModifierInstance> { public manager = CUSTOM_MODIFIER_MANAGER; constructor( public name: string, - ModifierClass: Factory<ModifierInstance>, + public ModifierClass: Factory<ModifierInstance>, public delegate: ModifierManagerDelegate<ModifierInstance> ) { this.state = { @@ -45,27 +48,12 @@ export class CustomModifierState<ModifierInstance> { } } -export interface CustomModifierManagerArgs { - named: Dict<Opaque>; - positional: Opaque[]; -} - export interface ModifierManagerDelegate<ModifierInstance> { - createModifier(factory: Opaque, args: CustomModifierManagerArgs): ModifierInstance; - installModifier( - instance: ModifierInstance, - element: Element, - args: CustomModifierManagerArgs - ): void; - updateModifier(instance: ModifierInstance, args: CustomModifierManagerArgs): void; - destroyModifier(instance: ModifierInstance, args: CustomModifierManagerArgs): void; -} - -function valueForCapturedArgs(args: CapturedArguments): CustomModifierManagerArgs { - return { - named: args.named.value(), - positional: args.positional.value(), - }; + capabilities: Capabilities; + createModifier(factory: Opaque, args: ManagerArgs): ModifierInstance; + installModifier(instance: ModifierInstance, element: Element, args: ManagerArgs): void; + updateModifier(instance: ModifierInstance, args: ManagerArgs): void; + destroyModifier(instance: ModifierInstance, args: ManagerArgs): void; } class CustomModifierManager<ModifierInstance>
true
Other
emberjs
ember.js
8bc9483d6e5f5c138246aa2e39e5d7715dcb5f32.json
Share more stuff between custom managers
packages/@ember/-internals/glimmer/lib/resolver.ts
@@ -41,7 +41,7 @@ import { default as queryParams } from './helpers/query-param'; import { default as readonly } from './helpers/readonly'; import { default as unbound } from './helpers/unbound'; import ActionModifierManager from './modifiers/action'; -import { CustomModifierDefinition } from './modifiers/custom'; +import { CustomModifierDefinition, ModifierManagerDelegate } from './modifiers/custom'; import { populateMacros } from './syntax'; import { mountHelper } from './syntax/mount'; import { outletHelper } from './syntax/outlet'; @@ -285,14 +285,7 @@ export default class RuntimeResolver implements IRuntimeResolver<OwnedTemplateMe let { owner } = meta; let modifier = owner.factoryFor(`modifier:${name}`); if (modifier !== undefined) { - let managerFactory = getModifierManager(modifier.class); - assert( - `Could not find custom modifier manager for '${name}' which was specified by ${ - modifier.class - }`, - !!managerFactory - ); - + let managerFactory = getModifierManager<ModifierManagerDelegate<Opaque>>(modifier.class); let manager = managerFactory!(owner); return new CustomModifierDefinition(name, modifier, manager); @@ -352,20 +345,14 @@ export default class RuntimeResolver implements IRuntimeResolver<OwnedTemplateMe } if (GLIMMER_CUSTOM_COMPONENT_MANAGER && component && component.class) { - let managerId = getComponentManager(component.class); - if (managerId) { - let manager = this._lookupComponentManager(meta.owner, managerId); - assert( - `Could not find custom component manager '${managerId}' which was specified by ${ - component.class - }`, - !!manager - ); + let managerFactory = getComponentManager<ManagerDelegate<Opaque>>(component.class); + if (managerFactory) { + let delegate = managerFactory(meta.owner); let definition = new CustomManagerDefinition( name, component, - manager, + delegate, layout || meta.owner.lookup<OwnedTemplate>(P`template:components/-default`) ); finalizer();
true
Other
emberjs
ember.js
8bc9483d6e5f5c138246aa2e39e5d7715dcb5f32.json
Share more stuff between custom managers
packages/@ember/-internals/glimmer/lib/utils/custom-component-manager.ts
@@ -1,27 +1,24 @@ +import { Owner } from '@ember/-internals/owner'; import { GLIMMER_CUSTOM_COMPONENT_MANAGER } from '@ember/canary-features'; +import { Opaque } from '@glimmer/interfaces'; +import { getManager, ManagerFactory, setManager } from './managers'; -const getPrototypeOf = Object.getPrototypeOf; -const MANAGERS: WeakMap<any, string> = new WeakMap(); - -export function setComponentManager(managerId: string, obj: any) { - MANAGERS.set(obj, managerId); - - return obj; +export function setComponentManager(stringOrFunction: string | ManagerFactory<Opaque>, obj: any) { + let factory; + if (typeof stringOrFunction === 'string') { + factory = function(owner: Owner) { + return owner.lookup(`component-manager:${stringOrFunction}`); + }; + } else { + factory = stringOrFunction; + } + return setManager(factory, obj); } -export function getComponentManager(obj: any): string | undefined { +export function getComponentManager<T>(obj: any): undefined | ManagerFactory<T> { if (!GLIMMER_CUSTOM_COMPONENT_MANAGER) { return; } - let pointer = obj; - while (pointer !== undefined && pointer !== null) { - if (MANAGERS.has(pointer)) { - return MANAGERS.get(pointer); - } - - pointer = getPrototypeOf(pointer); - } - - return; + return getManager(obj); }
true
Other
emberjs
ember.js
8bc9483d6e5f5c138246aa2e39e5d7715dcb5f32.json
Share more stuff between custom managers
packages/@ember/-internals/glimmer/lib/utils/custom-modifier-manager.ts
@@ -1,32 +1,15 @@ -import { Owner } from '@ember/-internals/owner'; import { GLIMMER_MODIFIER_MANAGER } from '@ember/canary-features'; import { Opaque } from '@glimmer/util'; -import { ModifierManagerDelegate } from '../modifiers/custom'; +import { getManager, ManagerFactory, setManager } from './managers'; -const getPrototypeOf = Object.getPrototypeOf; - -export type ModifierManagerFactory = (owner: Owner) => ModifierManagerDelegate<Opaque>; - -const MANAGERS: WeakMap<any, ModifierManagerFactory> = new WeakMap(); - -export function setModifierManager(factory: ModifierManagerFactory, obj: any) { - MANAGERS.set(obj, factory); - return obj; +export function setModifierManager(factory: ManagerFactory<Opaque>, obj: any) { + return setManager(factory, obj); } -export function getModifierManager(obj: any): undefined | ModifierManagerFactory { +export function getModifierManager<T>(obj: any): undefined | ManagerFactory<T> { if (!GLIMMER_MODIFIER_MANAGER) { return; } - let pointer = obj; - while (pointer !== undefined && pointer !== null) { - if (MANAGERS.has(pointer)) { - return MANAGERS.get(pointer); - } - - pointer = getPrototypeOf(pointer); - } - - return; + return getManager(obj); }
true
Other
emberjs
ember.js
8bc9483d6e5f5c138246aa2e39e5d7715dcb5f32.json
Share more stuff between custom managers
packages/@ember/-internals/glimmer/lib/utils/managers.ts
@@ -0,0 +1,39 @@ +import { Owner } from '@ember/-internals/owner'; +import { Dict, Opaque } from '@glimmer/interfaces'; +import { CapturedArguments } from '@glimmer/runtime'; + +const MANAGERS: WeakMap<any, ManagerFactory<Opaque>> = new WeakMap(); + +const getPrototypeOf = Object.getPrototypeOf; + +export type ManagerFactory<ManagerDelegate> = (owner: Owner) => ManagerDelegate; + +export function setManager<ManagerDelegate>(factory: ManagerFactory<ManagerDelegate>, obj: any) { + MANAGERS.set(obj, factory); + return obj; +} + +export function getManager<T>(obj: any): undefined | ManagerFactory<T> { + let pointer = obj; + while (pointer !== undefined && pointer !== null) { + if (MANAGERS.has(pointer)) { + return MANAGERS.get(pointer) as ManagerFactory<T>; + } + + pointer = getPrototypeOf(pointer); + } + + return; +} + +export function valueForCapturedArgs(args: CapturedArguments): ManagerArgs { + return { + named: args.named.value(), + positional: args.positional.value(), + }; +} + +export interface ManagerArgs { + named: Dict<Opaque>; + positional: Opaque[]; +}
true
Other
emberjs
ember.js
506b8841888190de9cc35814d16a8d3098cfb20e.json
add more counters, fix performance issues
packages/@ember/-internals/meta/lib/meta.ts
@@ -12,10 +12,14 @@ export interface MetaCounters { deleteCalls: number; metaCalls: number; metaInstantiated: number; + matchingListenersCalls: number; addToListenersCalls: number; removeFromListenersCalls: number; removeAllListenersCalls: number; listenersInherited: number; + listenersFlattened: number; + parentListenersUsed: number; + flattenedListenersCalls: number; reopensAfterFlatten: number; } @@ -28,10 +32,14 @@ if (DEBUG) { deleteCalls: 0, metaCalls: 0, metaInstantiated: 0, + matchingListenersCalls: 0, addToListenersCalls: 0, removeFromListenersCalls: 0, removeAllListenersCalls: 0, listenersInherited: 0, + listenersFlattened: 0, + parentListenersUsed: 0, + flattenedListenersCalls: 0, reopensAfterFlatten: 0, }; } @@ -99,7 +107,7 @@ export class Meta { _listeners: Listener[] | undefined; _listenersVersion = 1; - _inheritedEnd = 0; + _inheritedEnd = -1; _flattenedVersion = 0; // DEBUG @@ -615,6 +623,32 @@ export class Meta { } } + private writableListeners(): Listener[] { + // Check if we need to invalidate and reflatten. We need to do this if we + // have already flattened (flattened version is the current version) and + // we are either writing to a prototype meta OR we have never inherited, and + // may have cached the parent's listeners. + if ( + this._flattenedVersion === currentListenerVersion && + (this.source === this.proto || this._inheritedEnd === -1) + ) { + if (DEBUG) { + counters!.reopensAfterFlatten++; + } + + currentListenerVersion++; + } + + // Inherited end has not been set, then we have never created our own + // listeners, but may have cached the parent's + if (this._inheritedEnd === -1) { + this._inheritedEnd = 0; + this._listeners = []; + } + + return this._listeners!; + } + /** Flattening is based on a global revision counter. If the revision has bumped it means that somewhere in a class inheritance chain something has @@ -628,104 +662,77 @@ export class Meta { This is a very rare occurence, so while the counter is global it shouldn't be updated very often in practice. */ - private _shouldFlatten() { - return this._flattenedVersion < currentListenerVersion; - } - - private _isFlattened() { - // A meta is flattened _only_ if the saved version is equal to the current - // version. Otherwise, it will flatten again the next time - // `flattenedListeners` is called, so there is no reason to bump the global - // version again. - return this._flattenedVersion === currentListenerVersion; - } - - private _setFlattened() { - this._flattenedVersion = currentListenerVersion; - } - - private writableListeners(): Listener[] { - let listeners = this._listeners; - - if (listeners === undefined) { - listeners = this._listeners = [] as Listener[]; + private flattenedListeners(): Listener[] | undefined { + if (DEBUG) { + counters!.flattenedListenersCalls++; } - // Check if the meta is owned by a prototype. If so, our listeners are - // inheritable so check the meta has been flattened. If it has, children - // have inherited its listeners, so bump the global version counter to - // invalidate. - if (this.source === this.proto && this._isFlattened()) { + if (this._flattenedVersion < currentListenerVersion) { if (DEBUG) { - counters!.reopensAfterFlatten++; + counters!.listenersFlattened++; } - currentListenerVersion++; - } - - return listeners; - } - - private flattenedListeners(): Listener[] | undefined { - // If this instance doesn't have any of its own listeners (writableListeners - // has never been called) then we don't need to do any flattening, return - // the parent's listeners instead. - if (this._listeners === undefined) { - return this.parent !== null ? this.parent.flattenedListeners() : undefined; - } - - if (this._shouldFlatten()) { let parent = this.parent; if (parent !== null) { // compute let parentListeners = parent.flattenedListeners(); if (parentListeners !== undefined) { - let listeners = this._listeners; + if (this._listeners === undefined) { + // If this instance doesn't have any of its own listeners (writableListeners + // has never been called) then we don't need to do any flattening, return + // the parent's listeners instead. + if (DEBUG) { + counters!.parentListenersUsed++; + } - if (listeners === undefined) { - listeners = this._listeners = [] as Listener[]; - } + this._listeners = parentListeners; + } else { + let listeners = this._listeners; - if (this._inheritedEnd > 0) { - listeners.splice(0, this._inheritedEnd); - this._inheritedEnd = 0; - } + if (this._inheritedEnd > 0) { + listeners.splice(0, this._inheritedEnd); + this._inheritedEnd = 0; + } - for (let i = 0; i < parentListeners.length; i++) { - let listener = parentListeners[i]; - let index = indexOfListener( - listeners, - listener.event, - listener.target, - listener.method - ); - - if (index === -1) { - if (DEBUG) { - counters!.listenersInherited++; + for (let i = 0; i < parentListeners.length; i++) { + let listener = parentListeners[i]; + let index = indexOfListener( + listeners, + listener.event, + listener.target, + listener.method + ); + + if (index === -1) { + if (DEBUG) { + counters!.listenersInherited++; + } + + listeners.unshift(listener); + this._inheritedEnd++; } - - listeners.unshift(listener); - this._inheritedEnd++; } } } } - this._setFlattened(); + this._flattenedVersion = currentListenerVersion; } return this._listeners; } matchingListeners(eventName: string): (string | boolean | object | null)[] | undefined | void { let listeners = this.flattenedListeners(); + let result; - if (listeners !== undefined) { - let result = []; + if (DEBUG) { + counters!.matchingListenersCalls++; + } + if (listeners !== undefined) { for (let index = 0; index < listeners.length; index++) { let listener = listeners[index]; @@ -735,12 +742,18 @@ export class Meta { listener.event === eventName && (listener.kind === ListenerKind.ADD || listener.kind === ListenerKind.ONCE) ) { + if (result === undefined) { + // we create this array only after we've found a listener that + // matches to avoid allocations when no matches are found. + result = [] as any[]; + } + result.push(listener.target!, listener.method, listener.kind === ListenerKind.ONCE); } } - - return result.length === 0 ? undefined : result; } + + return result; } }
true
Other
emberjs
ember.js
506b8841888190de9cc35814d16a8d3098cfb20e.json
add more counters, fix performance issues
packages/@ember/-internals/meta/tests/listeners_test.js
@@ -0,0 +1,159 @@ +import { AbstractTestCase, moduleFor } from 'internal-test-helpers'; +import { meta, counters } from '..'; + +moduleFor( + 'Ember.meta listeners', + class extends AbstractTestCase { + ['@test basics'](assert) { + let t = {}; + let m = meta({}); + m.addToListeners('hello', t, 'm', 0); + let matching = m.matchingListeners('hello'); + assert.equal(matching.length, 3); + assert.equal(matching[0], t); + m.removeFromListeners('hello', t, 'm'); + matching = m.matchingListeners('hello'); + assert.equal(matching, undefined); + } + + ['@test inheritance'](assert) { + let target = {}; + let parent = {}; + let parentMeta = meta(parent); + parentMeta.addToListeners('hello', target, 'm', 0); + + let child = Object.create(parent); + let m = meta(child); + + let matching = m.matchingListeners('hello'); + assert.equal(matching.length, 3); + assert.equal(matching[0], target); + assert.equal(matching[1], 'm'); + assert.equal(matching[2], 0); + m.removeFromListeners('hello', target, 'm'); + matching = m.matchingListeners('hello'); + assert.equal(matching, undefined); + matching = parentMeta.matchingListeners('hello'); + assert.equal(matching.length, 3); + } + + ['@test deduplication'](assert) { + let t = {}; + let m = meta({}); + m.addToListeners('hello', t, 'm', 0); + m.addToListeners('hello', t, 'm', 0); + let matching = m.matchingListeners('hello'); + assert.equal(matching.length, 3); + assert.equal(matching[0], t); + } + + ['@test parent caching'](assert) { + counters.flattenedListenersCalls = 0; + counters.parentListenersUsed = 0; + + class Class {} + let classMeta = meta(Class.prototype); + classMeta.addToListeners('hello', null, 'm', 0); + + let instance = new Class(); + let m = meta(instance); + + let matching = m.matchingListeners('hello'); + + assert.equal(matching.length, 3); + assert.equal(counters.flattenedListenersCalls, 2); + assert.equal(counters.parentListenersUsed, 1); + + matching = m.matchingListeners('hello'); + + assert.equal(matching.length, 3); + assert.equal(counters.flattenedListenersCalls, 3); + assert.equal(counters.parentListenersUsed, 1); + } + + ['@test parent cache invalidation'](assert) { + counters.flattenedListenersCalls = 0; + counters.parentListenersUsed = 0; + counters.listenersInherited = 0; + + class Class {} + let classMeta = meta(Class.prototype); + classMeta.addToListeners('hello', null, 'm', 0); + + let instance = new Class(); + let m = meta(instance); + + let matching = m.matchingListeners('hello'); + + assert.equal(matching.length, 3); + assert.equal(counters.flattenedListenersCalls, 2); + assert.equal(counters.parentListenersUsed, 1); + assert.equal(counters.listenersInherited, 0); + + m.addToListeners('hello', null, 'm2'); + + matching = m.matchingListeners('hello'); + + assert.equal(matching.length, 6); + assert.equal(counters.flattenedListenersCalls, 4); + assert.equal(counters.parentListenersUsed, 1); + assert.equal(counters.listenersInherited, 1); + } + + ['@test reopen after flatten'](assert) { + // Ensure counter is zeroed + counters.reopensAfterFlatten = 0; + + class Class1 {} + let class1Meta = meta(Class1.prototype); + class1Meta.addToListeners('hello', null, 'm', 0); + + let instance1 = new Class1(); + let m1 = meta(instance1); + + class Class2 {} + let class2Meta = meta(Class2.prototype); + class2Meta.addToListeners('hello', null, 'm', 0); + + let instance2 = new Class2(); + let m2 = meta(instance2); + + m1.matchingListeners('hello'); + m2.matchingListeners('hello'); + + assert.equal(counters.reopensAfterFlatten, 0, 'no reopen calls yet'); + + m1.addToListeners('world', null, 'm', 0); + m2.addToListeners('world', null, 'm', 0); + m1.matchingListeners('world'); + m2.matchingListeners('world'); + + assert.equal(counters.reopensAfterFlatten, 1, 'reopen calls after invalidating parent cache'); + + m1.addToListeners('world', null, 'm', 0); + m2.addToListeners('world', null, 'm', 0); + m1.matchingListeners('world'); + m2.matchingListeners('world'); + + assert.equal(counters.reopensAfterFlatten, 1, 'no reopen calls after mutating leaf nodes'); + + class1Meta.removeFromListeners('hello', null, 'm'); + class2Meta.removeFromListeners('hello', null, 'm'); + m1.matchingListeners('hello'); + m2.matchingListeners('hello'); + + assert.equal(counters.reopensAfterFlatten, 2, 'one reopen call after mutating parents'); + + class1Meta.addToListeners('hello', null, 'm', 0); + m1.matchingListeners('hello'); + class2Meta.addToListeners('hello', null, 'm', 0); + m2.matchingListeners('hello'); + + assert.equal( + counters.reopensAfterFlatten, + 3, + 'one reopen call after mutating parents and flattening out of order' + ); + } + } +);
true
Other
emberjs
ember.js
506b8841888190de9cc35814d16a8d3098cfb20e.json
add more counters, fix performance issues
packages/@ember/-internals/meta/tests/meta_test.js
@@ -1,5 +1,5 @@ import { AbstractTestCase, moduleFor } from 'internal-test-helpers'; -import { meta, counters } from '..'; +import { meta } from '..'; moduleFor( 'Ember.meta', @@ -33,102 +33,6 @@ moduleFor( } } - ['@test meta.listeners basics'](assert) { - let t = {}; - let m = meta({}); - m.addToListeners('hello', t, 'm', 0); - let matching = m.matchingListeners('hello'); - assert.equal(matching.length, 3); - assert.equal(matching[0], t); - m.removeFromListeners('hello', t, 'm'); - matching = m.matchingListeners('hello'); - assert.equal(matching, undefined); - } - - ['@test meta.listeners inheritance'](assert) { - let target = {}; - let parent = {}; - let parentMeta = meta(parent); - parentMeta.addToListeners('hello', target, 'm', 0); - - let child = Object.create(parent); - let m = meta(child); - - let matching = m.matchingListeners('hello'); - assert.equal(matching.length, 3); - assert.equal(matching[0], target); - assert.equal(matching[1], 'm'); - assert.equal(matching[2], 0); - m.removeFromListeners('hello', target, 'm'); - matching = m.matchingListeners('hello'); - assert.equal(matching, undefined); - matching = parentMeta.matchingListeners('hello'); - assert.equal(matching.length, 3); - } - - ['@test meta.listeners deduplication'](assert) { - let t = {}; - let m = meta({}); - m.addToListeners('hello', t, 'm', 0); - m.addToListeners('hello', t, 'm', 0); - let matching = m.matchingListeners('hello'); - assert.equal(matching.length, 3); - assert.equal(matching[0], t); - } - - ['@test meta.listeners reopen after flatten'](assert) { - // Ensure counter is zeroed - counters.reopensAfterFlatten = 0; - - class Class1 {} - let class1Meta = meta(Class1.prototype); - class1Meta.addToListeners('hello', null, 'm', 0); - - let instance1 = new Class1(); - let m1 = meta(instance1); - - class Class2 {} - let class2Meta = meta(Class2.prototype); - class2Meta.addToListeners('hello', null, 'm', 0); - - let instance2 = new Class2(); - let m2 = meta(instance2); - - m1.matchingListeners('hello'); - m2.matchingListeners('hello'); - - assert.equal(counters.reopensAfterFlatten, 0, 'no reopen calls yet'); - - m1.addToListeners('world', null, 'm', 0); - m2.addToListeners('world', null, 'm', 0); - m1.matchingListeners('world'); - m2.matchingListeners('world'); - - assert.equal( - counters.reopensAfterFlatten, - 0, - 'no reopen calls after mutating leaf listeners' - ); - - class1Meta.removeFromListeners('hello', null, 'm'); - class2Meta.removeFromListeners('hello', null, 'm'); - m1.matchingListeners('hello'); - m2.matchingListeners('hello'); - - assert.equal(counters.reopensAfterFlatten, 1, 'one reopen call after mutating parents'); - - class1Meta.addToListeners('hello', null, 'm', 0); - m1.matchingListeners('hello'); - class2Meta.addToListeners('hello', null, 'm', 0); - m2.matchingListeners('hello'); - - assert.equal( - counters.reopensAfterFlatten, - 2, - 'one reopen call after mutating parents and flattening out of order' - ); - } - ['@test meta.writeWatching issues useful error after destroy']() { let target = { toString() {
true
Other
emberjs
ember.js
62433af49fbaed42507f758bd4e0b37885caf339.json
Fix Component#layout example
packages/@ember/-internals/glimmer/lib/component.ts
@@ -454,7 +454,15 @@ export const BOUNDS = symbol('BOUNDS'); }); ``` - The above will result in the following HTML output: + If you call the `person-profile` component like so: + + ``` + {{#person-profile}} + <h2>Chief Basket Weaver</h2> + <h3>Fisherman Industries</h3> + {{/person-profile}} + + It will result in the following HTML output: ```html <h1>Person's Title</h1>
false
Other
emberjs
ember.js
9343f34813538dc20f35f139c0aa5ff9f68df483.json
add simple test for missing yuidocs
bin/yuidoc-tests.js
@@ -0,0 +1,51 @@ +'use strict'; + +/** + * This tests whether there is a change in the number of modules, classes, or properties that yuidoc sees. It is not a guarantee that all documentation will show up in the Ember API docs app, but it checks for major regressions. + */ + +const fs = require('fs'); +const docData = JSON.parse(fs.readFileSync('./docs/data.json', 'utf8')); + +const expectedCounts = [ + { + category: 'files', + count: 180, + }, + { + category: 'modules', + count: 21, + }, + { + category: 'classes', + count: 109, + }, + { + category: 'classitems', + count: 811, + }, +]; + +const failedTestMessage = function(expectedCount, actualCount, category) { + let report = `${expectedCount} ${category} documentation entries expected, ${actualCount} present. \n`; + if (expectedCount < actualCount) { + return ( + report + + 'If you have added new features, please increment the expectedCounts in the yuidoc-tests.js and confirm that any public properties are marked both @public and @static to be included in the Ember API Docs viewer.' + ); + } else { + return ( + report + + 'Documentation is missing, incorrectly formatted, or in a directory that is not watched by yuidoc. All files containing documentation must have a yuidoc class declaration.' + ); + } +}; + +expectedCounts.forEach(function(expected) { + QUnit.test(expected.category, function(assert) { + const docsToCount = docData[expected.category]; + const actualCount = Object.keys(docsToCount).length; + let message = failedTestMessage(expected.count, actualCount, expected.category); + assert.ok(actualCount === expected.count, message); + }); +});
true
Other
emberjs
ember.js
9343f34813538dc20f35f139c0aa5ff9f68df483.json
add simple test for missing yuidocs
package.json
@@ -46,7 +46,7 @@ "test:node": "qunit tests/**/*-test.js", "test:browserstack": "node bin/run-browserstack-tests.js", "test:testem": "testem -f testem.dist.js", - "test:docs": "ember ember-cli-yuidoc && node bin/yuidoc-tests.js" + "test:docs": "qunit bin/yuidoc-tests.js" }, "dependencies": { "broccoli-funnel": "^2.0.1",
true
Other
emberjs
ember.js
6416d56ff3c64a05bead27fd348ff187ceb52a43.json
add command to run yuidoc tests
package.json
@@ -45,7 +45,8 @@ "test:blueprints-debugger": "node --inspect-brk node-tests/nodetest-runner.js", "test:node": "qunit tests/**/*-test.js", "test:browserstack": "node bin/run-browserstack-tests.js", - "test:testem": "testem -f testem.dist.js" + "test:testem": "testem -f testem.dist.js", + "test:docs": "ember ember-cli-yuidoc && node bin/yuidoc-tests.js" }, "dependencies": { "broccoli-funnel": "^2.0.1",
false
Other
emberjs
ember.js
1c04ff5a4e18a06035620f2e1eb73effa55ae660.json
Add return type to hash helper
packages/@ember/-internals/glimmer/lib/helpers/hash.ts
@@ -1,4 +1,6 @@ +import { PathReference } from '@glimmer/reference'; import { Arguments, VM } from '@glimmer/runtime'; +import { Dict, Opaque } from '@glimmer/util'; /** @module ember @@ -43,6 +45,6 @@ import { Arguments, VM } from '@glimmer/runtime'; @public */ -export default function(_vm: VM, args: Arguments) { +export default function(_vm: VM, args: Arguments): PathReference<Dict<Opaque>> { return args.named.capture(); }
false
Other
emberjs
ember.js
239809aa477a46c45607cad84678a47a12c80b29.json
Add v3.6.0-beta.1 to CHANGELOG [ci skip] (cherry picked from commit ae33dc752ff30e4cb646e072f3fff5a6dc440651)
CHANGELOG.md
@@ -1,5 +1,13 @@ # Ember Changelog +### v3.6.0-beta.1 (October 8, 2018) + +- [#16956](https://github.com/emberjs/ember.js/pull/16956) [DEPRECATION] Deprecate Ember.merge +- [#16795](https://github.com/emberjs/ember.js/pull/16795) [FEATURE] Native Class Constructor Update (see [emberjs/rfcs#337](https://github.com/emberjs/rfcs/blob/master/text/0337-native-class-constructor-update.md) +- [#16865](https://github.com/emberjs/ember.js/pull/16865) / [#16899](https://github.com/emberjs/ember.js/pull/16899) / [#16914](https://github.com/emberjs/ember.js/pull/16914) / [#16897](https://github.com/emberjs/ember.js/pull/16897) / [#16913](https://github.com/emberjs/ember.js/pull/16913) / [#16894](https://github.com/emberjs/ember.js/pull/16894) / [#16896](https://github.com/emberjs/ember.js/pull/16896) [BUGFIX] Support RFC 232 and RFC 268 style tests with Mocha blueprints +- [#17025](https://github.com/emberjs/ember.js/pull/17025) / [#17034](https://github.com/emberjs/ember.js/pull/17034) / [#17036](https://github.com/emberjs/ember.js/pull/17036) / [#17038](https://github.com/emberjs/ember.js/pull/17038) / [#17040](https://github.com/emberjs/ember.js/pull/17040) / [#17041](https://github.com/emberjs/ember.js/pull/17041) / [#17061](https://github.com/emberjs/ember.js/pull/17061) [FEATURE] Final stage of the router service RFC (see [emberjs/rfcs#95](https://github.com/emberjs/rfcs/blob/master/text/0095-router-service.md) +- [#17051](https://github.com/emberjs/ember.js/pull/17051) Update glimmer-vm packages to 0.36.4 + ### v3.5.0 (October 8, 2018) - [#16978](https://github.com/emberjs/ember.js/pull/16978) [BUGFIX] Properly teardown alias @@ -24,7 +32,7 @@ ### v3.4.1 (September 10, 2018) -- [#16933](https://github.com/emberjs/ember.js/pull/16933) [BUGFIX] Update glimmer-vm packages to 0.38.8 +- [#16933](https://github.com/emberjs/ember.js/pull/16933) [BUGFIX] Update glimmer-vm packages to 0.35.8 ### v3.4.0 (August 27, 2018)
false
Other
emberjs
ember.js
1dfe789b3d62b47d93602c619e123db7cd7e49d3.json
Add v3.5.0 to CHANGELOG [ci skip] (cherry picked from commit cae13d41674d4950766ba25f458c349ccfb0de1f)
CHANGELOG.md
@@ -1,23 +1,9 @@ # Ember Changelog -### v3.5.0-beta.4 (October 1, 2018) - -- [#17003](https://github.com/emberjs/ember.js/pull/17003) / [#17013](https://github.com/emberjs/ember.js/pull/17013) [BUGFIX] Fix rendering of empty content with `{{{...}}}` or `{{...}}` with `htmlSafe('')` - -### v3.5.0-beta.3 (September 24, 2018) +### v3.5.0 (October 8, 2018) - [#16978](https://github.com/emberjs/ember.js/pull/16978) [BUGFIX] Properly teardown alias -- [#16999](https://github.com/emberjs/ember.js/pull/16999) [BUGFIX] Fix mouseEnter/Leave event delegation w/o jQuery - -### v3.5.0-beta.2 (September 10, 2018) - -- [#16933](https://github.com/emberjs/ember.js/pull/16933) [BUGFIX] Update glimmer-vm packages to 0.38.8 -- [#16860](https://github.com/emberjs/ember.js/pull/16860) [BUGFIX] Clear chains in ProxyMixin when destroyed - -### v3.5.0-beta.1 (August 28, 2018) - - [#16877](https://github.com/emberjs/ember.js/pull/16877) [CLEANUP] Allow routes to be named "array" and "object" -- [#16907](https://github.com/emberjs/ember.js/pull/16907) Upgrade to TypeScript 3.0 ### v3.4.5 (October 4, 2018)
false
Other
emberjs
ember.js
b5b50b031eab48661bc8875bf54c9d9882690f3a.json
reuse meta in `property_set`
packages/@ember/-internals/metal/lib/property_get.ts
@@ -96,7 +96,6 @@ export function get(obj: object, keyName: string): any { let isFunction = type === 'function'; let isObjectLike = isObject || isFunction; - let descriptor; let value: any; if (isObjectLike) { @@ -105,7 +104,7 @@ export function get(obj: object, keyName: string): any { if (tracker) tracker.add(tagForProperty(obj, keyName)); } - descriptor = descriptorFor(obj, keyName); + let descriptor = descriptorFor(obj, keyName); if (descriptor !== undefined) { return descriptor.get(obj, keyName); }
true
Other
emberjs
ember.js
b5b50b031eab48661bc8875bf54c9d9882690f3a.json
reuse meta in `property_set`
packages/@ember/-internals/metal/lib/property_set.ts
@@ -76,11 +76,11 @@ export function set(obj: object, keyName: string, value: any, tolerant?: boolean return setPath(obj, keyName, value, tolerant); } - let possibleDesc = descriptorFor(obj, keyName); + let meta = peekMeta(obj); + let descriptor = descriptorFor(obj, keyName, meta); - if (possibleDesc !== undefined) { - /* computed property */ - possibleDesc.set(obj, keyName, value); + if (descriptor !== undefined) { + descriptor.set(obj, keyName, value); return value; } @@ -100,8 +100,6 @@ export function set(obj: object, keyName: string, value: any, tolerant?: boolean /* unknown property */ (obj as ExtendedObject).setUnknownProperty!(keyName, value); } else { - let meta = peekMeta(obj); - if (DEBUG) { setWithMandatorySetter<any, any>(meta, obj, keyName, value); } else {
true
Other
emberjs
ember.js
94b9fccf11e1c87476cfe7899a55bc9c00c14194.json
Add urls for router related deprecations
packages/@ember/-internals/routing/lib/system/route.ts
@@ -2537,6 +2537,7 @@ if (EMBER_ROUTING_ROUTER_SERVICE && ROUTER_EVENTS) { { id: 'deprecate-router-events', until: '4.0.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_deprecate-router-events', } ); } @@ -2548,6 +2549,7 @@ if (EMBER_ROUTING_ROUTER_SERVICE && ROUTER_EVENTS) { { id: 'deprecate-router-events', until: '4.0.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_deprecate-router-events', } ); }
true
Other
emberjs
ember.js
94b9fccf11e1c87476cfe7899a55bc9c00c14194.json
Add urls for router related deprecations
packages/@ember/-internals/routing/lib/system/router.ts
@@ -86,6 +86,7 @@ if (TRANSITION_STATE) { { id: 'transition-state', until: '3.9.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_transition-state', } ); } @@ -102,6 +103,7 @@ if (TRANSITION_STATE) { { id: 'transition-state', until: '3.9.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_transition-state', } ); } @@ -118,6 +120,7 @@ if (TRANSITION_STATE) { { id: 'transition-state', until: '3.9.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_transition-state', } ); } @@ -136,6 +139,7 @@ if (HANDLER_INFOS) { { id: 'remove-handler-infos', until: '3.9.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_remove-handler-infos', } ); } @@ -150,6 +154,7 @@ if (HANDLER_INFOS) { { id: 'remove-handler-infos', until: '3.9.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_remove-handler-infos', } ); } @@ -166,6 +171,7 @@ if (HANDLER_INFOS) { { id: 'remove-handler-infos', until: '3.9.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_remove-handler-infos', } ); } @@ -182,6 +188,7 @@ if (HANDLER_INFOS) { { id: 'remove-handler-infos', until: '3.9.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_remove-handler-infos', } ); } @@ -198,6 +205,7 @@ if (HANDLER_INFOS) { { id: 'remove-handler-infos', until: '3.9.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_remove-handler-infos', } ); } @@ -213,6 +221,7 @@ if (HANDLER_INFOS) { { id: 'remove-handler-infos', until: '3.9.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_remove-handler-infos', } ); } @@ -345,6 +354,7 @@ class EmberRouter extends EmberObject { { id: 'deprecate-router-events', until: '4.0.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_deprecate-router-events', } ); } @@ -365,6 +375,7 @@ class EmberRouter extends EmberObject { { id: 'deprecate-router-events', until: '4.0.0', + url: 'https://emberjs.com/deprecations/v3.x#toc_deprecate-router-events', } ); }
true
Other
emberjs
ember.js
8df967b9c9e2a74efb2bb72deff87eb162c4a9b0.json
Fix typo on line 75 an -> and (cherry picked from commit 4eaf54125da8c9d20c79b2c747846990f64ab2d4)
packages/@ember/-internals/glimmer/lib/helper.ts
@@ -72,7 +72,7 @@ export function isSimpleHelper(helper: SimpleHelper | HelperInstance): helper is Each time the input to a helper changes, the `compute` function will be called again. - As instances, these helpers also have access to the container an will accept + As instances, these helpers also have access to the container and will accept injected dependencies. Additionally, class helpers can call `recompute` to force a new computation.
false
Other
emberjs
ember.js
ac740b817f6493b3694b9d1f0d17514aa9e71d3e.json
Remove testem import from tests/index.html
tests/index.html
@@ -10,7 +10,6 @@ } </style> <script src="../qunit/qunit.js"></script> - <script src="/testem.js"></script> <script type="text/javascript"> window.loadScript = function(url) {
false
Other
emberjs
ember.js
716f194164840d524f82c36ff810ca574830298a.json
Add v3.4.5 to CHANGELOG [ci skip] (cherry picked from commit 82b0b2dfe95e59025246148856624af327085f5a)
CHANGELOG.md
@@ -19,6 +19,10 @@ - [#16877](https://github.com/emberjs/ember.js/pull/16877) [CLEANUP] Allow routes to be named "array" and "object" - [#16907](https://github.com/emberjs/ember.js/pull/16907) Upgrade to TypeScript 3.0 +### v3.4.5 (October 4, 2018) + +- [#17029](https://github.com/emberjs/ember.js/pull/17029) [BUGFIX] Update backburner.js to 2.3.1. + ### v3.4.4 (September 27, 2018) - [#17013](https://github.com/emberjs/ember.js/pull/17013) [BUGFIX] Fix rendering of empty content with `{{{...}}}` or `{{...}}` with `htmlSafe('')` in IE11
false
Other
emberjs
ember.js
0f95c777fe507940f2922e6d256125677d5bb882.json
Remove old Router Service FF This removes the FF around all the router service features that were go'd earlier this year. It also reuses the same flag to guard the new features that we are adding.
packages/@ember/application/lib/application.js
@@ -30,7 +30,6 @@ import Engine from '@ember/engine'; import { privatize as P } from '@ember/-internals/container'; import { setupApplicationRegistry } from '@ember/-internals/glimmer'; import { RouterService } from '@ember/-internals/routing'; -import { EMBER_ROUTING_ROUTER_SERVICE } from '@ember/canary-features'; let librariesRegistered = false; @@ -1124,10 +1123,8 @@ function commonSetupRegistry(registry) { }, }); - if (EMBER_ROUTING_ROUTER_SERVICE) { - registry.register('service:router', RouterService); - registry.injection('service:router', '_router', 'router:main'); - } + registry.register('service:router', RouterService); + registry.injection('service:router', '_router', 'router:main'); } function registerLibraries() {
true
Other
emberjs
ember.js
0f95c777fe507940f2922e6d256125677d5bb882.json
Remove old Router Service FF This removes the FF around all the router service features that were go'd earlier this year. It also reuses the same flag to guard the new features that we are adding.
packages/@ember/canary-features/index.ts
@@ -10,7 +10,7 @@ export const DEFAULT_FEATURES = { EMBER_LIBRARIES_ISREGISTERED: null, EMBER_IMPROVED_INSTRUMENTATION: null, EMBER_GLIMMER_NAMED_ARGUMENTS: true, - EMBER_ROUTING_ROUTER_SERVICE: true, + EMBER_ROUTING_ROUTER_SERVICE: null, EMBER_ENGINES_MOUNT_PARAMS: true, EMBER_MODULE_UNIFICATION: null, GLIMMER_CUSTOM_COMPONENT_MANAGER: true,
true
Other
emberjs
ember.js
0f95c777fe507940f2922e6d256125677d5bb882.json
Remove old Router Service FF This removes the FF around all the router service features that were go'd earlier this year. It also reuses the same flag to guard the new features that we are adding.
packages/ember/tests/routing/decoupled_basic_test.js
@@ -12,6 +12,7 @@ import { getTextOf } from 'internal-test-helpers'; import { Component } from '@ember/-internals/glimmer'; import Engine from '@ember/engine'; import { InternalTransition as Transition } from 'router_js'; +import { EMBER_ROUTING_ROUTER_SERVICE } from '@ember/canary-features'; let originalConsoleError; @@ -2750,22 +2751,37 @@ moduleFor( ['@test Router `willTransition` hook passes in cancellable transition'](assert) { // Should hit willTransition 3 times, once for the initial route, and then 2 more times // for the two handleURL calls below - assert.expect(5); + if (EMBER_ROUTING_ROUTER_SERVICE) { + assert.expect(7); + + this.router.reopen({ + init() { + this._super(...arguments); + this.on('routeWillChange', transition => { + assert.ok(true, 'routeWillChange was called'); + if (transition.intent && transition.intent.url !== '/') { + transition.abort(); + } + }); + }, + }); + } else { + assert.expect(5); + this.router.reopen({ + willTransition(_, _2, transition) { + assert.ok(true, 'willTransition was called'); + if (transition.intent.url !== '/') { + transition.abort(); + } + }, + }); + } this.router.map(function() { this.route('nork'); this.route('about'); }); - this.router.reopen({ - willTransition(_, _2, transition) { - assert.ok(true, 'willTransition was called'); - if (transition.intent.url !== '/') { - transition.abort(); - } - }, - }); - this.add( 'route:loading', Route.extend({ @@ -2922,13 +2938,17 @@ moduleFor( this.router.map(function() { this.route('nork'); }); - - this.router.reopen({ - didTransition() { - this._super(...arguments); - assert.ok(true, 'reopened didTransition was called'); - }, - }); + if (EMBER_ROUTING_ROUTER_SERVICE) { + assert.ok(true, 'no longer a valid test'); + return; + } else { + this.router.reopen({ + didTransition() { + this._super(...arguments); + assert.ok(true, 'reopened didTransition was called'); + }, + }); + } return this.visit('/'); }
true
Other
emberjs
ember.js
0f95c777fe507940f2922e6d256125677d5bb882.json
Remove old Router Service FF This removes the FF around all the router service features that were go'd earlier this year. It also reuses the same flag to guard the new features that we are adding.
packages/ember/tests/routing/deprecated_handler_infos_test.js
@@ -60,9 +60,11 @@ if (EMBER_ROUTING_ROUTER_SERVICE) { '@test handlerInfos are deprecated and associated private apis'(assert) { let done = assert.async(); - return this.visit('/parent').then(() => { - done(); - }); + expectDeprecation(() => { + return this.visit('/parent').then(() => { + done(); + }); + }, /You attempted to override the \"(willTransition|didTransition)\" method which is deprecated. Please inject the router service and listen to the \"(routeWillChange|routeDidChange)\" event\./); } } );
true
Other
emberjs
ember.js
0f95c777fe507940f2922e6d256125677d5bb882.json
Remove old Router Service FF This removes the FF around all the router service features that were go'd earlier this year. It also reuses the same flag to guard the new features that we are adding.
packages/ember/tests/routing/router_service_test/basic_test.js
@@ -2,94 +2,90 @@ import { Route, NoneLocation } from '@ember/-internals/routing'; import { set } from '@ember/-internals/metal'; import { RouterTestCase, moduleFor } from 'internal-test-helpers'; -import { EMBER_ROUTING_ROUTER_SERVICE } from '@ember/canary-features'; +moduleFor( + 'Router Service - main', + class extends RouterTestCase { + ['@test RouterService#currentRouteName is correctly set for top level route'](assert) { + assert.expect(1); + + return this.visit('/').then(() => { + assert.equal(this.routerService.get('currentRouteName'), 'parent.index'); + }); + } + + ['@test RouterService#currentRouteName is correctly set for child route'](assert) { + assert.expect(1); + + return this.visit('/child').then(() => { + assert.equal(this.routerService.get('currentRouteName'), 'parent.child'); + }); + } -if (EMBER_ROUTING_ROUTER_SERVICE) { - moduleFor( - 'Router Service - main', - class extends RouterTestCase { - ['@test RouterService#currentRouteName is correctly set for top level route'](assert) { - assert.expect(1); + ['@test RouterService#currentRouteName is correctly set after transition'](assert) { + assert.expect(1); - return this.visit('/').then(() => { - assert.equal(this.routerService.get('currentRouteName'), 'parent.index'); + return this.visit('/child') + .then(() => { + return this.routerService.transitionTo('parent.sister'); + }) + .then(() => { + assert.equal(this.routerService.get('currentRouteName'), 'parent.sister'); }); - } + } - ['@test RouterService#currentRouteName is correctly set for child route'](assert) { - assert.expect(1); + ['@test RouterService#currentRouteName is correctly set on each transition'](assert) { + assert.expect(3); - return this.visit('/child').then(() => { + return this.visit('/child') + .then(() => { assert.equal(this.routerService.get('currentRouteName'), 'parent.child'); - }); - } - - ['@test RouterService#currentRouteName is correctly set after transition'](assert) { - assert.expect(1); - - return this.visit('/child') - .then(() => { - return this.routerService.transitionTo('parent.sister'); - }) - .then(() => { - assert.equal(this.routerService.get('currentRouteName'), 'parent.sister'); - }); - } - - ['@test RouterService#currentRouteName is correctly set on each transition'](assert) { - assert.expect(3); - - return this.visit('/child') - .then(() => { - assert.equal(this.routerService.get('currentRouteName'), 'parent.child'); - - return this.visit('/sister'); - }) - .then(() => { - assert.equal(this.routerService.get('currentRouteName'), 'parent.sister'); - - return this.visit('/brother'); - }) - .then(() => { - assert.equal(this.routerService.get('currentRouteName'), 'parent.brother'); - }); - } - - ['@test RouterService#rootURL is correctly set to the default value'](assert) { - assert.expect(1); - - return this.visit('/').then(() => { - assert.equal(this.routerService.get('rootURL'), '/'); - }); - } - - ['@test RouterService#rootURL is correctly set to a custom value'](assert) { - assert.expect(1); - - this.add( - 'route:parent.index', - Route.extend({ - init() { - this._super(); - set(this._router, 'rootURL', '/homepage'); - }, - }) - ); - - return this.visit('/').then(() => { - assert.equal(this.routerService.get('rootURL'), '/homepage'); - }); - } - ['@test RouterService#location is correctly delegated from router:main'](assert) { - assert.expect(2); + return this.visit('/sister'); + }) + .then(() => { + assert.equal(this.routerService.get('currentRouteName'), 'parent.sister'); - return this.visit('/').then(() => { - let location = this.routerService.get('location'); - assert.ok(location); - assert.ok(location instanceof NoneLocation); + return this.visit('/brother'); + }) + .then(() => { + assert.equal(this.routerService.get('currentRouteName'), 'parent.brother'); }); - } } - ); -} + + ['@test RouterService#rootURL is correctly set to the default value'](assert) { + assert.expect(1); + + return this.visit('/').then(() => { + assert.equal(this.routerService.get('rootURL'), '/'); + }); + } + + ['@test RouterService#rootURL is correctly set to a custom value'](assert) { + assert.expect(1); + + this.add( + 'route:parent.index', + Route.extend({ + init() { + this._super(); + set(this._router, 'rootURL', '/homepage'); + }, + }) + ); + + return this.visit('/').then(() => { + assert.equal(this.routerService.get('rootURL'), '/homepage'); + }); + } + + ['@test RouterService#location is correctly delegated from router:main'](assert) { + assert.expect(2); + + return this.visit('/').then(() => { + let location = this.routerService.get('location'); + assert.ok(location); + assert.ok(location instanceof NoneLocation); + }); + } + } +);
true
Other
emberjs
ember.js
0f95c777fe507940f2922e6d256125677d5bb882.json
Remove old Router Service FF This removes the FF around all the router service features that were go'd earlier this year. It also reuses the same flag to guard the new features that we are adding.
packages/ember/tests/routing/router_service_test/currenturl_lifecycle_test.js
@@ -5,145 +5,141 @@ import { Route } from '@ember/-internals/routing'; import { get } from '@ember/-internals/metal'; import { RouterTestCase, moduleFor } from 'internal-test-helpers'; -import { EMBER_ROUTING_ROUTER_SERVICE } from '@ember/canary-features'; - -if (EMBER_ROUTING_ROUTER_SERVICE) { - let results = []; - let ROUTE_NAMES = ['index', 'child', 'sister', 'brother']; - - let InstrumentedRoute = Route.extend({ - routerService: injectService('router'), - - beforeModel() { - let service = get(this, 'routerService'); - results.push([service.get('currentRouteName'), 'beforeModel', service.get('currentURL')]); - }, - - model() { - let service = get(this, 'routerService'); - results.push([service.get('currentRouteName'), 'model', service.get('currentURL')]); - }, - - afterModel() { - let service = get(this, 'routerService'); - results.push([service.get('currentRouteName'), 'afterModel', service.get('currentURL')]); - }, - }); - - moduleFor( - 'Router Service - currentURL', - class extends RouterTestCase { - constructor() { - super(...arguments); - - results = []; - - ROUTE_NAMES.forEach(name => { - let routeName = `parent.${name}`; - this.add(`route:${routeName}`, InstrumentedRoute.extend()); - this.addTemplate(routeName, '{{current-url}}'); - }); +let results = []; +let ROUTE_NAMES = ['index', 'child', 'sister', 'brother']; + +let InstrumentedRoute = Route.extend({ + routerService: injectService('router'), + + beforeModel() { + let service = get(this, 'routerService'); + results.push([service.get('currentRouteName'), 'beforeModel', service.get('currentURL')]); + }, + + model() { + let service = get(this, 'routerService'); + results.push([service.get('currentRouteName'), 'model', service.get('currentURL')]); + }, + + afterModel() { + let service = get(this, 'routerService'); + results.push([service.get('currentRouteName'), 'afterModel', service.get('currentURL')]); + }, +}); + +moduleFor( + 'Router Service - currentURL', + class extends RouterTestCase { + constructor() { + super(...arguments); + + results = []; + + ROUTE_NAMES.forEach(name => { + let routeName = `parent.${name}`; + this.add(`route:${routeName}`, InstrumentedRoute.extend()); + this.addTemplate(routeName, '{{current-url}}'); + }); + + this.addComponent('current-url', { + ComponentClass: Component.extend({ + routerService: injectService('router'), + currentURL: readOnly('routerService.currentURL'), + }), + template: '{{currentURL}}', + }); + } - this.addComponent('current-url', { - ComponentClass: Component.extend({ - routerService: injectService('router'), - currentURL: readOnly('routerService.currentURL'), - }), - template: '{{currentURL}}', - }); - } + ['@test RouterService#currentURL is correctly set for top level route'](assert) { + assert.expect(1); + + return this.visit('/').then(() => { + assert.equal(this.routerService.get('currentURL'), '/'); + }); + } - ['@test RouterService#currentURL is correctly set for top level route'](assert) { - assert.expect(1); + ['@test RouterService#currentURL is correctly set for child route'](assert) { + assert.expect(1); - return this.visit('/').then(() => { - assert.equal(this.routerService.get('currentURL'), '/'); + return this.visit('/child').then(() => { + assert.equal(this.routerService.get('currentURL'), '/child'); + }); + } + + ['@test RouterService#currentURL is correctly set after transition'](assert) { + assert.expect(1); + + return this.visit('/child') + .then(() => { + return this.routerService.transitionTo('parent.sister'); + }) + .then(() => { + assert.equal(this.routerService.get('currentURL'), '/sister'); }); - } + } - ['@test RouterService#currentURL is correctly set for child route'](assert) { - assert.expect(1); + ['@test RouterService#currentURL is correctly set on each transition'](assert) { + assert.expect(3); - return this.visit('/child').then(() => { + return this.visit('/child') + .then(() => { assert.equal(this.routerService.get('currentURL'), '/child'); + + return this.visit('/sister'); + }) + .then(() => { + assert.equal(this.routerService.get('currentURL'), '/sister'); + + return this.visit('/brother'); + }) + .then(() => { + assert.equal(this.routerService.get('currentURL'), '/brother'); + }); + } + + ['@test RouterService#currentURL is not set during lifecycle hooks'](assert) { + assert.expect(2); + + return this.visit('/') + .then(() => { + assert.deepEqual(results, [ + [null, 'beforeModel', null], + [null, 'model', null], + [null, 'afterModel', null], + ]); + + results = []; + + return this.visit('/child'); + }) + .then(() => { + assert.deepEqual(results, [ + ['parent.index', 'beforeModel', '/'], + ['parent.index', 'model', '/'], + ['parent.index', 'afterModel', '/'], + ]); + }); + } + + ['@test RouterService#currentURL is correctly set with component after consecutive visits']( + assert + ) { + assert.expect(3); + + return this.visit('/') + .then(() => { + this.assertText('/'); + + return this.visit('/child'); + }) + .then(() => { + this.assertText('/child'); + + return this.visit('/'); + }) + .then(() => { + this.assertText('/'); }); - } - - ['@test RouterService#currentURL is correctly set after transition'](assert) { - assert.expect(1); - - return this.visit('/child') - .then(() => { - return this.routerService.transitionTo('parent.sister'); - }) - .then(() => { - assert.equal(this.routerService.get('currentURL'), '/sister'); - }); - } - - ['@test RouterService#currentURL is correctly set on each transition'](assert) { - assert.expect(3); - - return this.visit('/child') - .then(() => { - assert.equal(this.routerService.get('currentURL'), '/child'); - - return this.visit('/sister'); - }) - .then(() => { - assert.equal(this.routerService.get('currentURL'), '/sister'); - - return this.visit('/brother'); - }) - .then(() => { - assert.equal(this.routerService.get('currentURL'), '/brother'); - }); - } - - ['@test RouterService#currentURL is not set during lifecycle hooks'](assert) { - assert.expect(2); - - return this.visit('/') - .then(() => { - assert.deepEqual(results, [ - [null, 'beforeModel', null], - [null, 'model', null], - [null, 'afterModel', null], - ]); - - results = []; - - return this.visit('/child'); - }) - .then(() => { - assert.deepEqual(results, [ - ['parent.index', 'beforeModel', '/'], - ['parent.index', 'model', '/'], - ['parent.index', 'afterModel', '/'], - ]); - }); - } - - ['@test RouterService#currentURL is correctly set with component after consecutive visits']( - assert - ) { - assert.expect(3); - - return this.visit('/') - .then(() => { - this.assertText('/'); - - return this.visit('/child'); - }) - .then(() => { - this.assertText('/child'); - - return this.visit('/'); - }) - .then(() => { - this.assertText('/'); - }); - } } - ); -} + } +);
true
Other
emberjs
ember.js
0f95c777fe507940f2922e6d256125677d5bb882.json
Remove old Router Service FF This removes the FF around all the router service features that were go'd earlier this year. It also reuses the same flag to guard the new features that we are adding.
packages/ember/tests/routing/router_service_test/isActive_test.js
@@ -1,113 +1,109 @@ import Controller from '@ember/controller'; import { RouterTestCase, moduleFor } from 'internal-test-helpers'; -import { EMBER_ROUTING_ROUTER_SERVICE } from '@ember/canary-features'; - -if (EMBER_ROUTING_ROUTER_SERVICE) { - moduleFor( - 'Router Service - isActive', - class extends RouterTestCase { - ['@test RouterService#isActive returns true for simple route'](assert) { - assert.expect(1); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.child'); - }) - .then(() => { - return this.routerService.transitionTo('parent.sister'); - }) - .then(() => { - assert.ok(this.routerService.isActive('parent.sister')); - }); - } - - ['@test RouterService#isActive returns true for simple route with dynamic segments'](assert) { - assert.expect(1); - - let dynamicModel = { id: 1 }; - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('dynamic', dynamicModel); - }) - .then(() => { - assert.ok(this.routerService.isActive('dynamic', dynamicModel)); - }); - } - - ['@test RouterService#isActive does not eagerly instantiate controller for query params']( - assert - ) { - assert.expect(1); - - let queryParams = this.buildQueryParams({ sort: 'ASC' }); - - this.add( - 'controller:parent.sister', - Controller.extend({ - queryParams: ['sort'], - sort: 'ASC', - - init() { - assert.ok(false, 'should never create'); - this._super(...arguments); - }, - }) - ); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.brother'); - }) - .then(() => { - assert.notOk(this.routerService.isActive('parent.sister', queryParams)); - }); - } - - ['@test RouterService#isActive is correct for simple route with basic query params'](assert) { - assert.expect(2); - - let queryParams = this.buildQueryParams({ sort: 'ASC' }); - - this.add( - 'controller:parent.child', - Controller.extend({ - queryParams: ['sort'], - sort: 'ASC', - }) - ); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.child', queryParams); - }) - .then(() => { - assert.ok(this.routerService.isActive('parent.child', queryParams)); - assert.notOk( - this.routerService.isActive('parent.child', this.buildQueryParams({ sort: 'DESC' })) - ); - }); - } - - ['@test RouterService#isActive for simple route with array as query params'](assert) { - assert.expect(1); - - let queryParams = this.buildQueryParams({ sort: ['ascending'] }); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.child', queryParams); - }) - .then(() => { - assert.notOk( - this.routerService.isActive( - 'parent.child', - this.buildQueryParams({ sort: 'descending' }) - ) - ); - }); - } +moduleFor( + 'Router Service - isActive', + class extends RouterTestCase { + ['@test RouterService#isActive returns true for simple route'](assert) { + assert.expect(1); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.child'); + }) + .then(() => { + return this.routerService.transitionTo('parent.sister'); + }) + .then(() => { + assert.ok(this.routerService.isActive('parent.sister')); + }); } - ); -} + + ['@test RouterService#isActive returns true for simple route with dynamic segments'](assert) { + assert.expect(1); + + let dynamicModel = { id: 1 }; + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('dynamic', dynamicModel); + }) + .then(() => { + assert.ok(this.routerService.isActive('dynamic', dynamicModel)); + }); + } + + ['@test RouterService#isActive does not eagerly instantiate controller for query params']( + assert + ) { + assert.expect(1); + + let queryParams = this.buildQueryParams({ sort: 'ASC' }); + + this.add( + 'controller:parent.sister', + Controller.extend({ + queryParams: ['sort'], + sort: 'ASC', + + init() { + assert.ok(false, 'should never create'); + this._super(...arguments); + }, + }) + ); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.brother'); + }) + .then(() => { + assert.notOk(this.routerService.isActive('parent.sister', queryParams)); + }); + } + + ['@test RouterService#isActive is correct for simple route with basic query params'](assert) { + assert.expect(2); + + let queryParams = this.buildQueryParams({ sort: 'ASC' }); + + this.add( + 'controller:parent.child', + Controller.extend({ + queryParams: ['sort'], + sort: 'ASC', + }) + ); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.child', queryParams); + }) + .then(() => { + assert.ok(this.routerService.isActive('parent.child', queryParams)); + assert.notOk( + this.routerService.isActive('parent.child', this.buildQueryParams({ sort: 'DESC' })) + ); + }); + } + + ['@test RouterService#isActive for simple route with array as query params'](assert) { + assert.expect(1); + + let queryParams = this.buildQueryParams({ sort: ['ascending'] }); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.child', queryParams); + }) + .then(() => { + assert.notOk( + this.routerService.isActive( + 'parent.child', + this.buildQueryParams({ sort: 'descending' }) + ) + ); + }); + } + } +);
true
Other
emberjs
ember.js
0f95c777fe507940f2922e6d256125677d5bb882.json
Remove old Router Service FF This removes the FF around all the router service features that were go'd earlier this year. It also reuses the same flag to guard the new features that we are adding.
packages/ember/tests/routing/router_service_test/replaceWith_test.js
@@ -3,142 +3,138 @@ import { RouterTestCase, moduleFor } from 'internal-test-helpers'; import { InternalTransition as Transition } from 'router_js'; import Controller from '@ember/controller'; -import { EMBER_ROUTING_ROUTER_SERVICE } from '@ember/canary-features'; - -if (EMBER_ROUTING_ROUTER_SERVICE) { - moduleFor( - 'Router Service - replaceWith', - class extends RouterTestCase { - constructor() { - super(...arguments); - - let testCase = this; - testCase.state = []; - - this.add( - 'location:test', - NoneLocation.extend({ - setURL(path) { - testCase.state.push(path); - this.set('path', path); - }, - - replaceURL(path) { - testCase.state.splice(testCase.state.length - 1, 1, path); - this.set('path', path); - }, - }) - ); - } - - get routerOptions() { - return { - location: 'test', - }; - } - - ['@test RouterService#replaceWith returns a Transition'](assert) { - assert.expect(1); - - let transition; - - return this.visit('/').then(() => { - transition = this.routerService.replaceWith('parent.child'); - - assert.ok(transition instanceof Transition); - - return transition; +moduleFor( + 'Router Service - replaceWith', + class extends RouterTestCase { + constructor() { + super(...arguments); + + let testCase = this; + testCase.state = []; + + this.add( + 'location:test', + NoneLocation.extend({ + setURL(path) { + testCase.state.push(path); + this.set('path', path); + }, + + replaceURL(path) { + testCase.state.splice(testCase.state.length - 1, 1, path); + this.set('path', path); + }, + }) + ); + } + + get routerOptions() { + return { + location: 'test', + }; + } + + ['@test RouterService#replaceWith returns a Transition'](assert) { + assert.expect(1); + + let transition; + + return this.visit('/').then(() => { + transition = this.routerService.replaceWith('parent.child'); + + assert.ok(transition instanceof Transition); + + return transition; + }); + } + + ['@test RouterService#replaceWith with basic route replaces location'](assert) { + assert.expect(1); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.child'); + }) + .then(() => { + return this.routerService.transitionTo('parent.sister'); + }) + .then(() => { + return this.routerService.replaceWith('parent.brother'); + }) + .then(() => { + assert.deepEqual(this.state, ['/', '/child', '/brother']); + }); + } + + ['@test RouterService#replaceWith with basic route using URLs replaces location'](assert) { + assert.expect(1); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('/child'); + }) + .then(() => { + return this.routerService.transitionTo('/sister'); + }) + .then(() => { + return this.routerService.replaceWith('/brother'); + }) + .then(() => { + assert.deepEqual(this.state, ['/', '/child', '/brother']); + }); + } + + ['@test RouterService#replaceWith transitioning back to previously visited route replaces location']( + assert + ) { + assert.expect(1); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.child'); + }) + .then(() => { + return this.routerService.transitionTo('parent.sister'); + }) + .then(() => { + return this.routerService.transitionTo('parent.brother'); + }) + .then(() => { + return this.routerService.replaceWith('parent.sister'); + }) + .then(() => { + assert.deepEqual(this.state, ['/', '/child', '/sister', '/sister']); + }); + } + + ['@test RouterService#replaceWith with basic query params does not remove query param defaults']( + assert + ) { + assert.expect(1); + + this.add( + 'controller:parent.child', + Controller.extend({ + queryParams: ['sort'], + sort: 'ASC', + }) + ); + + let queryParams = this.buildQueryParams({ sort: 'ASC' }); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.brother'); + }) + .then(() => { + return this.routerService.replaceWith('parent.sister'); + }) + .then(() => { + return this.routerService.replaceWith('parent.child', queryParams); + }) + .then(() => { + assert.deepEqual(this.state, ['/', '/child?sort=ASC']); }); - } - - ['@test RouterService#replaceWith with basic route replaces location'](assert) { - assert.expect(1); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.child'); - }) - .then(() => { - return this.routerService.transitionTo('parent.sister'); - }) - .then(() => { - return this.routerService.replaceWith('parent.brother'); - }) - .then(() => { - assert.deepEqual(this.state, ['/', '/child', '/brother']); - }); - } - - ['@test RouterService#replaceWith with basic route using URLs replaces location'](assert) { - assert.expect(1); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('/child'); - }) - .then(() => { - return this.routerService.transitionTo('/sister'); - }) - .then(() => { - return this.routerService.replaceWith('/brother'); - }) - .then(() => { - assert.deepEqual(this.state, ['/', '/child', '/brother']); - }); - } - - ['@test RouterService#replaceWith transitioning back to previously visited route replaces location']( - assert - ) { - assert.expect(1); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.child'); - }) - .then(() => { - return this.routerService.transitionTo('parent.sister'); - }) - .then(() => { - return this.routerService.transitionTo('parent.brother'); - }) - .then(() => { - return this.routerService.replaceWith('parent.sister'); - }) - .then(() => { - assert.deepEqual(this.state, ['/', '/child', '/sister', '/sister']); - }); - } - - ['@test RouterService#replaceWith with basic query params does not remove query param defaults']( - assert - ) { - assert.expect(1); - - this.add( - 'controller:parent.child', - Controller.extend({ - queryParams: ['sort'], - sort: 'ASC', - }) - ); - - let queryParams = this.buildQueryParams({ sort: 'ASC' }); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.brother'); - }) - .then(() => { - return this.routerService.replaceWith('parent.sister'); - }) - .then(() => { - return this.routerService.replaceWith('parent.child', queryParams); - }) - .then(() => { - assert.deepEqual(this.state, ['/', '/child?sort=ASC']); - }); - } } - ); -} + } +);
true
Other
emberjs
ember.js
0f95c777fe507940f2922e6d256125677d5bb882.json
Remove old Router Service FF This removes the FF around all the router service features that were go'd earlier this year. It also reuses the same flag to guard the new features that we are adding.
packages/ember/tests/routing/router_service_test/transitionTo_test.js
@@ -7,364 +7,360 @@ import { get } from '@ember/-internals/metal'; import { RouterTestCase, moduleFor } from 'internal-test-helpers'; import { InternalTransition as Transition } from 'router_js'; -import { EMBER_ROUTING_ROUTER_SERVICE } from '@ember/canary-features'; - -if (EMBER_ROUTING_ROUTER_SERVICE) { - moduleFor( - 'Router Service - transitionTo', - class extends RouterTestCase { - constructor() { - super(...arguments); - - let testCase = this; - testCase.state = []; - - this.add( - 'location:test', - NoneLocation.extend({ - setURL(path) { - testCase.state.push(path); - this.set('path', path); - }, +moduleFor( + 'Router Service - transitionTo', + class extends RouterTestCase { + constructor() { + super(...arguments); + + let testCase = this; + testCase.state = []; + + this.add( + 'location:test', + NoneLocation.extend({ + setURL(path) { + testCase.state.push(path); + this.set('path', path); + }, + + replaceURL(path) { + testCase.state.splice(testCase.state.length - 1, 1, path); + this.set('path', path); + }, + }) + ); + } - replaceURL(path) { - testCase.state.splice(testCase.state.length - 1, 1, path); - this.set('path', path); - }, - }) - ); - } + get routerOptions() { + return { + location: 'test', + }; + } - get routerOptions() { - return { - location: 'test', - }; - } + ['@test RouterService#transitionTo returns a Transition'](assert) { + assert.expect(1); - ['@test RouterService#transitionTo returns a Transition'](assert) { - assert.expect(1); + let transition; - let transition; + return this.visit('/').then(() => { + transition = this.routerService.transitionTo('parent.child'); - return this.visit('/').then(() => { - transition = this.routerService.transitionTo('parent.child'); + assert.ok(transition instanceof Transition); - assert.ok(transition instanceof Transition); + return transition; + }); + } - return transition; + ['@test RouterService#transitionTo with basic route updates location'](assert) { + assert.expect(1); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.child'); + }) + .then(() => { + return this.routerService.transitionTo('parent.sister'); + }) + .then(() => { + return this.routerService.transitionTo('parent.brother'); + }) + .then(() => { + assert.deepEqual(this.state, ['/', '/child', '/sister', '/brother']); }); - } - - ['@test RouterService#transitionTo with basic route updates location'](assert) { - assert.expect(1); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.child'); - }) - .then(() => { - return this.routerService.transitionTo('parent.sister'); - }) - .then(() => { - return this.routerService.transitionTo('parent.brother'); - }) - .then(() => { - assert.deepEqual(this.state, ['/', '/child', '/sister', '/brother']); - }); - } - - ['@test RouterService#transitionTo transitioning back to previously visited route updates location']( - assert - ) { - assert.expect(1); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.child'); - }) - .then(() => { - return this.routerService.transitionTo('parent.sister'); - }) - .then(() => { - return this.routerService.transitionTo('parent.brother'); - }) - .then(() => { - return this.routerService.transitionTo('parent.sister'); - }) - .then(() => { - assert.deepEqual(this.state, ['/', '/child', '/sister', '/brother', '/sister']); - }); - } - - ['@test RouterService#transitionTo with basic route'](assert) { - assert.expect(1); - - let componentInstance; - - this.addTemplate('parent.index', '{{foo-bar}}'); - - this.addComponent('foo-bar', { - ComponentClass: Component.extend({ - routerService: injectService('router'), - init() { - this._super(); - componentInstance = this; - }, - actions: { - transitionToSister() { - get(this, 'routerService').transitionTo('parent.sister'); - }, - }, - }), - template: `foo-bar`, - }); - - return this.visit('/').then(() => { - run(function() { - componentInstance.send('transitionToSister'); - }); + } - assert.equal(this.routerService.get('currentRouteName'), 'parent.sister'); + ['@test RouterService#transitionTo transitioning back to previously visited route updates location']( + assert + ) { + assert.expect(1); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.child'); + }) + .then(() => { + return this.routerService.transitionTo('parent.sister'); + }) + .then(() => { + return this.routerService.transitionTo('parent.brother'); + }) + .then(() => { + return this.routerService.transitionTo('parent.sister'); + }) + .then(() => { + assert.deepEqual(this.state, ['/', '/child', '/sister', '/brother', '/sister']); }); - } + } - ['@test RouterService#transitionTo with basic route using URL'](assert) { - assert.expect(1); + ['@test RouterService#transitionTo with basic route'](assert) { + assert.expect(1); - let componentInstance; + let componentInstance; - this.addTemplate('parent.index', '{{foo-bar}}'); + this.addTemplate('parent.index', '{{foo-bar}}'); - this.addComponent('foo-bar', { - ComponentClass: Component.extend({ - routerService: injectService('router'), - init() { - this._super(); - componentInstance = this; + this.addComponent('foo-bar', { + ComponentClass: Component.extend({ + routerService: injectService('router'), + init() { + this._super(); + componentInstance = this; + }, + actions: { + transitionToSister() { + get(this, 'routerService').transitionTo('parent.sister'); }, - actions: { - transitionToSister() { - get(this, 'routerService').transitionTo('/sister'); - }, - }, - }), - template: `foo-bar`, + }, + }), + template: `foo-bar`, + }); + + return this.visit('/').then(() => { + run(function() { + componentInstance.send('transitionToSister'); }); - return this.visit('/').then(() => { - run(function() { - componentInstance.send('transitionToSister'); - }); - - assert.equal(this.routerService.get('currentRouteName'), 'parent.sister'); - }); - } + assert.equal(this.routerService.get('currentRouteName'), 'parent.sister'); + }); + } - ['@test RouterService#transitionTo with dynamic segment'](assert) { - assert.expect(3); + ['@test RouterService#transitionTo with basic route using URL'](assert) { + assert.expect(1); - let componentInstance; - let dynamicModel = { id: 1, contents: 'much dynamicism' }; + let componentInstance; - this.addTemplate('parent.index', '{{foo-bar}}'); - this.addTemplate('dynamic', '{{model.contents}}'); + this.addTemplate('parent.index', '{{foo-bar}}'); - this.addComponent('foo-bar', { - ComponentClass: Component.extend({ - routerService: injectService('router'), - init() { - this._super(); - componentInstance = this; + this.addComponent('foo-bar', { + ComponentClass: Component.extend({ + routerService: injectService('router'), + init() { + this._super(); + componentInstance = this; + }, + actions: { + transitionToSister() { + get(this, 'routerService').transitionTo('/sister'); }, - actions: { - transitionToDynamic() { - get(this, 'routerService').transitionTo('dynamic', dynamicModel); - }, - }, - }), - template: `foo-bar`, + }, + }), + template: `foo-bar`, + }); + + return this.visit('/').then(() => { + run(function() { + componentInstance.send('transitionToSister'); }); - return this.visit('/').then(() => { - run(function() { - componentInstance.send('transitionToDynamic'); - }); + assert.equal(this.routerService.get('currentRouteName'), 'parent.sister'); + }); + } - assert.equal(this.routerService.get('currentRouteName'), 'dynamic'); - assert.equal(this.routerService.get('currentURL'), '/dynamic/1'); - this.assertText('much dynamicism'); + ['@test RouterService#transitionTo with dynamic segment'](assert) { + assert.expect(3); + + let componentInstance; + let dynamicModel = { id: 1, contents: 'much dynamicism' }; + + this.addTemplate('parent.index', '{{foo-bar}}'); + this.addTemplate('dynamic', '{{model.contents}}'); + + this.addComponent('foo-bar', { + ComponentClass: Component.extend({ + routerService: injectService('router'), + init() { + this._super(); + componentInstance = this; + }, + actions: { + transitionToDynamic() { + get(this, 'routerService').transitionTo('dynamic', dynamicModel); + }, + }, + }), + template: `foo-bar`, + }); + + return this.visit('/').then(() => { + run(function() { + componentInstance.send('transitionToDynamic'); }); - } - - ['@test RouterService#transitionTo with dynamic segment and model hook'](assert) { - assert.expect(3); - let componentInstance; - let dynamicModel = { id: 1, contents: 'much dynamicism' }; + assert.equal(this.routerService.get('currentRouteName'), 'dynamic'); + assert.equal(this.routerService.get('currentURL'), '/dynamic/1'); + this.assertText('much dynamicism'); + }); + } - this.add( - 'route:dynamic', - Route.extend({ - model() { - return dynamicModel; - }, - }) - ); - - this.addTemplate('parent.index', '{{foo-bar}}'); - this.addTemplate('dynamic', '{{model.contents}}'); - - this.addComponent('foo-bar', { - ComponentClass: Component.extend({ - routerService: injectService('router'), - init() { - this._super(); - componentInstance = this; + ['@test RouterService#transitionTo with dynamic segment and model hook'](assert) { + assert.expect(3); + + let componentInstance; + let dynamicModel = { id: 1, contents: 'much dynamicism' }; + + this.add( + 'route:dynamic', + Route.extend({ + model() { + return dynamicModel; + }, + }) + ); + + this.addTemplate('parent.index', '{{foo-bar}}'); + this.addTemplate('dynamic', '{{model.contents}}'); + + this.addComponent('foo-bar', { + ComponentClass: Component.extend({ + routerService: injectService('router'), + init() { + this._super(); + componentInstance = this; + }, + actions: { + transitionToDynamic() { + get(this, 'routerService').transitionTo('dynamic', 1); }, - actions: { - transitionToDynamic() { - get(this, 'routerService').transitionTo('dynamic', 1); - }, - }, - }), - template: `foo-bar`, + }, + }), + template: `foo-bar`, + }); + + return this.visit('/').then(() => { + run(function() { + componentInstance.send('transitionToDynamic'); }); - return this.visit('/').then(() => { - run(function() { - componentInstance.send('transitionToDynamic'); - }); + assert.equal(this.routerService.get('currentRouteName'), 'dynamic'); + assert.equal(this.routerService.get('currentURL'), '/dynamic/1'); + this.assertText('much dynamicism'); + }); + } - assert.equal(this.routerService.get('currentRouteName'), 'dynamic'); - assert.equal(this.routerService.get('currentURL'), '/dynamic/1'); - this.assertText('much dynamicism'); + ['@test RouterService#transitionTo with basic query params does not remove query param defaults']( + assert + ) { + assert.expect(1); + + this.add( + 'controller:parent.child', + Controller.extend({ + queryParams: ['sort'], + sort: 'ASC', + }) + ); + + let queryParams = this.buildQueryParams({ sort: 'ASC' }); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.child', queryParams); + }) + .then(() => { + assert.equal(this.routerService.get('currentURL'), '/child?sort=ASC'); }); - } - - ['@test RouterService#transitionTo with basic query params does not remove query param defaults']( - assert - ) { - assert.expect(1); - - this.add( - 'controller:parent.child', - Controller.extend({ - queryParams: ['sort'], - sort: 'ASC', - }) - ); - - let queryParams = this.buildQueryParams({ sort: 'ASC' }); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.child', queryParams); - }) - .then(() => { - assert.equal(this.routerService.get('currentURL'), '/child?sort=ASC'); - }); - } - - ['@test RouterService#transitionTo passing only queryParams works'](assert) { - assert.expect(2); - - this.add( - 'controller:parent.child', - Controller.extend({ - queryParams: ['sort'], - }) - ); - - let queryParams = this.buildQueryParams({ sort: 'DESC' }); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.child'); - }) - .then(() => { - assert.equal(this.routerService.get('currentURL'), '/child'); - }) - .then(() => { - return this.routerService.transitionTo(queryParams); - }) - .then(() => { - assert.equal(this.routerService.get('currentURL'), '/child?sort=DESC'); - }); - } - - ['@test RouterService#transitionTo with unspecified query params'](assert) { - assert.expect(1); - - this.add( - 'controller:parent.child', - Controller.extend({ - queryParams: ['sort', 'page', 'category', 'extra'], - sort: 'ASC', - page: null, - category: undefined, - }) - ); - - let queryParams = this.buildQueryParams({ sort: 'ASC' }); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.child', queryParams); - }) - .then(() => { - assert.equal(this.routerService.get('currentURL'), '/child?sort=ASC'); - }); - } - - ['@test RouterService#transitionTo with aliased query params uses the original provided key']( - assert - ) { - assert.expect(1); - - this.add( - 'controller:parent.child', - Controller.extend({ - queryParams: { - cont_sort: 'url_sort', - }, - cont_sort: 'ASC', - }) - ); - - let queryParams = this.buildQueryParams({ url_sort: 'ASC' }); - - return this.visit('/') - .then(() => { - return this.routerService.transitionTo('parent.child', queryParams); - }) - .then(() => { - assert.equal(this.routerService.get('currentURL'), '/child?url_sort=ASC'); - }); - } - - ['@test RouterService#transitionTo with aliased query params uses the original provided key when controller property name']( - assert - ) { - assert.expect(1); - - this.add( - 'controller:parent.child', - Controller.extend({ - queryParams: { - cont_sort: 'url_sort', - }, - cont_sort: 'ASC', - }) - ); + } + + ['@test RouterService#transitionTo passing only queryParams works'](assert) { + assert.expect(2); + + this.add( + 'controller:parent.child', + Controller.extend({ + queryParams: ['sort'], + }) + ); + + let queryParams = this.buildQueryParams({ sort: 'DESC' }); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.child'); + }) + .then(() => { + assert.equal(this.routerService.get('currentURL'), '/child'); + }) + .then(() => { + return this.routerService.transitionTo(queryParams); + }) + .then(() => { + assert.equal(this.routerService.get('currentURL'), '/child?sort=DESC'); + }); + } - let queryParams = this.buildQueryParams({ cont_sort: 'ASC' }); + ['@test RouterService#transitionTo with unspecified query params'](assert) { + assert.expect(1); + + this.add( + 'controller:parent.child', + Controller.extend({ + queryParams: ['sort', 'page', 'category', 'extra'], + sort: 'ASC', + page: null, + category: undefined, + }) + ); + + let queryParams = this.buildQueryParams({ sort: 'ASC' }); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.child', queryParams); + }) + .then(() => { + assert.equal(this.routerService.get('currentURL'), '/child?sort=ASC'); + }); + } - return this.visit('/').then(() => { - expectAssertion(() => { - return this.routerService.transitionTo('parent.child', queryParams); - }, 'You passed the `cont_sort` query parameter during a transition into parent.child, please update to url_sort'); + ['@test RouterService#transitionTo with aliased query params uses the original provided key']( + assert + ) { + assert.expect(1); + + this.add( + 'controller:parent.child', + Controller.extend({ + queryParams: { + cont_sort: 'url_sort', + }, + cont_sort: 'ASC', + }) + ); + + let queryParams = this.buildQueryParams({ url_sort: 'ASC' }); + + return this.visit('/') + .then(() => { + return this.routerService.transitionTo('parent.child', queryParams); + }) + .then(() => { + assert.equal(this.routerService.get('currentURL'), '/child?url_sort=ASC'); }); - } } - ); -} + + ['@test RouterService#transitionTo with aliased query params uses the original provided key when controller property name']( + assert + ) { + assert.expect(1); + + this.add( + 'controller:parent.child', + Controller.extend({ + queryParams: { + cont_sort: 'url_sort', + }, + cont_sort: 'ASC', + }) + ); + + let queryParams = this.buildQueryParams({ cont_sort: 'ASC' }); + + return this.visit('/').then(() => { + expectAssertion(() => { + return this.routerService.transitionTo('parent.child', queryParams); + }, 'You passed the `cont_sort` query parameter during a transition into parent.child, please update to url_sort'); + }); + } + } +);
true
Other
emberjs
ember.js
0f95c777fe507940f2922e6d256125677d5bb882.json
Remove old Router Service FF This removes the FF around all the router service features that were go'd earlier this year. It also reuses the same flag to guard the new features that we are adding.
packages/ember/tests/routing/router_service_test/urlFor_test.js
@@ -4,8 +4,6 @@ import { Route } from '@ember/-internals/routing'; import { get } from '@ember/-internals/metal'; import { RouterTestCase, moduleFor } from 'internal-test-helpers'; -import { EMBER_ROUTING_ROUTER_SERVICE } from '@ember/canary-features'; - function setupController(app, name) { let controllerName = `${capitalize(name)}Controller`; @@ -16,292 +14,288 @@ function setupController(app, name) { }); } -if (EMBER_ROUTING_ROUTER_SERVICE) { - moduleFor( - 'Router Service - urlFor', - class extends RouterTestCase { - ['@test RouterService#urlFor returns URL for simple route'](assert) { - assert.expect(1); +moduleFor( + 'Router Service - urlFor', + class extends RouterTestCase { + ['@test RouterService#urlFor returns URL for simple route'](assert) { + assert.expect(1); - return this.visit('/').then(() => { - let expectedURL = this.routerService.urlFor('parent.child'); + return this.visit('/').then(() => { + let expectedURL = this.routerService.urlFor('parent.child'); - assert.equal('/child', expectedURL); - }); - } + assert.equal('/child', expectedURL); + }); + } - ['@test RouterService#urlFor returns URL for simple route with dynamic segments'](assert) { - assert.expect(1); + ['@test RouterService#urlFor returns URL for simple route with dynamic segments'](assert) { + assert.expect(1); - setupController(this.application, 'dynamic'); + setupController(this.application, 'dynamic'); - let dynamicModel = { id: 1, contents: 'much dynamicism' }; + let dynamicModel = { id: 1, contents: 'much dynamicism' }; - return this.visit('/').then(() => { - let expectedURL = this.routerService.urlFor('dynamic', dynamicModel); + return this.visit('/').then(() => { + let expectedURL = this.routerService.urlFor('dynamic', dynamicModel); - assert.equal('/dynamic/1', expectedURL); - }); - } + assert.equal('/dynamic/1', expectedURL); + }); + } - ['@test RouterService#urlFor returns URL for simple route with basic query params'](assert) { - assert.expect(1); + ['@test RouterService#urlFor returns URL for simple route with basic query params'](assert) { + assert.expect(1); - let queryParams = this.buildQueryParams({ foo: 'bar' }); + let queryParams = this.buildQueryParams({ foo: 'bar' }); - return this.visit('/').then(() => { - let expectedURL = this.routerService.urlFor('parent.child', queryParams); + return this.visit('/').then(() => { + let expectedURL = this.routerService.urlFor('parent.child', queryParams); - assert.equal('/child?foo=bar', expectedURL); - }); - } - - ['@test RouterService#urlFor returns URL for simple route with basic query params and default value']( - assert - ) { - assert.expect(1); - - this.add( - 'controller:parent.child', - Controller.extend({ - queryParams: ['sort'], - sort: 'ASC', - }) - ); + assert.equal('/child?foo=bar', expectedURL); + }); + } - let queryParams = this.buildQueryParams({ sort: 'ASC' }); + ['@test RouterService#urlFor returns URL for simple route with basic query params and default value']( + assert + ) { + assert.expect(1); - return this.visit('/').then(() => { - let expectedURL = this.routerService.urlFor('parent.child', queryParams); + this.add( + 'controller:parent.child', + Controller.extend({ + queryParams: ['sort'], + sort: 'ASC', + }) + ); - assert.equal('/child?sort=ASC', expectedURL); - }); - } - - ['@test RouterService#urlFor returns URL for simple route with basic query params and default value with stickyness']( - assert - ) { - assert.expect(2); - - this.add( - 'controller:parent.child', - Controller.extend({ - queryParams: ['sort', 'foo'], - sort: 'ASC', - }) - ); + let queryParams = this.buildQueryParams({ sort: 'ASC' }); - return this.visit('/child/?sort=DESC').then(() => { - let controller = this.applicationInstance.lookup('controller:parent.child'); - assert.equal(get(controller, 'sort'), 'DESC', 'sticky is set'); + return this.visit('/').then(() => { + let expectedURL = this.routerService.urlFor('parent.child', queryParams); - let queryParams = this.buildQueryParams({ foo: 'derp' }); - let actual = this.routerService.urlFor('parent.child', queryParams); + assert.equal('/child?sort=ASC', expectedURL); + }); + } - assert.equal(actual, '/child?foo=derp', 'does not use "stickiness"'); - }); - } + ['@test RouterService#urlFor returns URL for simple route with basic query params and default value with stickyness']( + assert + ) { + assert.expect(2); - ['@test RouterService#urlFor returns URL for simple route with array as query params']( - assert - ) { - assert.expect(1); + this.add( + 'controller:parent.child', + Controller.extend({ + queryParams: ['sort', 'foo'], + sort: 'ASC', + }) + ); - let queryParams = this.buildQueryParams({ - selectedItems: ['a', 'b', 'c'], - }); + return this.visit('/child/?sort=DESC').then(() => { + let controller = this.applicationInstance.lookup('controller:parent.child'); + assert.equal(get(controller, 'sort'), 'DESC', 'sticky is set'); - return this.visit('/').then(() => { - let expectedURL = this.routerService.urlFor('parent.child', queryParams); + let queryParams = this.buildQueryParams({ foo: 'derp' }); + let actual = this.routerService.urlFor('parent.child', queryParams); - assert.equal('/child?selectedItems[]=a&selectedItems[]=b&selectedItems[]=c', expectedURL); - }); - } + assert.equal(actual, '/child?foo=derp', 'does not use "stickiness"'); + }); + } - ['@test RouterService#urlFor returns URL for simple route with null query params'](assert) { - assert.expect(1); + ['@test RouterService#urlFor returns URL for simple route with array as query params'](assert) { + assert.expect(1); - let queryParams = this.buildQueryParams({ foo: null }); + let queryParams = this.buildQueryParams({ + selectedItems: ['a', 'b', 'c'], + }); - return this.visit('/').then(() => { - let expectedURL = this.routerService.urlFor('parent.child', queryParams); + return this.visit('/').then(() => { + let expectedURL = this.routerService.urlFor('parent.child', queryParams); - assert.equal('/child', expectedURL); - }); - } + assert.equal('/child?selectedItems[]=a&selectedItems[]=b&selectedItems[]=c', expectedURL); + }); + } - ['@test RouterService#urlFor returns URL for simple route with undefined query params']( - assert - ) { - assert.expect(1); + ['@test RouterService#urlFor returns URL for simple route with null query params'](assert) { + assert.expect(1); - let queryParams = this.buildQueryParams({ foo: undefined }); + let queryParams = this.buildQueryParams({ foo: null }); - return this.visit('/').then(() => { - let expectedURL = this.routerService.urlFor('parent.child', queryParams); + return this.visit('/').then(() => { + let expectedURL = this.routerService.urlFor('parent.child', queryParams); - assert.equal('/child', expectedURL); - }); - } + assert.equal('/child', expectedURL); + }); + } - ['@test RouterService#urlFor returns URL for simple route with dynamic segments and basic query params']( - assert - ) { - assert.expect(1); + ['@test RouterService#urlFor returns URL for simple route with undefined query params']( + assert + ) { + assert.expect(1); - let queryParams = this.buildQueryParams({ foo: 'bar' }); + let queryParams = this.buildQueryParams({ foo: undefined }); - return this.visit('/').then(() => { - let expectedURL = this.routerService.urlFor('dynamic', { id: 1 }, queryParams); + return this.visit('/').then(() => { + let expectedURL = this.routerService.urlFor('parent.child', queryParams); - assert.equal('/dynamic/1?foo=bar', expectedURL); - }); - } + assert.equal('/child', expectedURL); + }); + } - ['@test RouterService#urlFor returns URL for simple route with dynamic segments and array as query params']( - assert - ) { - assert.expect(1); + ['@test RouterService#urlFor returns URL for simple route with dynamic segments and basic query params']( + assert + ) { + assert.expect(1); - let queryParams = this.buildQueryParams({ - selectedItems: ['a', 'b', 'c'], - }); + let queryParams = this.buildQueryParams({ foo: 'bar' }); - return this.visit('/').then(() => { - let expectedURL = this.routerService.urlFor('dynamic', { id: 1 }, queryParams); + return this.visit('/').then(() => { + let expectedURL = this.routerService.urlFor('dynamic', { id: 1 }, queryParams); - assert.equal( - '/dynamic/1?selectedItems[]=a&selectedItems[]=b&selectedItems[]=c', - expectedURL - ); - }); - } + assert.equal('/dynamic/1?foo=bar', expectedURL); + }); + } - ['@test RouterService#urlFor returns URL for simple route with dynamic segments and null query params']( - assert - ) { - assert.expect(1); + ['@test RouterService#urlFor returns URL for simple route with dynamic segments and array as query params']( + assert + ) { + assert.expect(1); - let queryParams = this.buildQueryParams({ foo: null }); + let queryParams = this.buildQueryParams({ + selectedItems: ['a', 'b', 'c'], + }); - return this.visit('/').then(() => { - let expectedURL = this.routerService.urlFor('dynamic', { id: 1 }, queryParams); + return this.visit('/').then(() => { + let expectedURL = this.routerService.urlFor('dynamic', { id: 1 }, queryParams); - assert.equal('/dynamic/1', expectedURL); - }); - } + assert.equal( + '/dynamic/1?selectedItems[]=a&selectedItems[]=b&selectedItems[]=c', + expectedURL + ); + }); + } + + ['@test RouterService#urlFor returns URL for simple route with dynamic segments and null query params']( + assert + ) { + assert.expect(1); + + let queryParams = this.buildQueryParams({ foo: null }); + + return this.visit('/').then(() => { + let expectedURL = this.routerService.urlFor('dynamic', { id: 1 }, queryParams); + + assert.equal('/dynamic/1', expectedURL); + }); + } + + ['@test RouterService#urlFor returns URL for simple route with dynamic segments and undefined query params']( + assert + ) { + assert.expect(1); + + let queryParams = this.buildQueryParams({ foo: undefined }); + + return this.visit('/').then(() => { + let expectedURL = this.routerService.urlFor('dynamic', { id: 1 }, queryParams); + + assert.equal('/dynamic/1', expectedURL); + }); + } - ['@test RouterService#urlFor returns URL for simple route with dynamic segments and undefined query params']( - assert - ) { - assert.expect(1); + ['@test RouterService#urlFor correctly transitions to route via generated path'](assert) { + assert.expect(1); - let queryParams = this.buildQueryParams({ foo: undefined }); + let expectedURL; - return this.visit('/').then(() => { - let expectedURL = this.routerService.urlFor('dynamic', { id: 1 }, queryParams); + return this.visit('/') + .then(() => { + expectedURL = this.routerService.urlFor('parent.child'); - assert.equal('/dynamic/1', expectedURL); + return this.routerService.transitionTo(expectedURL); + }) + .then(() => { + assert.equal(expectedURL, this.routerService.get('currentURL')); }); - } - - ['@test RouterService#urlFor correctly transitions to route via generated path'](assert) { - assert.expect(1); - - let expectedURL; - - return this.visit('/') - .then(() => { - expectedURL = this.routerService.urlFor('parent.child'); - - return this.routerService.transitionTo(expectedURL); - }) - .then(() => { - assert.equal(expectedURL, this.routerService.get('currentURL')); - }); - } - - ['@test RouterService#urlFor correctly transitions to route via generated path with dynamic segments']( - assert - ) { - assert.expect(1); - - let expectedURL; - let dynamicModel = { id: 1 }; - - this.add( - 'route:dynamic', - Route.extend({ - model() { - return dynamicModel; - }, - }) - ); + } - return this.visit('/') - .then(() => { - expectedURL = this.routerService.urlFor('dynamic', dynamicModel); - - return this.routerService.transitionTo(expectedURL); - }) - .then(() => { - assert.equal(expectedURL, this.routerService.get('currentURL')); - }); - } - - ['@test RouterService#urlFor correctly transitions to route via generated path with query params']( - assert - ) { - assert.expect(1); - - let expectedURL; - let actualURL; - let queryParams = this.buildQueryParams({ foo: 'bar' }); - - return this.visit('/') - .then(() => { - expectedURL = this.routerService.urlFor('parent.child', queryParams); - - return this.routerService.transitionTo(expectedURL); - }) - .then(() => { - actualURL = `${this.routerService.get('currentURL')}?foo=bar`; - - assert.equal(expectedURL, actualURL); - }); - } - - ['@test RouterService#urlFor correctly transitions to route via generated path with dynamic segments and query params']( - assert - ) { - assert.expect(1); - - let expectedURL; - let actualURL; - let queryParams = this.buildQueryParams({ foo: 'bar' }); - let dynamicModel = { id: 1 }; - - this.add( - 'route:dynamic', - Route.extend({ - model() { - return dynamicModel; - }, - }) - ); + ['@test RouterService#urlFor correctly transitions to route via generated path with dynamic segments']( + assert + ) { + assert.expect(1); + + let expectedURL; + let dynamicModel = { id: 1 }; + + this.add( + 'route:dynamic', + Route.extend({ + model() { + return dynamicModel; + }, + }) + ); + + return this.visit('/') + .then(() => { + expectedURL = this.routerService.urlFor('dynamic', dynamicModel); + + return this.routerService.transitionTo(expectedURL); + }) + .then(() => { + assert.equal(expectedURL, this.routerService.get('currentURL')); + }); + } + + ['@test RouterService#urlFor correctly transitions to route via generated path with query params']( + assert + ) { + assert.expect(1); - return this.visit('/') - .then(() => { - expectedURL = this.routerService.urlFor('dynamic', dynamicModel, queryParams); + let expectedURL; + let actualURL; + let queryParams = this.buildQueryParams({ foo: 'bar' }); - return this.routerService.transitionTo(expectedURL); - }) - .then(() => { - actualURL = `${this.routerService.get('currentURL')}?foo=bar`; + return this.visit('/') + .then(() => { + expectedURL = this.routerService.urlFor('parent.child', queryParams); - assert.equal(expectedURL, actualURL); - }); - } + return this.routerService.transitionTo(expectedURL); + }) + .then(() => { + actualURL = `${this.routerService.get('currentURL')}?foo=bar`; + + assert.equal(expectedURL, actualURL); + }); } - ); -} + + ['@test RouterService#urlFor correctly transitions to route via generated path with dynamic segments and query params']( + assert + ) { + assert.expect(1); + + let expectedURL; + let actualURL; + let queryParams = this.buildQueryParams({ foo: 'bar' }); + let dynamicModel = { id: 1 }; + + this.add( + 'route:dynamic', + Route.extend({ + model() { + return dynamicModel; + }, + }) + ); + + return this.visit('/') + .then(() => { + expectedURL = this.routerService.urlFor('dynamic', dynamicModel, queryParams); + + return this.routerService.transitionTo(expectedURL); + }) + .then(() => { + actualURL = `${this.routerService.get('currentURL')}?foo=bar`; + + assert.equal(expectedURL, actualURL); + }); + } + } +);
true
Other
emberjs
ember.js
d8ee5524036703d377a50fa5709bc4634b90c300.json
add docs and more deprecations
packages/@ember/-internals/routing/lib/services/router.ts
@@ -38,6 +38,79 @@ import { extractRouteArgs, resemblesURL, shallowEqual } from '../utils'; export default class RouterService extends Service { _router!: EmberRouter; + init() { + this._super(...arguments); + this._router.on('routeWillChange', (transition: Transition) => { + this.trigger('routeWillChange', transition); + }); + + this._router.on('routeDidChange', (transition: Transition) => { + this.trigger('routeDidChange', transition); + }); + } + + /** + The `routeWillChange` event is fired at the beginning of any + attempted transition with a `Transition` object as the sole + argument. This action can be used for aborting, redirecting, + or decorating the transition from the currently active routes. + + A good example is preventing navigation when a form is + half-filled out: + + ```app/routes/contact-form.js + import {inject as service} from '@ember/service'; + + export default Route.extend({ + router: service('router'), + init() { + this._super(...arguments); + this.router.on('routeWillUpdate', (transition) => { + if (!transition.to.find(route => route.name === this.routeName)) { + alert("Please save or cancel your changes."); + transition.abort(); + } + }) + } + }); + ``` + + The `routeWillChange` event fires whenever a new route is chosen as the desired target of a transition. This includes `transitionTo`, `replaceWith`, all redirection for any reason including error handling, and abort. Aborting implies changing the desired target back to where you already were. Once a transition has completed, `routeDidChange` fires. + + @event routeWillChange + @param {Transition} transition + @public + */ + + /** + The `routeDidChange` event only fires once a transition has settled. + This includes aborts and error substates. Like the `routeWillChange` event + it recieves a Transition as the sole argument. + + A good example is sending some analytics when the route has transitioned: + + ```app/routes/contact-form.js + import {inject as service} from '@ember/service'; + + export default Route.extend({ + router: service('router'), + init() { + this._super(...arguments); + this.router.on('routeDidUpdate', (transition) => { + ga.send('pageView', { + current: transition.to.name, + from: transition.from.name + }); + }) + } + }); + ``` + + @event routeDidChange + @param {Transition} transition + @public + */ + /** Transition the application into another route. The route may be either a single route or route path: @@ -151,16 +224,6 @@ export default class RouterService extends Service { } RouterService.reopen(Evented, { - init() { - this._super(...arguments); - this._router.on('routeWillChange', (transition: Transition) => { - this.trigger('routeWillChange', transition); - }); - - this._router.on('routeDidChange', (transition: Transition) => { - this.trigger('routeDidChange', transition); - }); - }, /** Name of the current route.
true
Other
emberjs
ember.js
d8ee5524036703d377a50fa5709bc4634b90c300.json
add docs and more deprecations
packages/@ember/-internals/routing/lib/system/route.ts
@@ -7,8 +7,9 @@ import { Object as EmberObject, typeOf, } from '@ember/-internals/runtime'; +import { EMBER_ROUTING_ROUTER_SERVICE } from '@ember/canary-features'; import { assert, deprecate, info, isTesting } from '@ember/debug'; -import { ROUTER_ROUTER } from '@ember/deprecated-features'; +import { ROUTER_EVENTS, ROUTER_ROUTER } from '@ember/deprecated-features'; import { assign } from '@ember/polyfills'; import { once } from '@ember/runloop'; import { classify } from '@ember/string'; @@ -330,7 +331,7 @@ class Route extends EmberObject implements IRoute { @private @method _internalReset - @since 1.7.0 + @since 3.6.0 */ _internalReset(isExiting: boolean, transition: Transition) { let controller = this.controller; @@ -2511,4 +2512,39 @@ Route.reopen(ActionHandler, Evented, { }, }); +export let ROUTER_EVENT_DEPRECATIONS: any; +if (EMBER_ROUTING_ROUTER_SERVICE && ROUTER_EVENTS) { + ROUTER_EVENT_DEPRECATIONS = { + on(name: string) { + this._super(...arguments); + let hasDidTransition = name === 'didTransition'; + let hasWillTransition = name === 'willTransition'; + + if (hasDidTransition) { + deprecate( + 'You attempted to listen to the "didTransition" event which is deprecated. Please inject the router service and listen to the "routeDidChange" event.', + false, + { + id: 'deprecate-router-events', + until: '4.0.0', + } + ); + } + + if (hasWillTransition) { + deprecate( + 'You attempted to listen to the "willTransition" event which is deprecated. Please inject the router service and listen to the "routeWillChange" event.', + false, + { + id: 'deprecate-router-events', + until: '4.0.0', + } + ); + } + }, + }; + + Route.reopen(ROUTER_EVENT_DEPRECATIONS); +} + export default Route;
true
Other
emberjs
ember.js
d8ee5524036703d377a50fa5709bc4634b90c300.json
add docs and more deprecations
packages/@ember/-internals/routing/lib/system/router.ts
@@ -11,7 +11,12 @@ import { DEBUG } from '@glimmer/env'; import EmberLocation, { EmberLocation as IEmberLocation } from '../location/api'; import { calculateCacheKey, extractRouteArgs, getActiveTargetName, resemblesURL } from '../utils'; import EmberRouterDSL from './dsl'; -import Route, { defaultSerialize, hasDefaultSerialize, RenderOptions } from './route'; +import Route, { + defaultSerialize, + hasDefaultSerialize, + RenderOptions, + ROUTER_EVENT_DEPRECATIONS, +} from './route'; import RouterState from './router_state'; /** @module @ember/routing @@ -28,6 +33,46 @@ import Router, { } from 'router_js'; import { EngineRouteInfo } from './engines'; +function defaultDidTransition(this: EmberRouter, infos: PrivateRouteInfo[]) { + updatePaths(this); + + this._cancelSlowTransitionTimer(); + + this.notifyPropertyChange('url'); + this.set('currentState', this.targetState); + + // Put this in the runloop so url will be accurate. Seems + // less surprising than didTransition being out of sync. + once(this, this.trigger, 'didTransition'); + + if (DEBUG) { + if (get(this, 'namespace').LOG_TRANSITIONS) { + // eslint-disable-next-line no-console + console.log(`Transitioned into '${EmberRouter._routePath(infos)}'`); + } + } +} + +function defaultWillTransition( + this: EmberRouter, + oldInfos: PrivateRouteInfo[], + newInfos: PrivateRouteInfo[], + transition: Transition +) { + once(this, this.trigger, 'willTransition', transition); + + if (DEBUG) { + if (get(this, 'namespace').LOG_TRANSITIONS) { + // eslint-disable-next-line no-console + console.log( + `Preparing to transition from '${EmberRouter._routePath( + oldInfos + )}' to '${EmberRouter._routePath(newInfos)}'` + ); + } + } +} + if (HANDLER_INFOS) { Object.defineProperty(InternalRouteInfo.prototype, 'handler', { get() { @@ -239,6 +284,18 @@ class EmberRouter extends EmberObject { } didTransition(infos: PrivateRouteInfo[]) { + if (EMBER_ROUTING_ROUTER_SERVICE && ROUTER_EVENTS) { + if (router.didTransition !== defaultDidTransition) { + deprecate( + 'You attempted to override the "didTransition" method which is deprecated. Please inject the router service and listen to the "routeDidChange" event.', + false, + { + id: 'deprecate-router-events', + until: '4.0.0', + } + ); + } + } router.didTransition(infos); } @@ -247,6 +304,18 @@ class EmberRouter extends EmberObject { newInfos: PrivateRouteInfo[], transition: Transition ) { + if (EMBER_ROUTING_ROUTER_SERVICE && ROUTER_EVENTS) { + if (router.willTransition !== defaultWillTransition) { + deprecate( + 'You attempted to override the "willTransition" method which is deprecated. Please inject the router service and listen to the "routeWillChange" event.', + false, + { + id: 'deprecate-router-events', + until: '4.0.0', + } + ); + } + } router.willTransition(oldInfos, newInfos, transition); } @@ -438,57 +507,6 @@ class EmberRouter extends EmberObject { return true; } - /** - Handles updating the paths and notifying any listeners of the URL - change. - - Triggers the router level `didTransition` hook. - - For example, to notify google analytics when the route changes, - you could use this hook. (Note: requires also including GA scripts, etc.) - - ```javascript - import config from './config/environment'; - import EmberRouter from '@ember/routing/router'; - - let Router = EmberRouter.extend({ - location: config.locationType, - - didTransition: function() { - this._super(...arguments); - - return ga('send', 'pageview', { - 'page': this.get('url'), - 'title': this.get('url') - }); - } - }); - ``` - - @method didTransition - @public - @since 1.2.0 - */ - didTransition(infos: PrivateRouteInfo[]) { - updatePaths(this); - - this._cancelSlowTransitionTimer(); - - this.notifyPropertyChange('url'); - this.set('currentState', this.targetState); - - // Put this in the runloop so url will be accurate. Seems - // less surprising than didTransition being out of sync. - once(this, this.trigger, 'didTransition'); - - if (DEBUG) { - if (get(this, 'namespace').LOG_TRANSITIONS) { - // eslint-disable-next-line no-console - console.log(`Transitioned into '${EmberRouter._routePath(infos)}'`); - } - } - } - _setOutlets() { // This is triggered async during Route#willDestroy. // If the router is also being destroyed we do not want to @@ -547,35 +565,6 @@ class EmberRouter extends EmberObject { } } - /** - Handles notifying any listeners of an impending URL - change. - - Triggers the router level `willTransition` hook. - - @method willTransition - @public - @since 1.11.0 - */ - willTransition( - oldInfos: PrivateRouteInfo[], - newInfos: PrivateRouteInfo[], - transition: Transition - ) { - once(this, this.trigger, 'willTransition', transition); - - if (DEBUG) { - if (get(this, 'namespace').LOG_TRANSITIONS) { - // eslint-disable-next-line no-console - console.log( - `Preparing to transition from '${EmberRouter._routePath( - oldInfos - )}' to '${EmberRouter._routePath(newInfos)}'` - ); - } - } - } - handleURL(url: string) { // Until we have an ember-idiomatic way of accessing #hashes, we need to // remove it because router.js doesn't know how to handle it. @@ -1789,6 +1778,50 @@ function representEmptyRoute( } EmberRouter.reopen(Evented, { + /** + Handles updating the paths and notifying any listeners of the URL + change. + + Triggers the router level `didTransition` hook. + + For example, to notify google analytics when the route changes, + you could use this hook. (Note: requires also including GA scripts, etc.) + + ```javascript + import config from './config/environment'; + import EmberRouter from '@ember/routing/router'; + + let Router = EmberRouter.extend({ + location: config.locationType, + + didTransition: function() { + this._super(...arguments); + + return ga('send', 'pageview', { + 'page': this.get('url'), + 'title': this.get('url') + }); + } + }); + ``` + + @method didTransition + @public + @since 1.2.0 + */ + didTransition: defaultDidTransition, + + /** + Handles notifying any listeners of an impending URL + change. + + Triggers the router level `willTransition` hook. + + @method willTransition + @public + @since 1.11.0 + */ + willTransition: defaultWillTransition, /** Represents the URL of the root of the application, often '/'. This prefix is assumed on all routes defined on this router. @@ -1832,37 +1865,7 @@ EmberRouter.reopen(Evented, { }), }); -if (EMBER_ROUTING_ROUTER_SERVICE) { - if (ROUTER_EVENTS) { - EmberRouter.reopen({ - on(name: string) { - this._super(...arguments); - let hasDidTransition = name === 'didTransition'; - let hasWillTransition = name === 'willTransition'; - - if (hasDidTransition) { - deprecate( - 'You attempted to listen to the "didTransition" event which is deprecated. Please inject the router service and listen to the "routeDidChange" event.', - false, - { - id: 'deprecate-router-events', - until: '3.9.0', - } - ); - } - - if (hasWillTransition) { - deprecate( - 'You attempted to listen to the "willTransition" event which is deprecated. Please inject the router service and listen to the "routeWillChange" event.', - false, - { - id: 'deprecate-router-events', - until: '3.9.0', - } - ); - } - }, - }); - } +if (EMBER_ROUTING_ROUTER_SERVICE && ROUTER_EVENTS) { + EmberRouter.reopen(ROUTER_EVENT_DEPRECATIONS); } export default EmberRouter;
true
Other
emberjs
ember.js
d8ee5524036703d377a50fa5709bc4634b90c300.json
add docs and more deprecations
packages/ember/tests/routing/router_service_test/events_test.js
@@ -635,15 +635,60 @@ if (EMBER_ROUTING_ROUTER_SERVICE) { moduleFor( 'Router Service - deprecated events', class extends RouterTestCase { - '@test willTransition is deprecated'() { + '@test willTransition events are deprecated'() { return this.visit('/').then(() => { expectDeprecation(() => { this.routerService['_router'].on('willTransition', () => {}); }, 'You attempted to listen to the "willTransition" event which is deprecated. Please inject the router service and listen to the "routeWillChange" event.'); }); } - '@test didTransition is deprecated'() { + '@test willTransition events are deprecated on routes'() { + this.add( + 'route:application', + Route.extend({ + init() { + this._super(...arguments); + this.on('willTransition', () => {}); + }, + }) + ); + expectDeprecation(() => { + return this.visit('/'); + }, 'You attempted to listen to the "willTransition" event which is deprecated. Please inject the router service and listen to the "routeWillChange" event.'); + } + + '@test didTransition events are deprecated on routes'() { + this.add( + 'route:application', + Route.extend({ + init() { + this._super(...arguments); + this.on('didTransition', () => {}); + }, + }) + ); + expectDeprecation(() => { + return this.visit('/'); + }, 'You attempted to listen to the "didTransition" event which is deprecated. Please inject the router service and listen to the "routeDidChange" event.'); + } + + '@test other events are not deprecated on routes'() { + this.add( + 'route:application', + Route.extend({ + init() { + this._super(...arguments); + this.on('fixx', () => {}); + }, + }) + ); + expectNoDeprecation(() => { + return this.visit('/'); + }); + } + + '@test didTransition events are deprecated'() { return this.visit('/').then(() => { expectDeprecation(() => { this.routerService['_router'].on('didTransition', () => {}); @@ -660,4 +705,43 @@ if (EMBER_ROUTING_ROUTER_SERVICE) { } } ); + + moduleFor( + 'Router Service: deprecated willTransition hook', + class extends RouterTestCase { + get routerOptions() { + return { + willTransition() { + this._super(...arguments); + // Overrides + }, + }; + } + + '@test willTransition hook is deprecated'() { + expectDeprecation(() => { + return this.visit('/'); + }, 'You attempted to override the "willTransition" method which is deprecated. Please inject the router service and listen to the "routeWillChange" event.'); + } + } + ); + moduleFor( + 'Router Service: deprecated didTransition hook', + class extends RouterTestCase { + get routerOptions() { + return { + didTransition() { + this._super(...arguments); + // Overrides + }, + }; + } + + '@test didTransition hook is deprecated'() { + expectDeprecation(() => { + return this.visit('/'); + }, 'You attempted to override the "didTransition" method which is deprecated. Please inject the router service and listen to the "routeDidChange" event.'); + } + } + ); }
true
Other
emberjs
ember.js
7c45f2066931bb779ced201797b5a8ff7eef0322.json
Add v3.5.0-beta.4 to CHANGELOG [ci skip] (cherry picked from commit 942fdb76ddb64376eca1070d8476a766bd172e4f)
CHANGELOG.md
@@ -1,8 +1,8 @@ # Ember Changelog -### v3.6.0-beta.1 (Unreleased) +### v3.5.0-beta.4 (October 1, 2018) -- [#17003](https://github.com/emberjs/ember.js/pull/17003) / [#17013](https://github.com/emberjs/ember.js/pull/17013) [BUGFIX] Fix rendering of empty content with `{{{...}}}` and `htmlSafe` +- [#17003](https://github.com/emberjs/ember.js/pull/17003) / [#17013](https://github.com/emberjs/ember.js/pull/17013) [BUGFIX] Fix rendering of empty content with `{{{...}}}` or `{{...}}` with `htmlSafe('')` ### v3.5.0-beta.3 (September 24, 2018)
false
Other
emberjs
ember.js
fba532061ae4f158c22d55b9c9d780d383079091.json
Fix jquery-none.js request in tests Fixes #17017
tests/index.html
@@ -21,7 +21,7 @@ <script type="text/javascript"> // Load custom version of jQuery if possible (assign to window so IE8 can use in later blocks) var jQueryVersion = QUnit.urlParams.jquery; - if (jQueryVersion) { + if (jQueryVersion && jQueryVersion !== 'none') { loadScript('https://code.jquery.com/jquery-'+jQueryVersion+'.js'); } // Close the script tag to make sure document.write happens
false
Other
emberjs
ember.js
373e9820b65b7200f24064a42bc9fe885926d88e.json
Add failing test for #16314 (cherry picked from commit 74ebe7b0e9513bb9446ffd2c272e4101c3e5deb7)
packages/@ember/-internals/glimmer/tests/integration/content-test.js
@@ -702,6 +702,22 @@ moduleFor( this.assertTextNode(this.firstChild, content); // this.takeSnapshot(); } + + ['@test it can render empty safe strings [GH#16314]']() { + this.render('before {{value}} after', { value: htmlSafe('hello') }); + + this.assertHTML('before hello after'); + + this.assertStableRerender(); + + this.runTask(() => set(this.context, 'value', htmlSafe(''))); + + this.assertHTML('before after'); + + this.runTask(() => set(this.context, 'value', htmlSafe('hello'))); + + this.assertHTML('before hello after'); + } } ); @@ -853,6 +869,14 @@ moduleFor( this.runTask(() => set(this.context, 'value', 'hello')); this.assertContent('before hello after'); + + this.runTask(() => set(this.context, 'value', htmlSafe(''))); + + this.assertContent('before after'); + + this.runTask(() => set(this.context, 'value', 'hello')); + + this.assertContent('before hello after'); } } );
true
Other
emberjs
ember.js
373e9820b65b7200f24064a42bc9fe885926d88e.json
Add failing test for #16314 (cherry picked from commit 74ebe7b0e9513bb9446ffd2c272e4101c3e5deb7)
packages/@ember/-internals/glimmer/tests/integration/syntax/each-test.js
@@ -2,9 +2,8 @@ import { get, set, notifyPropertyChange } from '@ember/-internals/metal'; import { applyMixins, strip } from '../../utils/abstract-test-case'; import { moduleFor, RenderingTest } from '../../utils/test-case'; import { A as emberA, ArrayProxy, RSVP } from '@ember/-internals/runtime'; -import { Component } from '../../utils/helpers'; +import { Component, htmlSafe } from '../../utils/helpers'; import { HAS_NATIVE_SYMBOL } from '@ember/-internals/utils'; - import { TogglingSyntaxConditionalsTest, TruthyGenerator, @@ -827,6 +826,32 @@ class EachTest extends AbstractEachTest { this.assertText(''); } + ['@test empty trusted content clears properly [GH#16314]']() { + this.makeList(['hello']); + + this.render(`before {{#each list as |value|}}{{{value}}}{{/each}} after`); + + this.assertText('before hello after'); + + this.assertStableRerender(); + + this.runTask(() => this.pushObjects([null, ' world'])); + + this.assertText('before hello world after'); + + this.runTask(() => this.replace(1, 2, [undefined, ' world!'])); + + this.assertText('before hello world! after'); + + this.runTask(() => this.replace(1, 2, [htmlSafe(''), ' world!!'])); + + this.assertText('before hello world!! after'); + + this.replaceList(['hello']); + + this.assertText('before hello after'); + } + /* multi each */ ['@test re-using the same variable with different {{#each}} blocks does not override each other']() {
true
Other
emberjs
ember.js
b5ab036ff0f741557646850fcaeb40ce9d4dde24.json
Add failing test for #14924 and #16172 (cherry picked from commit 830d766071a2a09e0805660ccb25201dc542fb5c)
packages/@ember/-internals/glimmer/tests/integration/application/rendering-test.js
@@ -503,5 +503,28 @@ moduleFor( }, expectedBacktrackingMessage); }); } + + ['@test route templates with {{{undefined}}} [GH#14924] [GH#16172]']() { + this.router.map(function() { + this.route('first'); + this.route('second'); + }); + + this.addTemplate('first', 'first'); + this.addTemplate('second', '{{{undefined}}}second'); + + return this.visit('/first') + .then(() => { + this.assertText('first'); + return this.visit('/second'); + }) + .then(() => { + this.assertText('second'); + return this.visit('/first'); + }) + .then(() => { + this.assertText('first'); + }); + } } );
false
Other
emberjs
ember.js
1140e27ea947dc7bf6d8adcf9aed658d2b83155e.json
Add failing test for #14978 (cherry picked from commit 793d123292a2756321f254eb7506eb72951af544)
packages/@ember/-internals/glimmer/tests/integration/content-test.js
@@ -818,6 +818,42 @@ moduleFor( this.assertContent('<b>Max</b><i>James</i>'); } + + ['@test empty content in trusted curlies [GH#14978]']() { + this.render('before {{{value}}} after', { + value: 'hello', + }); + + this.assertContent('before hello after'); + + this.runTask(() => this.rerender()); + + this.assertStableRerender(); + + this.runTask(() => set(this.context, 'value', undefined)); + + this.assertContent('before after'); + + this.runTask(() => set(this.context, 'value', 'hello')); + + this.assertContent('before hello after'); + + this.runTask(() => set(this.context, 'value', null)); + + this.assertContent('before after'); + + this.runTask(() => set(this.context, 'value', 'hello')); + + this.assertContent('before hello after'); + + this.runTask(() => set(this.context, 'value', '')); + + this.assertContent('before after'); + + this.runTask(() => set(this.context, 'value', 'hello')); + + this.assertContent('before hello after'); + } } );
false
Other
emberjs
ember.js
a835354b5f91454403caa21fc8b9fc267b3483be.json
Add v3.5.0-beta.3 to CHANGELOG [ci skip] (cherry picked from commit 15a47a25d947cc58b95d4e5fff0f8575be0fafca)
CHANGELOG.md
@@ -1,5 +1,10 @@ # Ember Changelog +### v3.5.0-beta.3 (September 24, 2018) + +- [#16978](https://github.com/emberjs/ember.js/pull/16978) [BUGFIX] Properly teardown alias +- [#16999](https://github.com/emberjs/ember.js/pull/16999) [BUGFIX] Fix mouseEnter/Leave event delegation w/o jQuery + ### v3.5.0-beta.2 (September 10, 2018) - [#16933](https://github.com/emberjs/ember.js/pull/16933) [BUGFIX] Update glimmer-vm packages to 0.38.8
false
Other
emberjs
ember.js
cdc02da11d9dffd3766d21ead0bdab7de8ac923d.json
Add v3.4.2 to CHANGELOG [ci skip] (cherry picked from commit af8f4ee249f4f16134610b6b6372a9d4ce0a1720)
CHANGELOG.md
@@ -10,7 +10,13 @@ - [#16877](https://github.com/emberjs/ember.js/pull/16877) [CLEANUP] Allow routes to be named "array" and "object" - [#16907](https://github.com/emberjs/ember.js/pull/16907) Upgrade to TypeScript 3.0 +### v3.4.2 (September 24, 2018) + +- [#16860](https://github.com/emberjs/ember.js/pull/16860) [BUGFIX] Clear chains in ProxyMixin when destroyed +- [#16999](https://github.com/emberjs/ember.js/pull/16999) [BUGFIX] Fix mouseEnter/Leave event delegation without jQuery + ### v3.4.1 (September 10, 2018) + - [#16933](https://github.com/emberjs/ember.js/pull/16933) [BUGFIX] Update glimmer-vm packages to 0.38.8 ### v3.4.0 (August 27, 2018)
false
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/@ember/-internals/runtime/tests/helpers/array.js
@@ -171,7 +171,7 @@ class CopyableNativeArray extends AbstractArrayHelper { class CopyableArray extends AbstractArrayHelper { newObject() { - return new CopyableObject(); + return CopyableObject.create(); } isEqual(a, b) { @@ -280,15 +280,15 @@ const CopyableObject = EmberObject.extend(Copyable, { }, copy() { - let ret = new CopyableObject(); + let ret = CopyableObject.create(); set(ret, 'id', get(this, 'id')); return ret; }, }); class MutableArrayHelpers extends NativeArrayHelpers { newObject(ary) { - return new TestMutableArray(super.newObject(ary)); + return TestMutableArray.create(super.newObject(ary)); } // allows for testing of the basic enumerable after an internal mutation @@ -299,7 +299,7 @@ class MutableArrayHelpers extends NativeArrayHelpers { class EmberArrayHelpers extends MutableArrayHelpers { newObject(ary) { - return new TestArray(super.newObject(ary)); + return TestArray.create(super.newObject(ary)); } }
true
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/@ember/-internals/runtime/tests/mixins/array_test.js
@@ -63,7 +63,7 @@ moduleFor( } ['@test slice supports negative index arguments'](assert) { - let testArray = new TestArray({ _content: [1, 2, 3, 4] }); + let testArray = TestArray.create({ _content: [1, 2, 3, 4] }); assert.deepEqual(testArray.slice(-2), [3, 4], 'slice(-2)'); assert.deepEqual(testArray.slice(-2, -1), [3], 'slice(-2, -1'); @@ -248,7 +248,7 @@ moduleFor( 'EmberArray.@each support', class extends AbstractTestCase { beforeEach() { - ary = new TestArray({ + ary = TestArray.create({ _content: [ { isDone: true, desc: 'Todo 1' }, { isDone: false, desc: 'Todo 2' },
true
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/@ember/-internals/runtime/tests/system/core_object_test.js
@@ -6,35 +6,31 @@ import { moduleFor, AbstractTestCase, buildOwner } from 'internal-test-helpers'; moduleFor( 'Ember.CoreObject', class extends AbstractTestCase { - ['@test works with new (one arg)'](assert) { - let obj = new CoreObject({ - firstName: 'Stef', - lastName: 'Penner', - }); - - assert.equal(obj.firstName, 'Stef'); - assert.equal(obj.lastName, 'Penner'); - } - - ['@test works with new (> 1 arg)'](assert) { - let obj = new CoreObject( - { + ['@test throws deprecation with new (one arg)']() { + expectDeprecation(() => { + new CoreObject({ firstName: 'Stef', lastName: 'Penner', - }, - { - other: 'name', - } - ); - - assert.equal(obj.firstName, 'Stef'); - assert.equal(obj.lastName, 'Penner'); + }); + }, /using `new` with EmberObject has been deprecated/); + } - assert.equal(obj.other, undefined); // doesn't support multiple pojo' to the constructor + ['@test throws deprecation with new (> 1 arg)']() { + expectDeprecation(() => { + new CoreObject( + { + firstName: 'Stef', + lastName: 'Penner', + }, + { + other: 'name', + } + ); + }, /using `new` with EmberObject has been deprecated/); } ['@test toString should be not be added as a property when calling toString()'](assert) { - let obj = new CoreObject({ + let obj = CoreObject.create({ firstName: 'Foo', lastName: 'Bar', }); @@ -54,7 +50,7 @@ moduleFor( }, }).create(); - let obj = new CoreObject({ + let obj = CoreObject.create({ someProxyishThing, });
true
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/@ember/-internals/runtime/tests/system/object/computed_test.js
@@ -31,7 +31,7 @@ moduleFor( }), }); - testWithDefault(assert, 'FOO', new MyClass(), 'foo'); + testWithDefault(assert, 'FOO', MyClass.create(), 'foo'); } ['@test computed property on subclass'](assert) { @@ -47,7 +47,7 @@ moduleFor( }), }); - testWithDefault(assert, 'BAR', new Subclass(), 'foo'); + testWithDefault(assert, 'BAR', Subclass.create(), 'foo'); } ['@test replacing computed property with regular val'](assert) { @@ -61,7 +61,7 @@ moduleFor( foo: 'BAR', }); - testWithDefault(assert, 'BAR', new Subclass(), 'foo'); + testWithDefault(assert, 'BAR', Subclass.create(), 'foo'); } ['@test complex depndent keys'](assert) { @@ -83,8 +83,8 @@ moduleFor( count: 20, }); - let obj1 = new MyClass(); - let obj2 = new Subclass(); + let obj1 = MyClass.create(); + let obj2 = Subclass.create(); testWithDefault(assert, 'BIFF 1', obj1, 'foo'); testWithDefault(assert, 'BIFF 21', obj2, 'foo'); @@ -129,7 +129,7 @@ moduleFor( }).property('bar2.baz'), }); - let obj2 = new Subclass(); + let obj2 = Subclass.create(); testWithDefault(assert, 'BIFF2 1', obj2, 'foo');
true
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/@ember/-internals/runtime/tests/system/object/destroy_test.js
@@ -130,13 +130,13 @@ moduleFor( }), }); - objs.a = new A(); + objs.a = A.create(); - objs.b = new B(); + objs.b = B.create(); - objs.c = new C(); + objs.c = C.create(); - new LongLivedObject(); + LongLivedObject.create(); run(() => { let keys = Object.keys(objs);
true
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/@ember/-internals/runtime/tests/system/object/es-compatibility-test.js
@@ -47,25 +47,6 @@ moduleFor( 'passed-property', 'passed property available on instance (create)' ); - calls = []; - myObject = new MyObject({ passedProperty: 'passed-property' }); - - assert.deepEqual(calls, ['constructor', 'init'], 'constructor then init called (new)'); - assert.equal( - myObject.postInitProperty, - 'post-init-property', - 'constructor property available on instance (new)' - ); - assert.equal( - myObject.initProperty, - 'init-property', - 'init property available on instance (new)' - ); - assert.equal( - myObject.passedProperty, - 'passed-property', - 'passed property available on instance (new)' - ); } ['@test normal method super'](assert) { @@ -116,7 +97,7 @@ moduleFor( [Foo, Bar, Baz, Qux, Quux, Corge].forEach((Class, index) => { calls = []; - new Class().method(); + Class.create().method(); assert.deepEqual( calls, @@ -199,22 +180,18 @@ moduleFor( class MyObject extends EmberObject.extend(Mixin1, Mixin2) {} - let myObject = new MyObject(); + let myObject = MyObject.create(); assert.equal(myObject.property1, 'data-1', 'includes the first mixin'); assert.equal(myObject.property2, 'data-2', 'includes the second mixin'); } ['@test using instanceof'](assert) { class MyObject extends EmberObject {} - let myObject1 = MyObject.create(); - let myObject2 = new MyObject(); + let myObject = MyObject.create(); - assert.ok(myObject1 instanceof MyObject); - assert.ok(myObject1 instanceof EmberObject); - - assert.ok(myObject2 instanceof MyObject); - assert.ok(myObject2 instanceof EmberObject); + assert.ok(myObject instanceof MyObject); + assert.ok(myObject instanceof EmberObject); } ['@test extending an ES subclass of EmberObject'](assert) { @@ -236,10 +213,6 @@ moduleFor( MyObject.create(); assert.deepEqual(calls, ['constructor', 'init'], 'constructor then init called (create)'); - - calls = []; - new MyObject(); - assert.deepEqual(calls, ['constructor', 'init'], 'constructor then init called (new)'); } ['@test calling extend on an ES subclass of EmberObject'](assert) { @@ -268,14 +241,6 @@ moduleFor( 'constructor then init called (create)' ); - calls = []; - new MyObject(); - assert.deepEqual( - calls, - ['before constructor', 'init', 'after constructor'], - 'constructor then init called (new)' - ); - let obj = MyObject.create({ foo: 456, bar: 789,
true
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/@ember/-internals/runtime/tests/system/object/extend_test.js
@@ -8,14 +8,14 @@ moduleFor( ['@test Basic extend'](assert) { let SomeClass = EmberObject.extend({ foo: 'BAR' }); assert.ok(SomeClass.isClass, 'A class has isClass of true'); - let obj = new SomeClass(); + let obj = SomeClass.create(); assert.equal(obj.foo, 'BAR'); } ['@test Sub-subclass'](assert) { let SomeClass = EmberObject.extend({ foo: 'BAR' }); let AnotherClass = SomeClass.extend({ bar: 'FOO' }); - let obj = new AnotherClass(); + let obj = AnotherClass.create(); assert.equal(obj.foo, 'BAR'); assert.equal(obj.bar, 'FOO'); } @@ -49,7 +49,7 @@ moduleFor( }, }); - let obj = new FinalClass(); + let obj = FinalClass.create(); obj.foo(); obj.bar(); assert.equal(obj.fooCnt, 2, 'should invoke both'); @@ -76,9 +76,9 @@ moduleFor( }); let AnotherClass = SomeClass.extend({ things: 'bar' }); let YetAnotherClass = SomeClass.extend({ things: 'baz' }); - let some = new SomeClass(); - let another = new AnotherClass(); - let yetAnother = new YetAnotherClass(); + let some = SomeClass.create(); + let another = AnotherClass.create(); + let yetAnother = YetAnotherClass.create(); assert.deepEqual(some.get('things'), ['foo'], 'base class should have just its value'); assert.deepEqual( another.get('things'), @@ -102,9 +102,9 @@ moduleFor( AnotherClass.reopenClass({ things: 'bar' }); let YetAnotherClass = SomeClass.extend(); YetAnotherClass.reopenClass({ things: 'baz' }); - let some = new SomeClass(); - let another = new AnotherClass(); - let yetAnother = new YetAnotherClass(); + let some = SomeClass.create(); + let another = AnotherClass.create(); + let yetAnother = YetAnotherClass.create(); assert.deepEqual( get(some.constructor, 'things'), ['foo'],
true
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/@ember/-internals/runtime/tests/system/object/observer_test.js
@@ -15,7 +15,7 @@ moduleFor( }), }); - let obj = new MyClass(); + let obj = MyClass.create(); assert.equal(get(obj, 'count'), 0, 'should not invoke observer immediately'); set(obj, 'bar', 'BAZ'); @@ -37,7 +37,7 @@ moduleFor( }), }); - let obj = new Subclass(); + let obj = Subclass.create(); assert.equal(get(obj, 'count'), 0, 'should not invoke observer immediately'); set(obj, 'bar', 'BAZ'); @@ -200,7 +200,7 @@ moduleFor( }, }); - let parent = new ParentClass(); + let parent = ParentClass.create(); assert.equal(changed, false, 'precond');
true
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/@ember/-internals/runtime/tests/system/object/reopen_test.js
@@ -14,8 +14,8 @@ moduleFor( bar: 'BAR', }); - assert.equal(new Subclass().foo(), 'FOO', 'Adds method'); - assert.equal(get(new Subclass(), 'bar'), 'BAR', 'Adds property'); + assert.equal(Subclass.create().foo(), 'FOO', 'Adds method'); + assert.equal(get(Subclass.create(), 'bar'), 'BAR', 'Adds property'); } ['@test reopened properties inherited by subclasses'](assert) { @@ -29,8 +29,8 @@ moduleFor( bar: 'BAR', }); - assert.equal(new SubSub().foo(), 'FOO', 'Adds method'); - assert.equal(get(new SubSub(), 'bar'), 'BAR', 'Adds property'); + assert.equal(SubSub.create().foo(), 'FOO', 'Adds method'); + assert.equal(get(SubSub.create(), 'bar'), 'BAR', 'Adds property'); } ['@test allows reopening already instantiated classes'](assert) {
true
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/ember-testing/lib/setup_for_testing.js
@@ -29,7 +29,7 @@ export default function setupForTesting() { let adapter = getAdapter(); // if adapter is not manually set default to QUnit if (!adapter) { - setAdapter(typeof self.QUnit === 'undefined' ? new Adapter() : new QUnitAdapter()); + setAdapter(typeof self.QUnit === 'undefined' ? Adapter.create() : QUnitAdapter.create()); } if (!jQueryDisabled) {
true
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/ember-testing/tests/adapters/adapter_test.js
@@ -9,7 +9,7 @@ moduleFor( class extends AbstractTestCase { constructor() { super(); - adapter = new Adapter(); + adapter = Adapter.create(); } teardown() {
true
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/ember-testing/tests/adapters/qunit_test.js
@@ -15,7 +15,7 @@ moduleFor( delete QUnit.start; delete QUnit.stop; - adapter = new QUnitAdapter(); + adapter = QUnitAdapter.create(); } teardown() {
true
Other
emberjs
ember.js
9a817d4de69e8b57ce9b85bf496ab5d6919353a0.json
remove new usage from tests
packages/internal-test-helpers/lib/build-owner.js
@@ -25,7 +25,7 @@ export default function buildOwner(options = {}) { let Owner = EmberObject.extend(RegistryProxyMixin, ContainerProxyMixin); - let namespace = new EmberObject({ + let namespace = EmberObject.create({ Resolver: new ResolverWrapper(resolver), });
true
Other
emberjs
ember.js
246435e7260f45d9e5cc35a4a8b4de4f011f3625.json
avoid double define for native descriptors
packages/@ember/-internals/metal/lib/alias.ts
@@ -31,6 +31,7 @@ export class AliasedProperty extends Descriptor implements DescriptorWithDepende setup(obj: object, keyName: string): void { assert(`Setting alias '${keyName}' on self`, this.altKey !== keyName); + super.setup(obj, keyName); let meta = metaFor(obj); if (meta.peekWatching(keyName) > 0) { addDependentKeys(this, obj, keyName, meta);
true
Other
emberjs
ember.js
246435e7260f45d9e5cc35a4a8b4de4f011f3625.json
avoid double define for native descriptors
packages/@ember/-internals/metal/lib/descriptor.ts
@@ -1,25 +1,25 @@ -import { Descriptor as EmberDescriptor } from './properties'; +import { Descriptor } from './properties'; export default function descriptor(desc: PropertyDescriptor) { - return new Descriptor(desc); + return new NativeDescriptor(desc); } /** A wrapper for a native ES5 descriptor. In an ideal world, we wouldn't need this at all, however, the way we currently flatten/merge our mixins require a special value to denote a descriptor. - @class Descriptor + @class NativeDescriptor @private */ -class Descriptor extends EmberDescriptor { +class NativeDescriptor extends Descriptor { desc: PropertyDescriptor; - enumerable: boolean; constructor(desc: PropertyDescriptor) { super(); this.desc = desc; this.enumerable = desc.enumerable !== false; + this.configurable = desc.configurable !== false; } setup(obj: object, key: string) {
true
Other
emberjs
ember.js
246435e7260f45d9e5cc35a4a8b4de4f011f3625.json
avoid double define for native descriptors
packages/@ember/-internals/metal/lib/properties.ts
@@ -27,14 +27,18 @@ export type InheritingGetterFunction = ((this: object) => void) & { @private */ export abstract class Descriptor { - isDescriptor: boolean; - enumerable: boolean; - constructor() { - this.isDescriptor = true; - this.enumerable = true; + isDescriptor = true; + enumerable = true; + configurable = true; + + setup(obj: object, keyName: string): void { + Object.defineProperty(obj, keyName, { + enumerable: this.enumerable, + configurable: this.configurable, + get: DESCRIPTOR_GETTER_FUNCTION(keyName, this), + }); } - setup(_obj: object, _keyName: string): void {} teardown(_obj: object, _keyName: string, _meta: Meta): void {} abstract get(obj: object, keyName: string): any | null | undefined; @@ -188,16 +192,8 @@ export function defineProperty( let value; if (desc instanceof Descriptor) { value = desc; - - Object.defineProperty(obj, keyName, { - configurable: true, - enumerable, - get: DESCRIPTOR_GETTER_FUNCTION(keyName, value), - }); - - meta.writeDescriptors(keyName, value); - desc.setup(obj, keyName); + meta.writeDescriptors(keyName, value); } else if (desc === undefined || desc === null) { value = data;
true
Other
emberjs
ember.js
246435e7260f45d9e5cc35a4a8b4de4f011f3625.json
avoid double define for native descriptors
packages/@ember/-internals/metal/lib/property_get.ts
@@ -131,14 +131,6 @@ export function get(obj: object, keyName: string): any { } ); - Object.defineProperty(obj, keyName, { - configurable: true, - enumerable: value.enumerable === false, - get() { - return value.get(this, keyName); - }, - }); - meta(obj).writeDescriptors(keyName, value); value.setup(obj, keyName);
true
Other
emberjs
ember.js
246435e7260f45d9e5cc35a4a8b4de4f011f3625.json
avoid double define for native descriptors
packages/@ember/-internals/metal/lib/property_set.ts
@@ -108,14 +108,6 @@ export function set(obj: object, keyName: string, value: any, tolerant?: boolean let cv: Descriptor = currentValue; - Object.defineProperty(obj, keyName, { - configurable: true, - enumerable: cv.enumerable === false, - get() { - return cv.get(this, keyName); - }, - }); - meta(obj).writeDescriptors(keyName, cv); cv.setup(obj, keyName);
true
Other
emberjs
ember.js
246435e7260f45d9e5cc35a4a8b4de4f011f3625.json
avoid double define for native descriptors
packages/@ember/-internals/metal/tests/descriptor_test.js
@@ -1,6 +1,7 @@ import { Object as EmberObject } from '@ember/-internals/runtime'; import { Mixin, defineProperty, descriptor } from '..'; import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; +import { isEdge } from 'internal-test-helpers'; let classes = [ class { @@ -148,7 +149,7 @@ let classes = [ }, ]; -classes.forEach(TestClass => { +classes.forEach((TestClass, testCaseIndex) => { moduleFor( TestClass.module('@ember/-internals/metal/descriptor'), class extends AbstractTestCase { @@ -182,7 +183,12 @@ classes.forEach(TestClass => { let source = factory.source(); - assert.throws(() => delete source.foo, TypeError); + if (isEdge && testCaseIndex === 0) { + // https://github.com/emberjs/ember.js/pull/16741#issuecomment-420963181 + assert.equal(delete source.foo, false); + } else { + assert.throws(() => delete source.foo, TypeError); + } assert.throws( () =>
true
Other
emberjs
ember.js
246435e7260f45d9e5cc35a4a8b4de4f011f3625.json
avoid double define for native descriptors
packages/internal-test-helpers/index.js
@@ -27,5 +27,5 @@ export { ModuleBasedResolver as ModuleBasedTestResolver, } from './lib/test-resolver'; -export { isIE11 } from './lib/browser-detect'; +export { isIE11, isEdge } from './lib/browser-detect'; export { verifyInjection, verifyRegistration } from './lib/registry-check';
true
Other
emberjs
ember.js
246435e7260f45d9e5cc35a4a8b4de4f011f3625.json
avoid double define for native descriptors
packages/internal-test-helpers/lib/browser-detect.ts
@@ -8,3 +8,4 @@ declare global { } } export const isIE11 = !window.ActiveXObject && 'ActiveXObject' in window; +export const isEdge = /Edge/.test(navigator.userAgent);
true
Other
emberjs
ember.js
a34fb0e3db9a62776e9034eadb89fac1393415a8.json
Replace Slack badge with Discord
README.md
@@ -5,7 +5,7 @@ <p align="center"> <a href="http://travis-ci.org/emberjs/ember.js"><img src="https://secure.travis-ci.org/emberjs/ember.js.svg?branch=master" alt="Build Status"></a> <a href="https://codeclimate.com/github/emberjs/ember.js"><img src="https://codeclimate.com/github/emberjs/ember.js.svg" alt="Code Climate"></a> - <a href="https://ember-community-slackin.herokuapp.com"><img src="https://ember-community-slackin.herokuapp.com/badge.svg" alt="Build Status"></a> + <a href="https://discord.gg/zT3asNS"><img src="https://img.shields.io/discord/480462759797063690.svg?logo=discord" alt="Discord Community Server"></a> </p> Ember.js is a JavaScript framework that greatly reduces the time, effort and resources needed
false
Other
emberjs
ember.js
ddc2ae169f3e77575853f9f1086a05b1dac0a2b0.json
Add v3.5.0-beta.2 to CHANGELOG [ci skip] (cherry picked from commit 9ed7321a3bdf5d5ec4f16ac294224bf8c8760665)
CHANGELOG.md
@@ -1,5 +1,10 @@ # Ember Changelog +### v3.5.0-beta.2 (September 10, 2018) + +- [#16933](https://github.com/emberjs/ember.js/pull/16933) [BUGFIX] Update glimmer-vm packages to 0.38.8 +- [#16860](https://github.com/emberjs/ember.js/pull/16860) [BUGFIX] Clear chains in ProxyMixin when destroyed + ### v3.5.0-beta.1 (August 28, 2018) - [#16877](https://github.com/emberjs/ember.js/pull/16877) [CLEANUP] Allow routes to be named "array" and "object"
false
Other
emberjs
ember.js
9930a8b390158fc335990e28382213c4969c2307.json
Add v3.4.1 to CHANGELOG [ci skip] (cherry picked from commit e0317d4aa9b506a552d4610034bd9fa644bd47ed)
CHANGELOG.md
@@ -5,6 +5,9 @@ - [#16877](https://github.com/emberjs/ember.js/pull/16877) [CLEANUP] Allow routes to be named "array" and "object" - [#16907](https://github.com/emberjs/ember.js/pull/16907) Upgrade to TypeScript 3.0 +### v3.4.1 (September 10, 2018) +- [#16933](https://github.com/emberjs/ember.js/pull/16933) [BUGFIX] Update glimmer-vm packages to 0.38.8 + ### v3.4.0 (August 27, 2018) - [#16603](https://github.com/emberjs/ember.js/pull/16603) [BUGFIX] Support mouseEnter/Leave events w/o jQuery
false
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
.eslintrc.js
@@ -15,6 +15,7 @@ module.exports = { rules: { 'semi': 'error', 'no-unused-vars': 'error', + 'no-throw-literal': 'error', 'no-useless-escape': 'off', // TODO: bring this back 'prettier/prettier': 'error', }, @@ -79,6 +80,7 @@ module.exports = { 'semi': 'error', 'no-unused-vars': 'error', + 'no-throw-literal': 'error', 'comma-dangle': 'off', }, }, @@ -134,6 +136,7 @@ module.exports = { rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, { // add your custom rules and overrides for node files here 'no-process-exit': 'off', + 'no-throw-literal': 'error' }), }, {
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/component-test/index.js
@@ -39,14 +39,14 @@ module.exports = useTestFrameworkDetector({ }, __testType__(options) { if (options.locals.testType === 'unit') { - throw "The --unit flag isn't supported within a module unification app"; + throw new Error("The --unit flag isn't supported within a module unification app"); } return ''; }, __path__(options) { if (options.pod) { - throw "Pods aren't supported within a module unification app"; + throw new Error("Pods aren't supported within a module unification app"); } return path.join('ui', 'components', options.dasherizedModuleName); },
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/controller-test/index.js
@@ -28,7 +28,7 @@ module.exports = useTestFrameworkDetector({ }, __root__(options) { if (options.pod) { - throw "Pods aren't supported within a module unification app"; + throw new Error("Pods aren't supported within a module unification app"); } return 'src'; },
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/controller/index.js
@@ -10,7 +10,7 @@ module.exports = { return { __root__(options) { if (options.pod) { - throw "Pods aren't supported within a module unification app"; + throw new Error("Pods aren't supported within a module unification app"); } if (options.inDummy) { return path.join('tests', 'dummy', 'src');
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/initializer-test/index.js
@@ -15,7 +15,7 @@ module.exports = useTestFrameworkDetector({ return { __root__(options) { if (options.pod) { - throw 'Pods arenʼt supported within a module unification app'; + throw new Error('Pods arenʼt supported within a module unification app'); } else if (options.inDummy) { return path.join('tests', 'dummy', 'src', 'init'); }
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/initializer/index.js
@@ -11,7 +11,7 @@ module.exports = { return { __root__(options) { if (options.pod) { - throw 'Pods arenʼt supported within a module unification app'; + throw new Error('Pods arenʼt supported within a module unification app'); } else if (options.inDummy) { return path.join('tests', 'dummy', 'src/init'); }
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/mixin-test/index.js
@@ -13,7 +13,7 @@ module.exports = useTestFrameworkDetector({ return { __root__(options) { if (options.pod) { - throw "Pods aren't supported within a module unification app"; + throw new Error("Pods aren't supported within a module unification app"); } return 'src';
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/mixin/index.js
@@ -10,7 +10,7 @@ module.exports = { return { __root__(options) { if (options.pod) { - throw "Pods aren't supported within a module unification app"; + throw new Error("Pods aren't supported within a module unification app"); } return 'src';
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/route/index.js
@@ -32,7 +32,7 @@ module.exports = { return { __root__(options) { if (options.pod) { - throw "Pods aren't supported within a module unification app"; + throw new Error("Pods aren't supported within a module unification app"); } if (options.inDummy) { return path.join('tests', 'dummy', 'src');
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/service-test/index.js
@@ -11,7 +11,7 @@ module.exports = useTestFrameworkDetector({ return { __root__(options) { if (options.pod) { - throw "Pods aren't supported within a module unification app"; + throw new Error("Pods aren't supported within a module unification app"); } return 'src';
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/service/index.js
@@ -10,7 +10,7 @@ module.exports = { return { __root__(options) { if (options.pod) { - throw "Pods aren't supported within a module unification app"; + throw new Error("Pods aren't supported within a module unification app"); } return 'src';
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/template/index.js
@@ -10,7 +10,7 @@ module.exports = { return { __root__(options) { if (options.pod) { - throw "Pods aren't supported within a module unification app"; + throw new Error("Pods aren't supported within a module unification app"); } else if (options.inDummy) { return 'tests/dummy/src/ui/routes'; } else {
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/util-test/index.js
@@ -14,7 +14,7 @@ module.exports = useTestFrameworkDetector({ return { __root__(options) { if (options.pod) { - throw "Pods aren't supported within a module unification app"; + throw new Error("Pods aren't supported within a module unification app"); } return 'src';
true
Other
emberjs
ember.js
6d2e29bbe7dd760235ae8f95e790d2de3cd99654.json
fix: forbid throwing of literals
blueprints/util/index.js
@@ -10,7 +10,7 @@ module.exports = { return { __root__(options) { if (options.pod) { - throw "Pods aren't supported within a module unification app"; + throw new Error("Pods aren't supported within a module unification app"); } return 'src';
true