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
f8d551721102c6b430a884bc256cf77c9edcff36.json
fix jshint warnings A recent version of jshint has begun finding problems that were missed by earlier versions. This cleans them up.
packages/ember-runtime/tests/ext/rsvp_test.js
@@ -1,4 +1,3 @@ -/* global Promise:true */ import Ember from 'ember-metal/core'; import run from 'ember-metal/run_loop'; import RSVP from 'ember-runtime/ext/rsvp'; @@ -22,7 +21,6 @@ QUnit.test('Ensure that errors thrown from within a promise are sent to the cons var asyncStarted = 0; var asyncEnded = 0; -var Promise = RSVP.Promise; var EmberTest; var EmberTesting; @@ -64,7 +62,7 @@ QUnit.test('given `Ember.testing = true`, correctly informs the test suite about equal(asyncStarted, 0); equal(asyncEnded, 0); - var user = Promise.resolve({ + var user = RSVP.Promise.resolve({ name: 'tomster' }); @@ -77,15 +75,15 @@ QUnit.test('given `Ember.testing = true`, correctly informs the test suite about equal(user.name, 'tomster'); - return Promise.resolve(1).then(function() { + return RSVP.Promise.resolve(1).then(function() { equal(asyncStarted, 1); equal(asyncEnded, 1); }); }).then(function() { equal(asyncStarted, 1); equal(asyncEnded, 1); - return new Promise(function(resolve) { + return new RSVP.Promise(function(resolve) { QUnit.stop(); // raw async, we must inform the test framework manually setTimeout(function() { QUnit.start(); // raw async, we must inform the test framework manually @@ -270,7 +268,7 @@ QUnit.test('handled in the same microTask Queue flush do to data locality', func // it depends on the locality of `user#1` var store = { find() { - return Promise.resolve(1); + return RSVP.Promise.resolve(1); } };
true
Other
emberjs
ember.js
325e9e3c7a6253654a68a8ac9d85305465827907.json
Update HTMLBars to 0.14.13.
package.json
@@ -33,7 +33,7 @@ "finalhandler": "^0.4.0", "github": "^0.2.3", "glob": "~4.3.2", - "htmlbars": "0.14.12", + "htmlbars": "0.14.13", "qunit-extras": "^1.4.0", "qunitjs": "^1.20.0", "route-recognizer": "0.1.5",
false
Other
emberjs
ember.js
7c5a5ce8ac34bd4bdecf2c33858b09e56ee61937.json
Improve tests for thrown errors
packages/container/tests/registry_test.js
@@ -74,7 +74,7 @@ QUnit.test('Throw exception when trying to inject `type:thing` on all type(s)', throws(function() { registry.typeInjection('controller', 'injected', 'controller:post'); - }, 'Cannot inject a `controller:post` on other controller(s).'); + }, /Cannot inject a `controller:post` on other controller\(s\)\./); }); QUnit.test('The registry can take a hook to resolve factories lazily', function() { @@ -144,7 +144,7 @@ QUnit.test('validateFullName throws an error if name is incorrect', function() { registry.register('controller:post', PostController); throws(function() { registry.resolve('post'); - }, 'TypeError: Invalid Fullname, expected: `type:name` got: post'); + }, /TypeError: Invalid Fullname, expected: `type:name` got: post/); }); QUnit.test('The registry normalizes names when injecting', function() { @@ -192,7 +192,7 @@ QUnit.test('cannot re-register a factory if it has been resolved', function() { throws(function() { registry.register('controller:apple', SecondApple); - }, 'Cannot re-register: `controller:apple`, as it has already been resolved.'); + }, /Cannot re-register: `controller:apple`, as it has already been resolved\./); strictEqual(registry.resolve('controller:apple'), FirstApple); });
false
Other
emberjs
ember.js
c76b09221a320835ff45d462f1b38d29ea124b26.json
Add a test for falsy value from resolvers
packages/container/tests/registry_test.js
@@ -43,6 +43,19 @@ QUnit.test('The registered value returned from resolve is the same value each ti strictEqual(registry.resolve('falsy:value'), registry.resolve('falsy:value'), 'The return of resolve is always the same'); }); +QUnit.test('The value returned from resolver is the same value as the original value even if the value is falsy', function() { + let resolver = { + resolve(fullName) { + if (fullName === 'falsy:value') { + return null; + } + } + }; + let registry = new Registry({ resolver }); + + strictEqual(registry.resolve('falsy:value'), null); +}); + QUnit.test('A registered factory returns true for `has` if an item is registered', function() { var registry = new Registry(); var PostController = factory();
false
Other
emberjs
ember.js
6d35451afc677d9452c7b50f798fbc6e73e351e6.json
Use strictEqual for rigid comparison
packages/container/tests/container_test.js
@@ -269,7 +269,7 @@ QUnit.test('Injecting a falsy value does not raise an error', function() { registry.register('user:current', null, { instantiate: false }); registry.injection('controller:application', 'currentUser', 'user:current'); - deepEqual(container.lookup('controller:application').currentUser, null); + strictEqual(container.lookup('controller:application').currentUser, null); }); QUnit.test('The container returns same value each time even if the value is falsy', function() { @@ -278,7 +278,7 @@ QUnit.test('The container returns same value each time even if the value is fals registry.register('falsy:value', null, { instantiate: false }); - deepEqual(container.lookup('falsy:value'), container.lookup('falsy:value')); + strictEqual(container.lookup('falsy:value'), container.lookup('falsy:value')); }); QUnit.test('Destroying the container destroys any cached singletons', function() {
true
Other
emberjs
ember.js
6d35451afc677d9452c7b50f798fbc6e73e351e6.json
Use strictEqual for rigid comparison
packages/container/tests/registry_test.js
@@ -40,7 +40,7 @@ QUnit.test('The registered value returned from resolve is the same value each ti registry.register('falsy:value', null, { instantiate: false }); - deepEqual(registry.resolve('falsy:value'), registry.resolve('falsy:value'), 'The return of resolve is always the same'); + strictEqual(registry.resolve('falsy:value'), registry.resolve('falsy:value'), 'The return of resolve is always the same'); }); QUnit.test('A registered factory returns true for `has` if an item is registered', function() {
true
Other
emberjs
ember.js
c5492eab98599172af1529e2da29075f8632722c.json
Add 2.2.0-beta.3 to CHANGELOG.md.
CHANGELOG.md
@@ -1,5 +1,18 @@ # Ember Changelog +### v2.3.0-beta.3 (December 19, 2015) + +- [#12659](https://github.com/emberjs/ember.js/pull/12659) [BUGFIX] Update HTMLBars to 0.14.7. +- [#12666](https://github.com/emberjs/ember.js/pull/12666) [BUGFIX] Prevent triggering V8 memory leak bug through registry / resolver access. +- [#12677](https://github.com/emberjs/ember.js/pull/12677) [BUGFIX] Remove FastBoot monkeypatches. +- [#12680](https://github.com/emberjs/ember.js/pull/12680) [BUGFIX] Clear cached instances when factories are unregistered. +- [#12682](https://github.com/emberjs/ember.js/pull/12682) [BUGFIX] Fix rerendering contextual components when invoked with dot syntax and block form. +- [#12686](https://github.com/emberjs/ember.js/pull/12686) [BUGFIX] Ensure HTML safe warning is not thrown for `null` and `undefined` values. +- [#12699](https://github.com/emberjs/ember.js/pull/12699) [BUGFIX] Only add deprecated container after create when present (prevents errors when non-extendable factory is frozen after creation). +- [#12705](https://github.com/emberjs/ember.js/pull/12705) [BUGFIX] Fix FastBoot URL parsing crash. +- [#12728](https://github.com/emberjs/ember.js/pull/12728) [BUGFIX] Fix incorrect export for `Ember.computed.collect`. +- [#12731](https://github.com/emberjs/ember.js/pull/12731) [BUGFIX] Ensure `container` can still be provided to `.create` (prevents an error and provides a helpful deprecation). + ### v2.3.0-beta.2 (November 29, 2015) - [#12626](https://github.com/emberjs/ember.js/pull/12626) [BUGFIX] Fix "rest" style positional params in contextual components when using dot syntax.
false
Other
emberjs
ember.js
1f8c70bd0af18afbfb20517b76c8752625872e3f.json
[BUGFIX beta] MandatorySetter: Restore properties correctly * no longer rely on meta to store the value until next set after uninstalling MandatorySetter * no longer incorrectly re-set on set to enumerable (enumerability should remain constant) * test both enumerable / non-enumerable variants
packages/ember-metal/lib/watch_key.js
@@ -38,6 +38,9 @@ export function watchKey(obj, keyName, meta) { if (isEnabled('mandatory-setter')) { + // Future traveler, although this code looks scary. It merely exists in + // development to aid in development asertions. Production builds of + // ember strip this entire block out handleMandatorySetter = function handleMandatorySetter(m, obj, keyName) { let descriptor = lookupDescriptor(obj, keyName); var configurable = descriptor ? descriptor.configurable : true; @@ -68,7 +71,10 @@ export function unwatchKey(obj, keyName, meta) { m.writeWatching(keyName, 0); var possibleDesc = obj[keyName]; - var desc = (possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor) ? possibleDesc : undefined; + var desc = (possibleDesc !== null && + typeof possibleDesc === 'object' && + possibleDesc.isDescriptor) ? possibleDesc : undefined; + if (desc && desc.didUnwatch) { desc.didUnwatch(obj, keyName); } if ('function' === typeof obj.didUnwatchProperty) { @@ -85,23 +91,17 @@ export function unwatchKey(obj, keyName, meta) { // that occurs, and attempt to provide more helpful feedback. The alternative // is tricky to debug partially observable properties. if (!desc && keyName in obj) { - var maybeMandatoryDescriptor = lookupDescriptor(obj, keyName); + let maybeMandatoryDescriptor = lookupDescriptor(obj, keyName); + if (maybeMandatoryDescriptor.set && maybeMandatoryDescriptor.set.isMandatorySetter) { + let isEnumerable = Object.prototype.propertyIsEnumerable.call(obj, keyName); Object.defineProperty(obj, keyName, { configurable: true, - enumerable: Object.prototype.propertyIsEnumerable.call(obj, keyName), - set(val) { - // redefine to set as enumerable - Object.defineProperty(obj, keyName, { - configurable: true, - writable: true, - enumerable: true, - value: val - }); - m.deleteFromValues(keyName); - }, - get: DEFAULT_GETTER_FUNCTION(keyName) + enumerable: isEnumerable, + writable: true, + value: m.peekValues(keyName) }); + m.deleteFromValues(keyName); } } }
true
Other
emberjs
ember.js
1f8c70bd0af18afbfb20517b76c8752625872e3f.json
[BUGFIX beta] MandatorySetter: Restore properties correctly * no longer rely on meta to store the value until next set after uninstalling MandatorySetter * no longer incorrectly re-set on set to enumerable (enumerability should remain constant) * test both enumerable / non-enumerable variants
packages/ember-metal/tests/accessors/mandatory_setters_test.js
@@ -7,6 +7,14 @@ import { meta as metaFor } from 'ember-metal/meta'; QUnit.module('mandatory-setters'); function hasMandatorySetter(object, property) { + try { + return Object.getOwnPropertyDescriptor(object, property).set.isMandatorySetter === true; + } catch(e) { + return false; + } +} + +function hasMetaValue(object, property) { return metaFor(object).hasInValues(property); } @@ -235,6 +243,109 @@ if (isEnabled('mandatory-setter')) { ok(!(hasMandatorySetter(obj, 'someProp')), 'blastix'); }); + QUnit.test('ensure after watch the property is restored (and the value is no-longer stored in meta) [non-enumerable]', function() { + var obj = { + someProp: null, + toString() { + return 'custom-object'; + } + }; + + Object.defineProperty(obj, 'someProp', { + configurable: true, + enumerable: false, + value: 'blastix' + }); + + watch(obj, 'someProp'); + equal(hasMandatorySetter(obj, 'someProp'), true, 'should have a mandatory setter'); + + let descriptor = Object.getOwnPropertyDescriptor(obj, 'someProp'); + + equal(descriptor.enumerable, false, 'property should remain non-enumerable'); + equal(descriptor.configurable, true, 'property should remain configurable'); + equal(obj.someProp, 'blastix', 'expected value to be the getter'); + + equal(descriptor.value, undefined, 'expected existing value to NOT remain'); + + ok(hasMetaValue(obj, 'someProp'), 'someProp is stored in meta.values'); + + unwatch(obj, 'someProp'); + + ok(!hasMetaValue(obj, 'someProp'), 'someProp is no longer stored in meta.values'); + + descriptor = Object.getOwnPropertyDescriptor(obj, 'someProp'); + + equal(hasMandatorySetter(obj, 'someProp'), false, 'should no longer have a mandatory setter'); + + equal(descriptor.enumerable, false, 'property should remain non-enumerable'); + equal(descriptor.configurable, true, 'property should remain configurable'); + equal(obj.someProp, 'blastix', 'expected value to be the getter'); + equal(descriptor.value, 'blastix', 'expected existing value to remain'); + + obj.someProp = 'new value'; + + // make sure the descriptor remains correct (nothing funky, like a redefined, happened in the setter); + descriptor = Object.getOwnPropertyDescriptor(obj, 'someProp'); + + equal(descriptor.enumerable, false, 'property should remain non-enumerable'); + equal(descriptor.configurable, true, 'property should remain configurable'); + equal(descriptor.value, 'new value', 'expected existing value to NOT remain'); + equal(obj.someProp, 'new value', 'expected value to be the getter'); + equal(obj.someProp, 'new value'); + }); + + QUnit.test('ensure after watch the property is restored (and the value is no-longer stored in meta) [enumerable]', function() { + var obj = { + someProp: null, + toString() { + return 'custom-object'; + } + }; + + Object.defineProperty(obj, 'someProp', { + configurable: true, + enumerable: true, + value: 'blastix' + }); + + watch(obj, 'someProp'); + equal(hasMandatorySetter(obj, 'someProp'), true, 'should have a mandatory setter'); + + let descriptor = Object.getOwnPropertyDescriptor(obj, 'someProp'); + + equal(descriptor.enumerable, true, 'property should remain enumerable'); + equal(descriptor.configurable, true, 'property should remain configurable'); + equal(obj.someProp, 'blastix', 'expected value to be the getter'); + + equal(descriptor.value, undefined, 'expected existing value to NOT remain'); + + ok(hasMetaValue(obj, 'someProp'), 'someProp is stored in meta.values'); + + unwatch(obj, 'someProp'); + + ok(!hasMetaValue(obj, 'someProp'), 'someProp is no longer stored in meta.values'); + + descriptor = Object.getOwnPropertyDescriptor(obj, 'someProp'); + + equal(hasMandatorySetter(obj, 'someProp'), false, 'should no longer have a mandatory setter'); + + equal(descriptor.enumerable, true, 'property should remain enumerable'); + equal(descriptor.configurable, true, 'property should remain configurable'); + equal(obj.someProp, 'blastix', 'expected value to be the getter'); + equal(descriptor.value, 'blastix', 'expected existing value to remain'); + + obj.someProp = 'new value'; + + // make sure the descriptor remains correct (nothing funky, like a redefined, happened in the setter); + descriptor = Object.getOwnPropertyDescriptor(obj, 'someProp'); + + equal(descriptor.enumerable, true, 'property should remain enumerable'); + equal(descriptor.configurable, true, 'property should remain configurable'); + equal(descriptor.value, 'new value', 'expected existing value to NOT remain'); + equal(obj.someProp, 'new value'); + }); + QUnit.test('sets up mandatory-setter if property comes from prototype', function() { expect(2);
true
Other
emberjs
ember.js
8eefbe471053d0ce76e7d65fda8fa4d7825a6bca.json
Remove extra `getOwner` invocations. Calling `getOwner(route)` here is pretty fast, but it still seems silly to do it so many times.
packages/ember-routing/lib/system/route.js
@@ -2101,6 +2101,7 @@ function buildRenderOptions(route, namePassed, isDefaultRender, name, options) { var LOG_VIEW_LOOKUPS = get(route.router, 'namespace.LOG_VIEW_LOOKUPS'); var into = options && options.into && options.into.replace(/\//g, '.'); var outlet = (options && options.outlet) || 'main'; + let owner = getOwner(route); if (name) { name = name.replace(/\//g, '.'); @@ -2112,15 +2113,15 @@ function buildRenderOptions(route, namePassed, isDefaultRender, name, options) { if (!controller) { if (namePassed) { - controller = getOwner(route).lookup(`controller:${name}`) || route.controllerName || route.routeName; + controller = owner.lookup(`controller:${name}`) || route.controllerName || route.routeName; } else { - controller = route.controllerName || getOwner(route).lookup(`controller:${name}`); + controller = route.controllerName || owner.lookup(`controller:${name}`); } } if (typeof controller === 'string') { var controllerName = controller; - controller = getOwner(route).lookup(`controller:${controllerName}`); + controller = owner.lookup(`controller:${controllerName}`); if (!controller) { throw new EmberError(`You passed \`controller: '${controllerName}'\` into the \`render\` method, but no such controller could be found.`); } @@ -2134,7 +2135,6 @@ function buildRenderOptions(route, namePassed, isDefaultRender, name, options) { controller.set('model', options.model); } - let owner = getOwner(route); viewName = options && options.view || namePassed && name || route.viewName || name; ViewClass = owner._lookupFactory(`view:${viewName}`); template = owner.lookup(`template:${templateName}`); @@ -2145,12 +2145,12 @@ function buildRenderOptions(route, namePassed, isDefaultRender, name, options) { } var renderOptions = { - into: into, - outlet: outlet, - name: name, - controller: controller, - ViewClass: ViewClass, - template: template + into, + outlet, + name, + controller, + ViewClass, + template }; let Component;
false
Other
emberjs
ember.js
3a9fef7984666f8d913a7e215099d816153cf946.json
Update emberjs-build to v0.5.4. Includes updated broccoli-merge-trees that drammatically reduces rebuild time (from 2.5s to .5s for simple change operations).
package.json
@@ -28,7 +28,7 @@ "ember-cli-sauce": "^1.4.2", "ember-cli-yuidoc": "0.7.0", "ember-publisher": "0.0.7", - "emberjs-build": "0.5.3", + "emberjs-build": "0.5.4", "express": "^4.5.0", "finalhandler": "^0.4.0", "github": "^0.2.3",
false
Other
emberjs
ember.js
8c8fe83d45d08ae38ad0a73dc5576455abb31030.json
Use EmptyObject for `dictionary(null)`. A huge number of usages of `ember-metal/dictionary` are using `null` as the parent. Creating a `new EmptyObject()` is quite a bit faster than `Object.create(null)` (see comments in `ember-metal/empty_object` for details). Note: we are working around an issue with QUnit due to using constructor value of `undefined` (they support `null` as of 1.20). Perhaps we should tweak to use `null`, but that seems out of scope for this change.
packages/ember-application/tests/system/dependency_injection/default_resolver_test.js
@@ -282,10 +282,14 @@ QUnit.test('knownForType returns each item for a given type found', function() { let found = registry.resolver.knownForType('helper'); - deepEqual(found, { - 'helper:foo-bar': true, - 'helper:baz-qux': true - }); + // using `Object.keys` and manually confirming values over using `deepEqual` + // due to an issue in QUnit (through at least 1.20.0) that are unable to properly compare + // objects with an `undefined` constructor (like ember-metal/empty_object) + let foundKeys = Object.keys(found); + + deepEqual(foundKeys, ['helper:foo-bar', 'helper:baz-qux']); + ok(found['helper:foo-bar']); + ok(found['helper:baz-qux']); }); QUnit.test('knownForType is not required to be present on the resolver', function() {
true
Other
emberjs
ember.js
8c8fe83d45d08ae38ad0a73dc5576455abb31030.json
Use EmptyObject for `dictionary(null)`. A huge number of usages of `ember-metal/dictionary` are using `null` as the parent. Creating a `new EmptyObject()` is quite a bit faster than `Object.create(null)` (see comments in `ember-metal/empty_object` for details). Note: we are working around an issue with QUnit due to using constructor value of `undefined` (they support `null` as of 1.20). Perhaps we should tweak to use `null`, but that seems out of scope for this change.
packages/ember-metal/lib/dictionary.js
@@ -1,11 +1,17 @@ +import EmptyObject from './empty_object'; // the delete is meant to hint at runtimes that this object should remain in // dictionary mode. This is clearly a runtime specific hack, but currently it // appears worthwhile in some usecases. Please note, these deletes do increase // the cost of creation dramatically over a plain Object.create. And as this // only makes sense for long-lived dictionaries that aren't instantiated often. export default function makeDictionary(parent) { - var dict = Object.create(parent); + var dict; + if (parent === null) { + dict = new EmptyObject(); + } else { + dict = Object.create(parent); + } dict['_dict'] = null; delete dict['_dict']; return dict;
true
Other
emberjs
ember.js
200c3b7b5846e22cb230842fc6fe475531f9eaa3.json
Add tests with multiple re-throw stratiegies. This provides insurance that handled errors aren't swallowed
packages/ember/tests/routing/substates_test.js
@@ -449,6 +449,148 @@ QUnit.test('Error events that aren\'t bubbled don\t throw application assertions bootApplication('/grandma/mom/sally'); }); +QUnit.test('Non-bubbled errors that re-throw aren\'t swallowed', function() { + expect(2); + + templates['grandma'] = 'GRANDMA {{outlet}}'; + + Router.map(function() { + this.route('grandma', function() { + this.route('mom', { resetNamespace: true }, function() { + this.route('sally'); + }); + }); + }); + + App.ApplicationController = Ember.Controller.extend(); + + App.MomSallyRoute = Ember.Route.extend({ + model() { + step(1, 'MomSallyRoute#model'); + + return Ember.RSVP.reject({ + msg: 'did it broke?' + }); + }, + actions: { + error(err) { + // returns undefined which is falsey + throw err; + } + } + }); + + throws(function() { + bootApplication('/grandma/mom/sally'); + }, function(err) { return err.msg === 'did it broke?';}); +}); + +QUnit.test('Handled errors that re-throw aren\'t swallowed', function() { + expect(4); + + var handledError; + + templates['grandma'] = 'GRANDMA {{outlet}}'; + + Router.map(function() { + this.route('grandma', function() { + this.route('mom', { resetNamespace: true }, function() { + this.route('sally'); + this.route('this-route-throws'); + }); + }); + }); + + App.ApplicationController = Ember.Controller.extend(); + + App.MomSallyRoute = Ember.Route.extend({ + model() { + step(1, 'MomSallyRoute#model'); + + return Ember.RSVP.reject({ + msg: 'did it broke?' + }); + }, + actions: { + error(err) { + step(2, 'MomSallyRoute#error'); + + handledError = err; + + this.transitionTo('mom.this-route-throws'); + + // Marks error as handled + return false; + } + } + }); + + App.MomThisRouteThrowsRoute = Ember.Route.extend({ + model() { + step(3, 'MomThisRouteThrows#model'); + + throw handledError; + } + }); + + throws(function() { + bootApplication('/grandma/mom/sally'); + }, function(err) { return err.msg === 'did it broke?'; }); +}); + +QUnit.test('Handled errors that are thrown through rejection aren\'t swallowed', function() { + expect(4); + + var handledError; + + templates['grandma'] = 'GRANDMA {{outlet}}'; + + Router.map(function() { + this.route('grandma', function() { + this.route('mom', { resetNamespace: true }, function() { + this.route('sally'); + this.route('this-route-throws'); + }); + }); + }); + + App.ApplicationController = Ember.Controller.extend(); + + App.MomSallyRoute = Ember.Route.extend({ + model() { + step(1, 'MomSallyRoute#model'); + + return Ember.RSVP.reject({ + msg: 'did it broke?' + }); + }, + actions: { + error(err) { + step(2, 'MomSallyRoute#error'); + + handledError = err; + + this.transitionTo('mom.this-route-throws'); + + // Marks error as handled + return false; + } + } + }); + + App.MomThisRouteThrowsRoute = Ember.Route.extend({ + model() { + step(3, 'MomThisRouteThrows#model'); + + return Ember.RSVP.reject(handledError); + } + }); + + throws(function() { + bootApplication('/grandma/mom/sally'); + }, function(err) { return err.msg === 'did it broke?'; }); +}); + QUnit.test('Setting a query param during a slow transition should work', function() { var deferred = RSVP.defer();
false
Other
emberjs
ember.js
bbb81bb5bc2d0fdc27eec536c7ea04049355d90c.json
Change param to parameter
packages/ember-htmlbars/lib/helpers/each.js
@@ -11,7 +11,7 @@ import decodeEachKey from 'ember-htmlbars/utils/decode-each-key'; of the base Handlebars `{{#each}}` helper. The default behavior of `{{#each}}` is to yield its inner block once for every - item in an array passing the item as the first param to the block. + item in an array passing the item as the first block parameter. ```javascript var developers = [{name: 'Yehuda'},{name: 'Tom'}, {name: 'Paul'}]; @@ -36,7 +36,7 @@ import decodeEachKey from 'ember-htmlbars/utils/decode-each-key'; {{/each}} ``` - During iteration, the index of each item in the array is provided as a second block param. + During iteration, the index of each item in the array is provided as a second block parameter. ```handlebars <ul>
false
Other
emberjs
ember.js
254fdf1514020b19ece60d96305e87f2e00ee4f2.json
Fix deprecation link for Ember.String.fmt
packages/ember-runtime/lib/system/string.js
@@ -99,7 +99,7 @@ function fmt(str, formats) { deprecate( 'Ember.String.fmt is deprecated, use ES6 template strings instead.', false, - { id: 'ember-string-utils.fmt', until: '3.0.0', url: 'https://babeljs.io/docs/learn-es6/#template-strings' } + { id: 'ember-string-utils.fmt', until: '3.0.0', url: 'http://babeljs.io/docs/learn-es2015/#template-strings' } ); return _fmt(...arguments); } @@ -172,7 +172,7 @@ export default { @param {Array} formats An array of parameters to interpolate into string. @return {String} formatted string @public - @deprecated Use ES6 template strings instead: https://babeljs.io/docs/learn-es6/#template-strings'); + @deprecated Use ES6 template strings instead: http://babeljs.io/docs/learn-es2015/#template-strings */ fmt,
false
Other
emberjs
ember.js
18041f892dfd9db87b90d8770469df8a2b2b951b.json
Update CHANGELOG to include v2.3.0-beta.2.
CHANGELOG.md
@@ -1,5 +1,16 @@ # Ember Changelog +### v2.3.0-beta.2 (November 29, 2015) + +- [#12626](https://github.com/emberjs/ember.js/pull/12626) [BUGFIX] Fix "rest" style positional params in contextual components when using dot syntax. +- [#12627](https://github.com/emberjs/ember.js/pull/12627) [CLEANUP] Remove unused `ENV` flags. + * `Ember.ENV.ENABLE_ALL_FEATURES` is removed (wasn't functionally different than `Ember.ENV.ENABLE_OPTIONAL_FEATURES`). + * `Ember.SHIM_ES5` is removed (Ember 2.x only supports ES5 compliant browsers so this flag was unused). + * `Ember.ENV.DISABLE_RANGE_API` is removed (unused since HTMLBars landed in 1.10). +- [#12628](https://github.com/emberjs/ember.js/pull/12628) [BUGFIX] Fix processing arguments in rerender for contextual components. +- [#12629](https://github.com/emberjs/ember.js/pull/12629) [BUGFIX] Expose `ownerInjection` method on `ContainerProxy`. +- [#12636](https://github.com/emberjs/ember.js/pull/12636) [BUGFIX] Ensure `Ember.Mixin.prototype.toString` is defined (prevents issues with `Object.seal(Ember.Mixin.prototype)` in debug builds. + ### v2.3.0-beta.1 (November 16, 2015) - [#12532](https://github.com/emberjs/ember.js/pull/12532) Bump RSVP dependency from 3.0.6 to 3.1.0.
false
Other
emberjs
ember.js
89f0516c78af31fbd2ef3c9e7a6b84b497be6105.json
Remove internal usage of `Ember.__loader`.
packages/ember-metal/lib/core.js
@@ -1,5 +1,7 @@ /*globals Ember:true,ENV,EmberENV */ +import require from 'require'; + /** @module ember @submodule ember-metal @@ -47,7 +49,7 @@ Ember.toString = function() { return 'Ember'; }; // The debug functions are exported to globals with `require` to // prevent babel-plugin-filter-imports from removing them. -let debugModule = Ember.__loader.require('ember-metal/debug'); +let debugModule = require('ember-metal/debug'); Ember.assert = debugModule.assert; Ember.warn = debugModule.warn; Ember.debug = debugModule.debug;
true
Other
emberjs
ember.js
89f0516c78af31fbd2ef3c9e7a6b84b497be6105.json
Remove internal usage of `Ember.__loader`.
packages/ember-metal/lib/index.js
@@ -4,6 +4,7 @@ */ // BEGIN IMPORTS +import require, { has } from 'require'; import Ember from 'ember-metal/core'; import { deprecateFunc } from 'ember-metal/debug'; import isEnabled, { FEATURES } from 'ember-metal/features'; @@ -358,8 +359,8 @@ Ember.onerror = null; // do this for side-effects of updating Ember.assert, warn, etc when // ember-debug is present // This needs to be called before any deprecateFunc -if (Ember.__loader.registry['ember-debug/index']) { - requireModule('ember-debug'); +if (has('ember-debug')) { + require('ember-debug'); } else { Ember.Debug = { };
true
Other
emberjs
ember.js
89f0516c78af31fbd2ef3c9e7a6b84b497be6105.json
Remove internal usage of `Ember.__loader`.
packages/ember-runtime/lib/ext/rsvp.js
@@ -1,6 +1,7 @@ /* globals RSVP:true */ import Ember from 'ember-metal/core'; +import require, { has } from 'require'; import { assert } from 'ember-metal/debug'; import Logger from 'ember-metal/logger'; import run from 'ember-metal/run_loop'; @@ -57,8 +58,8 @@ export function onerrorDefault(reason) { if (error && error.name !== 'TransitionAborted') { if (Ember.testing) { // ES6TODO: remove when possible - if (!Test && Ember.__loader.registry[testModuleName]) { - Test = requireModule(testModuleName)['default']; + if (!Test && has(testModuleName)) { + Test = require(testModuleName)['default']; } if (Test && Test.adapter) {
true
Other
emberjs
ember.js
89f0516c78af31fbd2ef3c9e7a6b84b497be6105.json
Remove internal usage of `Ember.__loader`.
packages/ember-template-compiler/lib/compat/precompile.js
@@ -2,14 +2,14 @@ @module ember @submodule ember-template-compiler */ -import Ember from 'ember-metal/core'; +import require, { has } from 'require'; import compileOptions from 'ember-template-compiler/system/compile_options'; var compile, compileSpec; export default function(string) { - if ((!compile || !compileSpec) && Ember.__loader.registry['htmlbars-compiler/compiler']) { - var Compiler = requireModule('htmlbars-compiler/compiler'); + if ((!compile || !compileSpec) && has('htmlbars-compiler/compiler')) { + var Compiler = require('htmlbars-compiler/compiler'); compile = Compiler.compile; compileSpec = Compiler.compileSpec;
true
Other
emberjs
ember.js
89f0516c78af31fbd2ef3c9e7a6b84b497be6105.json
Remove internal usage of `Ember.__loader`.
packages/ember-template-compiler/lib/system/compile.js
@@ -3,7 +3,7 @@ @submodule ember-template-compiler */ -import Ember from 'ember-metal/core'; +import require, { has } from 'require'; import compileOptions from 'ember-template-compiler/system/compile_options'; import template from 'ember-template-compiler/system/template'; @@ -20,8 +20,8 @@ var compile; @param {Object} options This is an options hash to augment the compiler options. */ export default function(templateString, options) { - if (!compile && Ember.__loader.registry['htmlbars-compiler/compiler']) { - compile = requireModule('htmlbars-compiler/compiler').compile; + if (!compile && has('htmlbars-compiler/compiler')) { + compile = require('htmlbars-compiler/compiler').compile; } if (!compile) {
true
Other
emberjs
ember.js
89f0516c78af31fbd2ef3c9e7a6b84b497be6105.json
Remove internal usage of `Ember.__loader`.
packages/ember-template-compiler/lib/system/precompile.js
@@ -2,7 +2,7 @@ @module ember @submodule ember-template-compiler */ -import Ember from 'ember-metal/core'; +import require, { has } from 'require'; import compileOptions from 'ember-template-compiler/system/compile_options'; var compileSpec; @@ -18,8 +18,8 @@ var compileSpec; @param {String} templateString This is the string to be compiled by HTMLBars. */ export default function(templateString, options) { - if (!compileSpec && Ember.__loader.registry['htmlbars-compiler/compiler']) { - compileSpec = requireModule('htmlbars-compiler/compiler').compileSpec; + if (!compileSpec && has('htmlbars-compiler/compiler')) { + compileSpec = require('htmlbars-compiler/compiler').compileSpec; } if (!compileSpec) {
true
Other
emberjs
ember.js
89f0516c78af31fbd2ef3c9e7a6b84b497be6105.json
Remove internal usage of `Ember.__loader`.
packages/ember/lib/index.js
@@ -10,17 +10,17 @@ import 'ember-htmlbars'; import 'ember-routing-htmlbars'; import 'ember-routing-views'; -import Ember from 'ember-metal/core'; +import require, { has } from 'require'; import { runLoadHooks } from 'ember-runtime/system/lazy_load'; -if (Ember.__loader.registry['ember-template-compiler/index']) { - requireModule('ember-template-compiler'); +if (has('ember-template-compiler')) { + require('ember-template-compiler'); } // do this to ensure that Ember.Test is defined properly on the global // if it is present. -if (Ember.__loader.registry['ember-testing/index']) { - requireModule('ember-testing'); +if (has('ember-testing')) { + require('ember-testing'); } runLoadHooks('Ember');
true
Other
emberjs
ember.js
89f0516c78af31fbd2ef3c9e7a6b84b497be6105.json
Remove internal usage of `Ember.__loader`.
packages/loader/lib/index.js
@@ -32,8 +32,14 @@ var mainContext = this; requirejs = require = requireModule = function(name) { return internalRequire(name, null); } + + // setup `require` module require['default'] = require; + require.has = function registryHas(moduleName) { + return !!registry[moduleName] || !!registry[moduleName + '/index']; + }; + function missingModule(name, referrerName) { if (referrerName) { throw new Error('Could not find module ' + name + ' required by: ' + referrerName);
true
Other
emberjs
ember.js
80270f186a7863ea3c946ee2d14ca6118dd7e3a8.json
Add fallback for `${moduleName}/index`. This follows suit with changes made in ember-cli/loader.js@v3.5.0.
packages/ember-metal/lib/index.js
@@ -358,7 +358,7 @@ Ember.onerror = null; // do this for side-effects of updating Ember.assert, warn, etc when // ember-debug is present // This needs to be called before any deprecateFunc -if (Ember.__loader.registry['ember-debug']) { +if (Ember.__loader.registry['ember-debug/index']) { requireModule('ember-debug'); } else { Ember.Debug = { };
true
Other
emberjs
ember.js
80270f186a7863ea3c946ee2d14ca6118dd7e3a8.json
Add fallback for `${moduleName}/index`. This follows suit with changes made in ember-cli/loader.js@v3.5.0.
packages/ember/lib/index.js
@@ -13,13 +13,13 @@ import 'ember-routing-views'; import Ember from 'ember-metal/core'; import { runLoadHooks } from 'ember-runtime/system/lazy_load'; -if (Ember.__loader.registry['ember-template-compiler']) { +if (Ember.__loader.registry['ember-template-compiler/index']) { requireModule('ember-template-compiler'); } // do this to ensure that Ember.Test is defined properly on the global // if it is present. -if (Ember.__loader.registry['ember-testing']) { +if (Ember.__loader.registry['ember-testing/index']) { requireModule('ember-testing'); }
true
Other
emberjs
ember.js
80270f186a7863ea3c946ee2d14ca6118dd7e3a8.json
Add fallback for `${moduleName}/index`. This follows suit with changes made in ember-cli/loader.js@v3.5.0.
packages/loader/lib/index.js
@@ -42,7 +42,15 @@ var mainContext = this; } } - function internalRequire(name, referrerName) { + function internalRequire(_name, referrerName) { + var name = _name; + var mod = registry[name]; + + if (!mod) { + name = name + '/index'; + mod = registry[name]; + } + var exports = seen[name]; if (exports !== undefined) { @@ -51,11 +59,10 @@ var mainContext = this; exports = seen[name] = {}; - if (!registry[name]) { - missingModule(name, referrerName); + if (!mod) { + missingModule(_name, referrerName); } - var mod = registry[name]; var deps = mod.deps; var callback = mod.callback; var length = deps.length;
true
Other
emberjs
ember.js
d25e0d7760903b6f65f68d674ccc8decda180704.json
Update version info and npm-shrinkwrap.json.
VERSION
@@ -1 +1 @@ -2.3.0-beta.1+canary +2.4.0+canary
true
Other
emberjs
ember.js
d25e0d7760903b6f65f68d674ccc8decda180704.json
Update version info and npm-shrinkwrap.json.
npm-shrinkwrap.json
@@ -1,6 +1,6 @@ { "name": "ember", - "version": "2.3.0-canary", + "version": "2.4.0-canary", "dependencies": { "abbrev": { "version": "1.0.7", @@ -1616,7 +1616,8 @@ }, "lodash": { "version": "2.4.2", - "from": "lodash@>=2.4.1 <2.5.0" + "from": "lodash@2.4.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz" }, "strip-ansi": { "version": "0.1.1", @@ -1961,7 +1962,8 @@ "dependencies": { "git-repo-info": { "version": "1.1.2", - "from": "git-repo-info@>=1.0.4 <2.0.0" + "from": "git-repo-info@1.1.2", + "resolved": "https://registry.npmjs.org/git-repo-info/-/git-repo-info-1.1.2.tgz" } } }, @@ -2165,7 +2167,7 @@ "esprima": { "version": "1.1.0-dev-harmony", "from": "git+https://github.com/ariya/esprima.git#harmony", - "resolved": "git+https://github.com/ariya/esprima.git#a65a3eb93b9a5dce9a1184ca2d1bd0b184c6b8fd" + "resolved": "git+https://github.com/thomasboyt/esprima.git#4be906f1abcbb6822e33526b4bab725c6095afcd" } } }, @@ -5438,7 +5440,8 @@ "dependencies": { "esprima-fb": { "version": "15001.1001.0-dev-harmony-fb", - "from": "esprima-fb@>=15001.1001.0-dev-harmony-fb <15001.1002.0" + "from": "esprima-fb@15001.1001.0-dev-harmony-fb", + "resolved": "https://registry.npmjs.org/esprima-fb/-/esprima-fb-15001.1001.0-dev-harmony-fb.tgz" }, "source-map": { "version": "0.5.3",
true
Other
emberjs
ember.js
d25e0d7760903b6f65f68d674ccc8decda180704.json
Update version info and npm-shrinkwrap.json.
package.json
@@ -1,7 +1,7 @@ { "name": "ember", "license": "MIT", - "version": "2.3.0-canary", + "version": "2.4.0-canary", "scripts": { "build": "ember build --environment production", "postinstall": "bower install",
true
Other
emberjs
ember.js
3b0baff261c778c8b30f3a5b1b286a090663ba80.json
Add example and clear up wording for CP get/set
packages/ember-metal/lib/computed.js
@@ -537,22 +537,20 @@ ComputedPropertyPrototype.teardown = function(obj, keyName) { computed property function. You can use this helper to define properties with mixins or via `Ember.defineProperty()`. - If you pass function as argument - it will be used as getter. - You can pass hash with two functions - instead of single function - as argument to provide both getter and setter. - - The `get` function should accept two parameters, `key` and `value`. If `value` is not - undefined you should set the `value` first. In either case return the - current value of the property. - - A computed property defined in this way might look like this: + If you pass a function as an argument, it will be used as a getter. A computed + property defined in this way might look like this: ```js let Person = Ember.Object.extend({ - firstName: 'Betty', - lastName: 'Jones', + init() { + this._super(...arguments); + + this.firstName = 'Betty'; + this.lastName = 'Jones'; + }, fullName: Ember.computed('firstName', 'lastName', function() { - return this.get('firstName') + ' ' + this.get('lastName'); + return `${this.get('firstName')} ${this.get('lastName')}`; }) }); @@ -564,14 +562,45 @@ ComputedPropertyPrototype.teardown = function(obj, keyName) { client.get('fullName'); // 'Betty Fuller' ``` + You can pass a hash with two functions, `get` and `set`, as an + argument to provide both a getter and setter: + + ```js + let Person = Ember.Object.extend({ + init() { + this._super(...arguments); + + this.firstName = 'Betty'; + this.lastName = 'Jones'; + }, + + fullName: Ember.computed({ + get(key) { + return `${this.get('firstName')} ${this.get('lastName')}`; + }, + set(key, value) { + let [firstName, lastName] = value.split(/\s+/); + this.setProperties({ firstName, lastName }); + return value; + } + }); + }) + + let client = Person.create(); + client.get('firstName'); // 'Betty' + + client.set('fullName', 'Carroll Fuller'); + client.get('firstName'); // 'Carroll' + ``` + + The `set` function should accept two parameters, `key` and `value`. The value + returned from `set` will be the new value of the property. + _Note: This is the preferred way to define computed properties when writing third-party libraries that depend on or use Ember, since there is no guarantee that the user - will have prototype extensions enabled._ + will have [prototype Extensions](http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/) enabled._ - You might use this method if you disabled - [Prototype Extensions](http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/). - The alternative syntax might look like this - (if prototype extensions are enabled, which is the default behavior): + The alternative syntax, with prototype extensions, might look like: ```js fullName() {
false
Other
emberjs
ember.js
1713085b45f43e3b8fbac4f15059695d2160fc66.json
isolate internals from Ember.TEMPLATES global
packages/ember-application/lib/system/resolver.js
@@ -3,7 +3,6 @@ @submodule ember-application */ -import Ember from 'ember-metal/core'; import { assert, info } from 'ember-metal/debug'; import { get } from 'ember-metal/property_get'; import { @@ -17,6 +16,9 @@ import Namespace from 'ember-runtime/system/namespace'; import helpers from 'ember-htmlbars/helpers'; import validateType from 'ember-application/utils/validate-type'; import dictionary from 'ember-metal/dictionary'; +import { + get as getTemplate +} from 'ember-htmlbars/template_registry'; export var Resolver = EmberObject.extend({ /* @@ -309,14 +311,7 @@ export default EmberObject.extend({ resolveTemplate(parsedName) { var templateName = parsedName.fullNameWithoutType.replace(/\./g, '/'); - if (Ember.TEMPLATES.hasOwnProperty(templateName)) { - return Ember.TEMPLATES[templateName]; - } - - templateName = decamelize(templateName); - if (Ember.TEMPLATES.hasOwnProperty(templateName)) { - return Ember.TEMPLATES[templateName]; - } + return getTemplate(templateName) || getTemplate(decamelize(templateName)); }, /**
true
Other
emberjs
ember.js
1713085b45f43e3b8fbac4f15059695d2160fc66.json
isolate internals from Ember.TEMPLATES global
packages/ember-htmlbars/lib/main.js
@@ -128,6 +128,10 @@ import hashHelper from 'ember-htmlbars/helpers/hash'; import DOMHelper from 'ember-htmlbars/system/dom-helper'; import Helper, { helper as makeHelper } from 'ember-htmlbars/helper'; import GlimmerComponent from 'ember-htmlbars/glimmer-component'; +import { + getTemplates, + setTemplates +} from 'ember-htmlbars/template_registry'; // importing adds template bootstrapping // initializer to enable embedded templates @@ -173,3 +177,20 @@ if (isEnabled('ember-htmlbars-component-generation')) { Helper.helper = makeHelper; Ember.Helper = Helper; + +/** + Global hash of shared templates. This will automatically be populated + by the build tools so that you can store your Handlebars templates in + separate files that get loaded into JavaScript at buildtime. + + @property TEMPLATES + @for Ember + @type Object + @private +*/ +Object.defineProperty(Ember, 'TEMPLATES', { + configurable: false, + get: getTemplates, + set: setTemplates +}); +
true
Other
emberjs
ember.js
1713085b45f43e3b8fbac4f15059695d2160fc66.json
isolate internals from Ember.TEMPLATES global
packages/ember-htmlbars/lib/system/bootstrap.js
@@ -5,13 +5,16 @@ @submodule ember-htmlbars */ -import Ember from 'ember-metal/core'; import ComponentLookup from 'ember-views/component_lookup'; import jQuery from 'ember-views/system/jquery'; import EmberError from 'ember-metal/error'; import { onLoad } from 'ember-runtime/system/lazy_load'; import htmlbarsCompile from 'ember-template-compiler/system/compile'; import environment from 'ember-metal/environment'; +import { + has as hasTemplate, + set as registerTemplate +} from 'ember-htmlbars/template_registry'; /** @module ember @@ -58,12 +61,12 @@ function bootstrap(ctx) { } // Check if template of same name already exists - if (Ember.TEMPLATES[templateName] !== undefined) { + if (hasTemplate(templateName)) { throw new EmberError('Template named "' + templateName + '" already exists.'); } // For templates which have a name, we save them and then remove them from the DOM - Ember.TEMPLATES[templateName] = template; + registerTemplate(templateName, template); // Remove script tag from DOM script.remove();
true
Other
emberjs
ember.js
1713085b45f43e3b8fbac4f15059695d2160fc66.json
isolate internals from Ember.TEMPLATES global
packages/ember-htmlbars/lib/template_registry.js
@@ -0,0 +1,26 @@ +// STATE within a module is frowned apon, this exists +// to support Ember.TEMPLATES but shield ember internals from this legacy +// global API +let TEMPLATES = {}; + +export function setTemplates(templates) { + TEMPLATES = templates; +} + +export function getTemplates() { + return TEMPLATES; +} + +export function get(name) { + if (TEMPLATES.hasOwnProperty(name)) { + return TEMPLATES[name]; + } +} + +export function has(name) { + return TEMPLATES.hasOwnProperty(name); +} + +export function set(name, template) { + return TEMPLATES[name] = template; +}
true
Other
emberjs
ember.js
1713085b45f43e3b8fbac4f15059695d2160fc66.json
isolate internals from Ember.TEMPLATES global
packages/ember-views/lib/views/view.js
@@ -23,7 +23,6 @@ import VisibilitySupport from 'ember-views/mixins/visibility_support'; import CompatAttrsProxy from 'ember-views/compat/attrs-proxy'; import ViewMixin from 'ember-views/mixins/view_support'; import { deprecateProperty } from 'ember-metal/deprecate_property'; - /** @module ember @submodule ember-views @@ -36,19 +35,6 @@ warn( id: 'ember-views.view-preserves-context-flag', until: '2.0.0' }); - -/** - Global hash of shared templates. This will automatically be populated - by the build tools so that you can store your Handlebars templates in - separate files that get loaded into JavaScript at buildtime. - - @property TEMPLATES - @for Ember - @type Object - @private -*/ -Ember.TEMPLATES = {}; - /** `Ember.View` is the class in Ember responsible for encapsulating templates of HTML content, combining templates with data to render as sections of a page's
true
Other
emberjs
ember.js
1713085b45f43e3b8fbac4f15059695d2160fc66.json
isolate internals from Ember.TEMPLATES global
packages/ember/tests/component_registration_test.js
@@ -24,24 +24,26 @@ function prepare() { function cleanup() { run(function() { - if (App) { - App.destroy(); - } - App = appInstance = null; - Ember.TEMPLATES = {}; + try { + if (App) { + App.destroy(); + } + App = appInstance = null; + } finally { + Ember.TEMPLATES = {}; - cleanupHelpers(); + cleanupHelpers(); + } }); } function cleanupHelpers() { - var currentHelpers = emberA(keys(helpers)); - - currentHelpers.forEach(function(name) { - if (!originalHelpers.contains(name)) { - delete helpers[name]; - } - }); + keys(helpers). + forEach((name) => { + if (!originalHelpers.contains(name)) { + delete helpers[name]; + } + }); } QUnit.module('Application Lifecycle - Component Registration', {
true
Other
emberjs
ember.js
1713085b45f43e3b8fbac4f15059695d2160fc66.json
isolate internals from Ember.TEMPLATES global
packages/ember/tests/routing/query_params_test.js
@@ -96,12 +96,14 @@ function sharedSetup() { } function sharedTeardown() { - run(function() { - App.destroy(); - App = null; - + try { + run(function() { + App.destroy(); + App = null; + }); + } finally { Ember.TEMPLATES = {}; - }); + } } QUnit.module('Routing with Query Params', {
true
Other
emberjs
ember.js
a3facf02d55d2ec3ff2e5941ca392af2ea429e03.json
use imported references rather then from Ember.*
packages/ember-runtime/lib/system/core_object.js
@@ -9,7 +9,6 @@ // using ember-metal/lib/main here to ensure that ember-debug is setup // if present -import Ember from 'ember-metal'; import { assert, runInDebug } from 'ember-metal/debug'; import isEnabled from 'ember-metal/features'; import assign from 'ember-metal/assign'; @@ -945,8 +944,8 @@ ClassMixin.apply(CoreObject); CoreObject.reopen({ didDefineProperty(proto, key, value) { if (hasCachedComputedProperties === false) { return; } - if (value instanceof Ember.ComputedProperty) { - var cache = Ember.meta(this.constructor).readableCache(); + if (value instanceof ComputedProperty) { + var cache = meta(this.constructor).readableCache(); if (cache && cache._computedProperties !== undefined) { cache._computedProperties = undefined;
false
Other
emberjs
ember.js
3309e21d01ec1e1d06104659b973636c8074f24f.json
prefer module over global for isEmpty
packages/ember-routing/lib/system/route.js
@@ -30,7 +30,7 @@ import { calculateCacheKey } from 'ember-routing/utils'; import { getOwner } from 'container/owner'; - +import isEmpty from 'ember-metal/is_empty'; var slice = Array.prototype.slice; function K() { return this; } @@ -1944,7 +1944,7 @@ var Route = EmberObject.extend(ActionHandler, Evented, { assert('The name in the given arguments is undefined', arguments.length > 0 ? !isNone(arguments[0]) : true); var namePassed = typeof _name === 'string' && !!_name; - var isDefaultRender = arguments.length === 0 || Ember.isEmpty(arguments[0]); + var isDefaultRender = arguments.length === 0 || isEmpty(arguments[0]); var name; if (typeof _name === 'object' && !options) {
false
Other
emberjs
ember.js
efb8487d23f3d7c65fbe7d3bb7e2cf62cceecff2.json
Fix typo in helpers_test.js
packages/ember-testing/tests/helpers_test.js
@@ -615,14 +615,14 @@ QUnit.test('`fillIn` fires `input` and `change` events in the proper order', fun oninputHandler(e) { events.push(e.type); }, - onchangeHanlders(e) { + onchangeHandler(e) { events.push(e.type); } } }); App.IndexView = EmberView.extend({ - template: compile('<input type="text" id="first" oninput={{action "oninputHandler"}} onchange={{action "onchangeHanlders"}}>') + template: compile('<input type="text" id="first" oninput={{action "oninputHandler"}} onchange={{action "onchangeHandler"}}>') }); run(App, App.advanceReadiness);
false
Other
emberjs
ember.js
96f80d27be74cead08e8a21d8ccadd162e05c111.json
fix potential deopt while reading arguments
packages/container/lib/container.js
@@ -187,17 +187,17 @@ function areInjectionsDynamic(injections) { return !!injections._dynamic; } -function buildInjections(container) { +function buildInjections(/* container, ...injections */) { var hash = {}; if (arguments.length > 1) { - var injectionArgs = Array.prototype.slice.call(arguments, 1); + var container = arguments[0]; var injections = []; var injection; - for (var i = 0, l = injectionArgs.length; i < l; i++) { - if (injectionArgs[i]) { - injections = injections.concat(injectionArgs[i]); + for (var i = 1, l = arguments.length; i < l; i++) { + if (arguments[i]) { + injections = injections.concat(arguments[i]); } }
false
Other
emberjs
ember.js
38450198a89f70a19a3a75fc920b710311bfc534.json
Add documentation for closure component
packages/ember-htmlbars/lib/keywords/component.js
@@ -49,6 +49,29 @@ import isEnabled from 'ember-metal/features'; {{live-updating-chart}} ``` + ## Nested Usage + + The `component` helper can be used to package a component path with initial attrs. + The included attrs can then be merged during the final invocation. + + For example, given a `person-form` component with the following template: + + ```handlebars + {{yield (hash + nameInput=(component "input" value=model.name placeholder="First Name"))}} + ``` + + The following snippet: + + ``` + {{#person-form as |form|}} + {{component form.nameInput placeholder="Username"}} + {{/person-form}} + ``` + + would output an input whose value is already bound to `model.name` and `placeholder` + is "Username". + @method component @since 1.11.0 @for Ember.Templates.helpers
false
Other
emberjs
ember.js
04e0251493099503a3602303c66ff23543ca213c.json
Add test for overriding attr value in init.
packages/ember-htmlbars/tests/integration/component_invocation_test.js
@@ -120,6 +120,27 @@ QUnit.test('non-block with properties on attrs and component class', function() equal(jQuery('#qunit-fixture').text(), 'In layout - someProp: something here'); }); +QUnit.test('non-block with properties on overridden in init', function() { + owner.register('component:non-block', Component.extend({ + someProp: null, + + init() { + this._super(...arguments); + this.someProp = 'value set in init'; + } + })); + owner.register('template:components/non-block', compile('In layout - someProp: {{someProp}}')); + + view = EmberView.extend({ + [OWNER]: owner, + template: compile('{{non-block someProp="something passed when invoked"}}') + }).create(); + + runAppend(view); + + equal(view.$().text(), 'In layout - someProp: value set in init'); +}); + QUnit.test('lookup of component takes priority over property', function() { expect(1);
false
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
.jscsrc
@@ -2,6 +2,7 @@ "esnext": true, "excludeFiles": ["ember-runtime/ext/rsvp.js"], "additionalRules": [ "lib/jscs-rules/*.js" ], + "disallowConstOutsideModuleScope": true, "disallowSpacesInsideArrayBrackets": "all", "disallowMultipleVarDeclWithAssignment": true, "disallowPaddingNewlinesInBlocks": true,
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
lib/jscs-rules/disallow-const-outside-module-scope.js
@@ -0,0 +1,38 @@ +var assert = require('assert'); + +module.exports = function() { }; + +module.exports.prototype = { + configure: function(option) { + assert(option === true, this.getOptionName() + ' requires a true value'); + }, + + getOptionName: function() { + return 'disallowConstOutsideModuleScope'; + }, + + check: function(file, errors) { + file.iterateNodesByType('VariableDeclaration', function(node) { + if (node.parentNode.type === 'Program') { + // declaration is in root of module + return; + } + + if (node.parentNode.type === 'ExportNamedDeclaration' && node.parentNode.parentNode.type === 'Program') { + // declaration is a `export const foo = 'asdf'` in root of the module + return; + } + + for (var i = 0; i < node.declarations.length; i++) { + var thisDeclaration = node.declarations[i]; + + if (thisDeclaration.parentNode.kind === 'const') { + errors.add( + '`const` should only be used in module scope (not inside functions/blocks).', + node.loc.start + ); + } + } + }); + } +};
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/container/tests/container_test.js
@@ -537,11 +537,11 @@ if (isEnabled('ember-container-inject-owner')) { }); } else { QUnit.test('A `container` property is appended to every instantiated object', function() { - const registry = new Registry(); - const container = registry.container(); - const PostController = factory(); + let registry = new Registry(); + let container = registry.container(); + let PostController = factory(); registry.register('controller:post', PostController); - const postController = container.lookup('controller:post'); + let postController = container.lookup('controller:post'); strictEqual(postController.container, container, ''); });
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/container/tests/test-helpers/build-owner.js
@@ -7,9 +7,10 @@ export default function buildOwner(props) { let Owner = EmberObject.extend(RegistryProxy, ContainerProxy, { init() { this._super(...arguments); - const registry = this.__registry__ = new Registry(); + let registry = this.__registry__ = new Registry(); this.__container__ = registry.container({ owner: this }); } }); + return Owner.create(props); }
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/lib/hooks/has-helper.js
@@ -5,7 +5,7 @@ export default function hasHelperHook(env, scope, helperName) { return true; } - const owner = env.owner; + let owner = env.owner; if (validateLazyHelperName(helperName, owner, env.hooks.keywords)) { var registrationName = 'helper:' + helperName; if (owner.hasRegistration(registrationName)) {
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/lib/keywords/closure-component.js
@@ -64,7 +64,7 @@ function createClosureComponentCell(env, originalComponentPath, params, hash, la } function isValidComponentPath(env, path) { - const result = lookupComponent(env.owner, path); + let result = lookupComponent(env.owner, path); return !!(result.component || result.layout); }
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/lib/keywords/get.js
@@ -15,8 +15,8 @@ import { } from 'ember-metal/observer'; function labelFor(source, key) { - const sourceLabel = source.label ? source.label : ''; - const keyLabel = key.label ? key.label : ''; + let sourceLabel = source.label ? source.label : ''; + let keyLabel = key.label ? key.label : ''; return `(get ${sourceLabel} ${keyLabel})`; } @@ -34,7 +34,7 @@ let DynamicKeyStream = BasicStream.extend({ }, key() { - const key = this.keyDep.getValue(); + let key = this.keyDep.getValue(); if (typeof key === 'string') { return key; } @@ -84,12 +84,12 @@ let DynamicKeyStream = BasicStream.extend({ }); const buildStream = function buildStream(params) { - const [objRef, pathRef] = params; + let [objRef, pathRef] = params; assert('The first argument to {{get}} must be a stream', isStream(objRef)); assert('{{get}} requires at least two arguments', params.length > 1); - const stream = buildDynamicKeyStream(objRef, pathRef); + let stream = buildDynamicKeyStream(objRef, pathRef); return stream; };
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/lib/node-managers/component-node-manager.js
@@ -236,7 +236,7 @@ export function createComponent(_component, isAngleBracket, props, renderNode, e props.renderer = props.parentView ? props.parentView.renderer : env.owner.lookup('renderer:-dom'); props._viewRegistry = props.parentView ? props.parentView._viewRegistry : env.owner.lookup('-view-registry:main'); - const component = _component.create(props); + let component = _component.create(props); // for the fallback case if (!getOwner(component)) {
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/lib/node-managers/view-node-manager.js
@@ -182,7 +182,7 @@ export function createOrUpdateComponent(component, options, createOptions, rende mergeBindings(props, snapshot); - const owner = options.parentView ? getOwner(options.parentView) : env.owner; + let owner = options.parentView ? getOwner(options.parentView) : env.owner; setOwner(props, owner); props.renderer = options.parentView ? options.parentView.renderer : owner && owner.lookup('renderer:-dom');
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/lib/system/lookup-helper.js
@@ -36,7 +36,7 @@ export function findHelper(name, view, env) { var helper = env.helpers[name]; if (!helper) { - const owner = env.owner; + let owner = env.owner; if (validateLazyHelperName(name, owner, env.hooks.keywords)) { var helperName = 'helper:' + name; if (owner.hasRegistration(helperName)) {
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/lib/utils/extract-positional-params.js
@@ -11,7 +11,7 @@ export default function extractPositionalParams(renderNode, component, params, a } export function processPositionalParams(renderNode, positionalParams, params, attrs) { - const isNamed = typeof positionalParams === 'string'; + let isNamed = typeof positionalParams === 'string'; if (isNamed) { processRestPositionalParameters(renderNode, positionalParams, params, attrs);
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/lib/utils/is-component.js
@@ -15,7 +15,7 @@ import { isStream } from 'ember-metal/streams/utils'; name was found in the container. */ export default function isComponent(env, scope, path) { - const owner = env.owner; + let owner = env.owner; if (!owner) { return false; } if (typeof path === 'string') { if (CONTAINS_DOT_CACHE.get(path)) {
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/tests/compat/view_helper_test.js
@@ -36,7 +36,7 @@ QUnit.module('ember-htmlbars: compat - view helper', { }); QUnit.test('using the view helper fails assertion', function(assert) { - const ViewClass = EmberView.extend({ + let ViewClass = EmberView.extend({ template: compile('fooView') }); owner.register('view:foo', ViewClass); @@ -67,7 +67,7 @@ QUnit.module('ember-htmlbars: compat - view helper [LEGACY]', { }); QUnit.test('using the view helper with a string (inline form) fails assertion [LEGACY]', function(assert) { - const ViewClass = EmberView.extend({ + let ViewClass = EmberView.extend({ template: compile('fooView') }); owner.register('view:foo', ViewClass); @@ -85,7 +85,7 @@ QUnit.test('using the view helper with a string (inline form) fails assertion [L }); QUnit.test('using the view helper with a string (block form) fails assertion [LEGACY]', function(assert) { - const ViewClass = EmberView.extend({ + let ViewClass = EmberView.extend({ template: compile('Foo says: {{yield}}') }); owner.register('view:foo', ViewClass);
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/tests/glimmer-component/render-test.js
@@ -48,7 +48,7 @@ function renderComponent(tag, component) { .map(key => `${key}=${hash[key]}`) .join(' '); - const owner = buildOwner(); + let owner = buildOwner(); owner.register('component-lookup:main', ComponentLookup); owner.register(`component:${tag}`, implementation);
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/tests/integration/component_invocation_test.js
@@ -32,7 +32,7 @@ function commonTeardown() { } function appendViewFor(template, hash={}) { - const view = EmberView.extend({ + let view = EmberView.extend({ [OWNER]: owner, template: compile(template) }).create(hash);
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/tests/system/lookup-helper_test.js
@@ -14,7 +14,7 @@ function generateEnv(helpers, owner) { } function generateOwner() { - const owner = buildOwner(); + let owner = buildOwner(); owner.register('component-lookup:main', ComponentLookup); @@ -58,7 +58,7 @@ QUnit.test('does not lookup in the container if the name does not contain a dash }); QUnit.test('does a lookup in the container if the name contains a dash (and helper is not found in env)', function() { - const owner = generateOwner(); + let owner = generateOwner(); var env = generateEnv(null, owner); var view = { [OWNER]: owner @@ -73,7 +73,7 @@ QUnit.test('does a lookup in the container if the name contains a dash (and help }); QUnit.test('does a lookup in the container if the name is found in knownHelpers', function() { - const owner = generateOwner(); + let owner = generateOwner(); var env = generateEnv(null, owner); var view = { [OWNER]: owner @@ -90,7 +90,7 @@ QUnit.test('does a lookup in the container if the name is found in knownHelpers' QUnit.test('looks up a shorthand helper in the container', function() { expect(2); - const owner = generateOwner(); + let owner = generateOwner(); var env = generateEnv(null, owner); var view = { [OWNER]: owner @@ -113,7 +113,7 @@ QUnit.test('looks up a shorthand helper in the container', function() { QUnit.test('fails with a useful error when resolving a function', function() { expect(1); - const owner = generateOwner(); + let owner = generateOwner(); var env = generateEnv(null, owner); var view = { [OWNER]: owner
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-htmlbars/tests/utils.js
@@ -6,7 +6,7 @@ function registerAstPlugin(plugin) { } function removeAstPlugin(plugin) { - const index = plugins['ast'].indexOf(plugin); + let index = plugins['ast'].indexOf(plugin); plugins['ast'].splice(index, 1); }
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-metal/lib/injected_property.js
@@ -25,7 +25,7 @@ function InjectedProperty(type, name) { function injectedPropertyGet(keyName) { var desc = this[keyName]; - const owner = getOwner(this); + let owner = getOwner(this); assert(`InjectedProperties should be defined with the Ember.inject computed property macros.`, desc && desc.isDescriptor && desc.type); assert(`Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.`, owner);
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-routing-htmlbars/tests/helpers/closure_action_test.js
@@ -120,10 +120,10 @@ QUnit.test('action should be called on the correct scope', function(assert) { QUnit.test('arguments to action are passed, curry', function(assert) { assert.expect(4); - const first = 'mitch'; - const second = 'martin'; - const third = 'matt'; - const fourth = 'wacky wycats'; + let first = 'mitch'; + let second = 'martin'; + let third = 'matt'; + let fourth = 'wacky wycats'; innerComponent = EmberComponent.extend({ fireAction() { @@ -155,7 +155,7 @@ QUnit.test('arguments to action are passed, curry', function(assert) { QUnit.test('arguments to action are bound', function(assert) { assert.expect(1); - const value = 'lazy leah'; + let value = 'lazy leah'; innerComponent = EmberComponent.extend({ fireAction() { @@ -186,9 +186,9 @@ QUnit.test('arguments to action are bound', function(assert) { QUnit.test('array arguments are passed correctly to action', function(assert) { assert.expect(3); - const first = 'foo'; - const second = [3, 5]; - const third = [4, 9]; + let first = 'foo'; + let second = [3, 5]; + let third = [4, 9]; innerComponent = EmberComponent.extend({ fireAction() { @@ -384,7 +384,7 @@ QUnit.test('action can create closures over actions with target', function(asser QUnit.test('value can be used with action over actions', function(assert) { assert.expect(1); - const newValue = 'yelping yehuda'; + let newValue = 'yelping yehuda'; innerComponent = EmberComponent.extend({ fireAction() { @@ -419,7 +419,7 @@ QUnit.test('value can be used with action over actions', function(assert) { QUnit.test('action will read the value of a first property', function(assert) { assert.expect(1); - const newValue = 'irate igor'; + let newValue = 'irate igor'; innerComponent = EmberComponent.extend({ fireAction() { @@ -449,7 +449,7 @@ QUnit.test('action will read the value of a first property', function(assert) { QUnit.test('action will read the value of a curried first argument property', function(assert) { assert.expect(1); - const newValue = 'kissing kris'; + let newValue = 'kissing kris'; innerComponent = EmberComponent.extend({ fireAction() {
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-routing-htmlbars/tests/helpers/render_test.js
@@ -170,7 +170,7 @@ QUnit.test('{{render}} helper with a supplied model should not fire observers on var post = { title: 'Rails is omakase' }; - const controller = EmberController.create({ + let controller = EmberController.create({ [OWNER]: appInstance, post: post }); @@ -197,9 +197,9 @@ QUnit.test('{{render}} helper with a supplied model should not fire observers on }); QUnit.test('{{render}} helper should raise an error when a given controller name does not resolve to a controller', function() { - const template = '<h1>HI</h1>{{render "home" controller="postss"}}'; - const Controller = EmberController.extend(); - const controller = Controller.create({ + let template = '<h1>HI</h1>{{render "home" controller="postss"}}'; + let Controller = EmberController.extend(); + let controller = Controller.create({ [OWNER]: appInstance }); @@ -221,7 +221,7 @@ QUnit.test('{{render}} helper should raise an error when a given controller name QUnit.test('{{render}} helper should render with given controller', function() { var template = '{{render "home" controller="posts"}}'; var Controller = EmberController.extend(); - const controller = Controller.create({ + let controller = Controller.create({ [OWNER]: appInstance }); var id = 0; @@ -251,7 +251,7 @@ QUnit.test('{{render}} helper should render with given controller', function() { QUnit.test('{{render}} helper should render a template without a model only once', function() { var template = '<h1>HI</h1>{{render \'home\'}}<hr/>{{render \'home\'}}'; var Controller = EmberController.extend(); - const controller = Controller.create({ + let controller = Controller.create({ [OWNER]: appInstance }); @@ -360,7 +360,7 @@ QUnit.test('{{render}} helper should not leak controllers', function() { QUnit.test('{{render}} helper should not treat invocations with falsy contexts as context-less', function() { var template = '<h1>HI</h1> {{render \'post\' zero}} {{render \'post\' nonexistent}}'; - const controller = EmberController.create({ + let controller = EmberController.create({ [OWNER]: appInstance, zero: false }); @@ -442,16 +442,16 @@ QUnit.test('{{render}} helper should render templates both with and without mode QUnit.test('{{render}} helper should link child controllers to the parent controller', function() { let parentTriggered = 0; - const template = '<h1>HI</h1>{{render "posts"}}'; - const Controller = EmberController.extend({ + let template = '<h1>HI</h1>{{render "posts"}}'; + let Controller = EmberController.extend({ actions: { parentPlease() { parentTriggered++; } }, role: 'Mom' }); - const controller = Controller.create({ + let controller = Controller.create({ [OWNER]: appInstance }); @@ -480,9 +480,9 @@ QUnit.test('{{render}} helper should link child controllers to the parent contro }); QUnit.test('{{render}} helper should be able to render a template again when it was removed', function() { - const CoreOutlet = appInstance._lookupFactory('view:core-outlet'); - const Controller = EmberController.extend(); - const controller = Controller.create({ + let CoreOutlet = appInstance._lookupFactory('view:core-outlet'); + let Controller = EmberController.extend(); + let controller = Controller.create({ [OWNER]: appInstance });
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-routing-htmlbars/tests/utils.js
@@ -42,14 +42,14 @@ function resolverFor(namespace) { function buildAppInstance() { let registry; - const App = EmberObject.extend(RegistryProxy, ContainerProxy, { + let App = EmberObject.extend(RegistryProxy, ContainerProxy, { init() { this._super(...arguments); registry = this.__registry__ = new Registry(); this.__container__ = registry.container({ owner: this }); } }); - const appInstance = App.create(); + let appInstance = App.create(); registry.resolver = resolverFor(App);
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-routing/lib/system/route.js
@@ -2134,7 +2134,7 @@ function buildRenderOptions(route, namePassed, isDefaultRender, name, options) { controller.set('model', options.model); } - const owner = getOwner(route); + let owner = getOwner(route); viewName = options && options.view || namePassed && name || route.viewName || name; ViewClass = owner._lookupFactory(`view:${viewName}`); template = owner.lookup(`template:${templateName}`);
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-routing/lib/system/router.js
@@ -247,7 +247,7 @@ var EmberRouter = EmberObject.extend(Evented, { defaultParentState = ownState; } if (!this._toplevelView) { - const owner = getOwner(this); + let owner = getOwner(this); var OutletView = owner._lookupFactory('view:-outlet'); this._toplevelView = OutletView.create(); var instance = owner.lookup('-application-instance:main'); @@ -449,7 +449,7 @@ var EmberRouter = EmberObject.extend(Evented, { _setupLocation() { var location = get(this, 'location'); var rootURL = get(this, 'rootURL'); - const owner = getOwner(this); + let owner = getOwner(this); if ('string' === typeof location && owner) { var resolvedLocation = owner.lookup(`location:${location}`); @@ -488,7 +488,7 @@ var EmberRouter = EmberObject.extend(Evented, { _getHandlerFunction() { var seen = new EmptyObject(); - const owner = getOwner(this); + let owner = getOwner(this); var DefaultRoute = owner._lookupFactory('route:basic'); return (name) => { @@ -844,7 +844,7 @@ function findChildRouteName(parentRoute, originatingChildRoute, name) { } function routeHasBeenDefined(router, name) { - const owner = getOwner(router); + let owner = getOwner(router); return router.hasRoute(name) && (owner.hasRegistration(`template:${name}`) || owner.hasRegistration(`route:${name}`)); }
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-routing/tests/location/auto_location_test.js
@@ -36,13 +36,13 @@ function mockBrowserHistory(overrides) { } function createLocation(location, history) { - const owner = buildOwner(); + let owner = buildOwner(); owner.register('location:history', HistoryLocation); owner.register('location:hash', HashLocation); owner.register('location:none', NoneLocation); - const autolocation = AutoLocation.create({ + let autolocation = AutoLocation.create({ [OWNER]: owner, location: location, history: history,
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-routing/tests/system/controller_for_test.js
@@ -12,7 +12,7 @@ import { import buildOwner from 'container/tests/test-helpers/build-owner'; var buildInstance = function(namespace) { - const owner = buildOwner(); + let owner = buildOwner(); owner.__registry__.resolver = resolverFor(namespace); owner.registerOptionsForType('view', { singleton: false });
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-routing/tests/system/route_test.js
@@ -55,7 +55,7 @@ QUnit.test('\'store\' can be injected by data persistence frameworks', function( expect(8); runDestroy(route); - const owner = buildOwner(); + let owner = buildOwner(); var post = { id: 1 @@ -85,7 +85,7 @@ QUnit.test('assert if \'store.find\' method is not found', function() { expect(1); runDestroy(route); - const owner = buildOwner(); + let owner = buildOwner(); var Post = EmberObject.extend(); owner.register('route:index', EmberRoute); @@ -102,7 +102,7 @@ QUnit.test('asserts if model class is not found', function() { expect(1); runDestroy(route); - const owner = buildOwner(); + let owner = buildOwner(); owner.register('route:index', EmberRoute); route = owner.lookup('route:index'); @@ -117,7 +117,7 @@ QUnit.test('\'store\' does not need to be injected', function() { runDestroy(route); - const owner = buildOwner(); + let owner = buildOwner(); owner.register('route:index', EmberRoute); @@ -133,12 +133,12 @@ QUnit.test('\'store\' does not need to be injected', function() { QUnit.test('modelFor doesn\'t require the router', function() { expect(1); - const owner = buildOwner(); + let owner = buildOwner(); setOwner(route, owner); - const foo = { name: 'foo' }; + let foo = { name: 'foo' }; - const FooRoute = EmberRoute.extend({ + let FooRoute = EmberRoute.extend({ currentModel: foo }); @@ -308,7 +308,7 @@ QUnit.test('controllerFor uses route\'s controllerName if specified', function() QUnit.module('Route injected properties'); QUnit.test('services can be injected into routes', function() { - const owner = buildOwner(); + let owner = buildOwner(); owner.register('route:application', EmberRoute.extend({ authService: inject.service('auth')
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-runtime/lib/computed/reduce_computed_macros.js
@@ -14,7 +14,7 @@ import { A as emberA } from 'ember-runtime/system/native_array'; function reduceMacro(dependentKey, callback, initialValue) { return computed(`${dependentKey}.[]`, function() { - const arr = get(this, dependentKey); + let arr = get(this, dependentKey); if (arr === null || typeof arr !== 'object') { return initialValue; }
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-runtime/tests/computed/reduce_computed_macros_test.js
@@ -431,7 +431,7 @@ QUnit.test('properties values can be replaced', function() { ['uniq', uniq], ['union', union] ].forEach((tuple) => { - const [name, macro] = tuple; + let [name, macro] = tuple; QUnit.module(`computed.${name}`, { setup() {
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-runtime/tests/controllers/controller_test.js
@@ -155,7 +155,7 @@ QUnit.module('Controller injected properties'); if (!EmberDev.runningProdBuild) { QUnit.test('defining a controller on a non-controller should fail assertion', function() { expectAssertion(function() { - const owner = buildOwner(); + let owner = buildOwner(); var AnObject = Object.extend({ foo: inject.controller('bar') @@ -169,7 +169,7 @@ if (!EmberDev.runningProdBuild) { } QUnit.test('controllers can be injected into controllers', function() { - const owner = buildOwner(); + let owner = buildOwner(); owner.register('controller:post', Controller.extend({ postsController: inject.controller('posts') @@ -184,7 +184,7 @@ QUnit.test('controllers can be injected into controllers', function() { }); QUnit.test('services can be injected into controllers', function() { - const owner = buildOwner(); + let owner = buildOwner(); owner.register('controller:application', Controller.extend({ authService: inject.service('auth')
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-runtime/tests/inject_test.js
@@ -26,7 +26,7 @@ if (!EmberDev.runningProdBuild) { ok(true, 'should call validation method'); }); - const owner = buildOwner(); + let owner = buildOwner(); var AnObject = Object.extend({ bar: inject.foo(), @@ -39,7 +39,7 @@ if (!EmberDev.runningProdBuild) { } QUnit.test('attempting to inject a nonexistent container key should error', function() { - const owner = buildOwner(); + let owner = buildOwner(); var AnObject = Object.extend({ foo: new InjectedProperty('bar', 'baz') });
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-template-compiler/lib/plugins/assert-no-view-and-controller-paths.js
@@ -56,7 +56,7 @@ function assertPath(moduleName, node, path) { `Using \`{{${path && path.type === 'PathExpression' && path.parts[0]}}}\` or any path based on it ${calculateLocationDisplay(moduleName, node.loc)}has been removed in Ember 2.0`, () => { let noAssertion = true; - const viewKeyword = path && path.type === 'PathExpression' && path.parts && path.parts[0]; + let viewKeyword = path && path.type === 'PathExpression' && path.parts && path.parts[0]; if (viewKeyword === 'view') { noAssertion = Ember.ENV._ENABLE_LEGACY_VIEW_SUPPORT; } else if (viewKeyword === 'controller') {
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-template-compiler/lib/plugins/assert-no-view-helper.js
@@ -30,7 +30,7 @@ AssertNoViewHelper.prototype.transform = function AssertNoViewHelper_transform(a }; function assertHelper(moduleName, node) { - const paramValue = node.params.length && node.params[0].value; + let paramValue = node.params.length && node.params[0].value; if (!paramValue) { return;
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-template-compiler/lib/plugins/transform-input-on-to-onEvent.js
@@ -36,10 +36,10 @@ function TransformInputOnToOnEvent(options) { @param {AST} ast The AST to be transformed. */ TransformInputOnToOnEvent.prototype.transform = function TransformInputOnToOnEvent_transform(ast) { - const pluginContext = this; - const b = pluginContext.syntax.builders; - const walker = new pluginContext.syntax.Walker(); - const moduleName = pluginContext.options.moduleName; + let pluginContext = this; + let b = pluginContext.syntax.builders; + let walker = new pluginContext.syntax.Walker(); + let moduleName = pluginContext.options.moduleName; walker.visit(ast, function(node) { if (pluginContext.validate(node)) {
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-views/lib/mixins/view_child_views_support.js
@@ -86,7 +86,7 @@ export default Mixin.create({ throw new TypeError('createChildViews first argument must exist'); } - const owner = getOwner(this); + let owner = getOwner(this); if (maybeViewClass.isView && maybeViewClass.parentView === this && getOwner(maybeViewClass) === owner) { return maybeViewClass;
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-views/lib/mixins/view_support.js
@@ -118,7 +118,7 @@ export default Mixin.create({ if (!name) { return; } assert('templateNames are not allowed to contain periods: ' + name, name.indexOf('.') === -1); - const owner = getOwner(this); + let owner = getOwner(this); if (!owner) { throw new EmberError('Container was not found when looking up a views template. ' +
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-views/lib/system/event_dispatcher.js
@@ -190,8 +190,8 @@ export default EmberObject.extend({ setupHandler(rootElement, event, eventName) { var self = this; - const owner = getOwner(this); - const viewRegistry = owner && owner.lookup('-view-registry:main') || View.views; + let owner = getOwner(this); + let viewRegistry = owner && owner.lookup('-view-registry:main') || View.views; if (eventName === null) { return;
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-views/tests/views/component_test.js
@@ -231,7 +231,7 @@ QUnit.test('Calling sendAction on a component with multiple parameters', functio QUnit.module('Ember.Component - injected properties'); QUnit.test('services can be injected into components', function() { - const owner = buildOwner(); + let owner = buildOwner(); owner.register('component:application', Component.extend({ profilerService: inject.service('profiler')
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-views/tests/views/container_view_test.js
@@ -32,7 +32,7 @@ QUnit.module('Ember.ContainerView', { }); QUnit.test('should be able to insert views after the DOM representation is created', function() { - const owner = buildOwner(); + let owner = buildOwner(); container = ContainerView.create({ [OWNER]: owner, @@ -87,7 +87,7 @@ QUnit.test('should be able to observe properties that contain child views', func }); QUnit.test('childViews inherit their parents owner, and retain the original container even when moved', function() { - const owner = buildOwner(); + let owner = buildOwner(); container = ContainerView.create({ [OWNER]: owner
true
Other
emberjs
ember.js
41e4e57aa63ea9c1e75aeac475a15f068731e2e8.json
Enforce const usage in module scope only. Good: ```js const FOO = 'FOO'; ``` Bad: ```js function derp() { const FOO = 'FOO'; } if (false) { const BLAH = 'BLAH'; } ```
packages/ember-views/tests/views/view/inject_test.js
@@ -6,7 +6,7 @@ import buildOwner from 'container/tests/test-helpers/build-owner'; QUnit.module('EmberView - injected properties'); QUnit.test('services can be injected into views', function() { - const owner = buildOwner(); + let owner = buildOwner(); owner.register('view:application', View.extend({ profilerService: inject.service('profiler')
true
Other
emberjs
ember.js
5fc8d4064ff72c393719b677b541b89428d274e4.json
Test white space in `Ember.isEmpty` Most of the examples for `Ember.isEmpty` are similar to that from `Ember.isBlank` (https://github.com/emberjs/ember.js/blob/v2.1.0/packages/ember-metal/lib/is_blank.js#L3). Examples for white space are missing.
packages/ember-metal/lib/is_empty.js
@@ -17,6 +17,8 @@ import isNone from 'ember-metal/is_none'; Ember.isEmpty({}); // false Ember.isEmpty('Adam Hawkins'); // false Ember.isEmpty([0,1,2]); // false + Ember.isEmpty('\n\t'); // false + Ember.isEmpty(' '); // false ``` @method isEmpty
true
Other
emberjs
ember.js
5fc8d4064ff72c393719b677b541b89428d274e4.json
Test white space in `Ember.isEmpty` Most of the examples for `Ember.isEmpty` are similar to that from `Ember.isBlank` (https://github.com/emberjs/ember.js/blob/v2.1.0/packages/ember-metal/lib/is_blank.js#L3). Examples for white space are missing.
packages/ember-metal/tests/is_empty_test.js
@@ -14,6 +14,8 @@ QUnit.test('Ember.isEmpty', function() { equal(true, isEmpty(null), 'for null'); equal(true, isEmpty(undefined), 'for undefined'); equal(true, isEmpty(''), 'for an empty String'); + equal(false, isEmpty(' '), 'for a whitespace String'); + equal(false, isEmpty('\n\t'), 'for another whitespace String'); equal(false, isEmpty(true), 'for true'); equal(false, isEmpty(false), 'for false'); equal(false, isEmpty(string), 'for a String');
true
Other
emberjs
ember.js
1b18f8c7730fc6285c2a07389e74655c0e4ce08f.json
remove extra comma
packages/ember-metal/lib/property_events.js
@@ -1,5 +1,5 @@ import { - guidFor, + guidFor } from 'ember-metal/utils'; import { peekMeta
false
Other
emberjs
ember.js
05e5feb585233e4b27ed4a96df6e36d8d57ef2be.json
Fix node tests. QUnit 1.19 was released and changed the way the npm package exports its value (it no longer sets up `global.QUnit` and all the assertion methods automatically). This updates to a better pattern of importing `QUnit` and using the `assert` argument for assertions.
bin/run-node-tests.js
@@ -1,6 +1,6 @@ #!/usr/bin/env node -require('qunitjs'); +global.QUnit = require('qunitjs'); // adds test reporting var qe = require('qunit-extras');
true
Other
emberjs
ember.js
05e5feb585233e4b27ed4a96df6e36d8d57ef2be.json
Fix node tests. QUnit 1.19 was released and changed the way the npm package exports its value (it no longer sets up `global.QUnit` and all the assertion methods automatically). This updates to a better pattern of importing `QUnit` and using the `assert` argument for assertions.
package.json
@@ -34,8 +34,8 @@ "github": "^0.2.3", "glob": "~4.3.2", "htmlbars": "0.14.6", - "qunit-extras": "^1.3.0", - "qunitjs": "^1.16.0", + "qunit-extras": "^1.4.0", + "qunitjs": "^1.19.0", "route-recognizer": "0.1.5", "rsvp": "~3.0.6", "serve-static": "^1.10.0",
true
Other
emberjs
ember.js
05e5feb585233e4b27ed4a96df6e36d8d57ef2be.json
Fix node tests. QUnit 1.19 was released and changed the way the npm package exports its value (it no longer sets up `global.QUnit` and all the assertion methods automatically). This updates to a better pattern of importing `QUnit` and using the `assert` argument for assertions.
tests/node/app-boot-test.js
@@ -1,4 +1,5 @@ /*jshint multistr:true*/ +var QUnit = require('qunitjs'); var appModule = require('./helpers/app-module'); function assertHTMLMatches(assert, actualHTML, expectedHTML) { @@ -87,40 +88,40 @@ if (appModule.canRunTests) { }); QUnit.test("lifecycle hooks disabled", function(assert) { - expect(2); + assert.expect(2); this.template('application', "{{my-component}}{{outlet}}"); this.component('my-component', { willRender: function() { - ok(true, "should trigger component willRender hook"); + assert.ok(true, "should trigger component willRender hook"); }, didRender: function() { - ok(false, "should not trigger didRender hook"); + assert.ok(false, "should not trigger didRender hook"); }, willInsertElement: function() { - ok(false, "should not trigger willInsertElement hook"); + assert.ok(false, "should not trigger willInsertElement hook"); }, didInsertElement: function() { - ok(false, "should not trigger didInsertElement hook"); + assert.ok(false, "should not trigger didInsertElement hook"); } }); this.view('index', { _willRender: function() { - ok(true, "should trigger view _willRender hook"); + assert.ok(true, "should trigger view _willRender hook"); }, didRender: function() { - ok(false, "should not trigger didRender hook"); + assert.ok(false, "should not trigger didRender hook"); }, willInsertElement: function() { - ok(false, "should not trigger willInsertElement hook"); + assert.ok(false, "should not trigger willInsertElement hook"); }, didCreateElement: function() { - ok(false, "should not trigger didCreateElement hook"); + assert.ok(false, "should not trigger didCreateElement hook"); }, didInsertElement: function() { - ok(false, "should not trigger didInsertElement hook"); + assert.ok(false, "should not trigger didInsertElement hook"); } });
true
Other
emberjs
ember.js
05e5feb585233e4b27ed4a96df6e36d8d57ef2be.json
Fix node tests. QUnit 1.19 was released and changed the way the npm package exports its value (it no longer sets up `global.QUnit` and all the assertion methods automatically). This updates to a better pattern of importing `QUnit` and using the `assert` argument for assertions.
tests/node/component-rendering-test.js
@@ -1,5 +1,6 @@ /*globals global,__dirname*/ +var QUnit = require('qunitjs'); var SimpleDOM = require('simple-dom'); var path = require('path');
true
Other
emberjs
ember.js
05e5feb585233e4b27ed4a96df6e36d8d57ef2be.json
Fix node tests. QUnit 1.19 was released and changed the way the npm package exports its value (it no longer sets up `global.QUnit` and all the assertion methods automatically). This updates to a better pattern of importing `QUnit` and using the `assert` argument for assertions.
tests/node/helpers/app-module.js
@@ -2,6 +2,8 @@ /*globals global,__dirname*/ var path = require('path'); +var QUnit = require('qunitjs'); + var distPath = path.join(__dirname, '../../../dist'); var emberPath = path.join(distPath, 'ember.debug.cjs'); var templateCompilerPath = path.join(distPath, 'ember-template-compiler');
true
Other
emberjs
ember.js
05e5feb585233e4b27ed4a96df6e36d8d57ef2be.json
Fix node tests. QUnit 1.19 was released and changed the way the npm package exports its value (it no longer sets up `global.QUnit` and all the assertion methods automatically). This updates to a better pattern of importing `QUnit` and using the `assert` argument for assertions.
tests/node/runtime-test.js
@@ -1,22 +1,19 @@ /*globals __dirname*/ var path = require('path'); - -var module = QUnit.module; -var ok = QUnit.ok; -var equal = QUnit.equal; +var QUnit = require('qunitjs'); var distPath = path.join(__dirname, '../../dist'); -module('ember-runtime.js'); +QUnit.module('ember-runtime.js'); -test('can be required', function() { +test('can be required', function(assert) { var Ember = require(path.join(distPath, 'ember-runtime')); - ok(Ember.Object, 'Ember.Object is present'); + assert.ok(Ember.Object, 'Ember.Object is present'); }); -test('basic object system functions properly', function() { +test('basic object system functions properly', function(assert) { var Ember = require(path.join(distPath, 'ember-runtime')); var Person = Ember.Object.extend({ @@ -30,9 +27,9 @@ test('basic object system functions properly', function() { lastName: 'Jackson' }); - equal(person.get('name'), 'Max Jackson'); + assert.equal(person.get('name'), 'Max Jackson'); person.set('firstName', 'James'); - equal(person.get('name'), 'James Jackson'); + assert.equal(person.get('name'), 'James Jackson'); });
true
Other
emberjs
ember.js
05e5feb585233e4b27ed4a96df6e36d8d57ef2be.json
Fix node tests. QUnit 1.19 was released and changed the way the npm package exports its value (it no longer sets up `global.QUnit` and all the assertion methods automatically). This updates to a better pattern of importing `QUnit` and using the `assert` argument for assertions.
tests/node/template-compiler-test.js
@@ -1,12 +1,12 @@ /*globals __dirname*/ var path = require('path'); +var QUnit = require('qunitjs'); + var distPath = path.join(__dirname, '../../dist'); var templateCompilerPath = path.join(distPath, 'ember-template-compiler'); var module = QUnit.module; -var ok = QUnit.ok; -var equal = QUnit.equal; var test = QUnit.test; var distPath = path.join(__dirname, '../../dist'); @@ -25,14 +25,13 @@ module('ember-template-compiler.js', { } }); -test('can be required', function() { - - ok(typeof templateCompiler.precompile === 'function', 'precompile function is present'); - ok(typeof templateCompiler.compile === 'function', 'compile function is present'); - ok(typeof templateCompiler.template === 'function', 'template function is present'); +test('can be required', function(assert) { + assert.ok(typeof templateCompiler.precompile === 'function', 'precompile function is present'); + assert.ok(typeof templateCompiler.compile === 'function', 'compile function is present'); + assert.ok(typeof templateCompiler.template === 'function', 'template function is present'); }); -test('allows enabling of features', function() { +test('allows enabling of features', function(assert) { var templateOutput; var templateCompiler = require(path.join(distPath, 'ember-template-compiler')); @@ -42,8 +41,8 @@ test('allows enabling of features', function() { templateCompiler._Ember.FEATURES['ember-htmlbars-component-generation'] = true; templateOutput = templateCompiler.precompile('<some-thing></some-thing>'); - ok(templateOutput.indexOf('["component","@<some-thing>",[],0]') > -1, 'component generation can be enabled'); + assert.ok(templateOutput.indexOf('["component","@<some-thing>",[],0]') > -1, 'component generation can be enabled'); } else { - ok(true, 'cannot test features in feature stripped build'); + assert.ok(true, 'cannot test features in feature stripped build'); } });
true
Other
emberjs
ember.js
e46e056f1d5ed3136efbdf2136febebacd0461c6.json
use peekMeta + deleteMeta is isolate the code-base.
packages/ember-metal/lib/chains.js
@@ -1,6 +1,6 @@ import { warn } from 'ember-metal/debug'; import { get, normalizeTuple } from 'ember-metal/property_get'; -import { meta as metaFor } from 'ember-metal/meta'; +import { meta as metaFor, peekMeta } from 'ember-metal/meta'; import { watchKey, unwatchKey } from 'ember-metal/watch_key'; import EmptyObject from 'ember-metal/empty_object'; @@ -147,7 +147,7 @@ function removeChainWatcher(obj, keyName, node) { return; } - let m = obj.__ember_meta__; + let m = peekMeta(obj); if (!m || !m.readableChainWatchers()) { return; @@ -195,7 +195,7 @@ function lazyGet(obj, key) { return; } - var meta = obj['__ember_meta__']; + var meta = peekMeta(obj); // check if object meant only to be a prototype if (meta && meta.proto === obj) { @@ -401,7 +401,7 @@ ChainNode.prototype = { export function finishChains(obj) { // We only create meta if we really have to - let m = obj.__ember_meta__; + let m = peekMeta(obj); if (m) { m = metaFor(obj);
true
Other
emberjs
ember.js
e46e056f1d5ed3136efbdf2136febebacd0461c6.json
use peekMeta + deleteMeta is isolate the code-base.
packages/ember-metal/lib/computed.js
@@ -1,7 +1,7 @@ import { assert } from 'ember-metal/debug'; import { set } from 'ember-metal/property_set'; import { inspect } from 'ember-metal/utils'; -import { meta as metaFor } from 'ember-metal/meta'; +import { meta as metaFor, peekMeta } from 'ember-metal/meta'; import expandProperties from 'ember-metal/expand_properties'; import EmberError from 'ember-metal/error'; import { @@ -313,7 +313,7 @@ ComputedPropertyPrototype.didChange = function(obj, keyName) { } // don't create objects just to invalidate - let meta = obj.__ember_meta__; + let meta = peekMeta(obj); if (!meta || meta.source !== obj) { return; } @@ -620,7 +620,7 @@ export default function computed(func) { @public */ function cacheFor(obj, key) { - var meta = obj.__ember_meta__; + var meta = peekMeta(obj); var cache = meta && meta.source === obj && meta.readableCache(); var ret = cache && cache[key];
true
Other
emberjs
ember.js
e46e056f1d5ed3136efbdf2136febebacd0461c6.json
use peekMeta + deleteMeta is isolate the code-base.
packages/ember-metal/lib/events.js
@@ -11,7 +11,7 @@ import { apply, applyStr } from 'ember-metal/utils'; -import { meta as metaFor } from 'ember-metal/meta'; +import { meta as metaFor, peekMeta } from 'ember-metal/meta'; import { ONCE, SUSPENDED } from 'ember-metal/meta_listeners'; @@ -49,7 +49,7 @@ function indexOf(array, target, method) { } export function accumulateListeners(obj, eventName, otherActions) { - var meta = obj['__ember_meta__']; + var meta = peekMeta(obj); if (!meta) { return; } var actions = meta.matchingListeners(eventName); var newActions = []; @@ -201,7 +201,7 @@ export function watchedEvents(obj) { */ export function sendEvent(obj, eventName, params, actions) { if (!actions) { - var meta = obj['__ember_meta__']; + var meta = peekMeta(obj); actions = meta && meta.matchingListeners(eventName); } @@ -241,7 +241,7 @@ export function sendEvent(obj, eventName, params, actions) { @param {String} eventName */ export function hasListeners(obj, eventName) { - var meta = obj['__ember_meta__']; + var meta = peekMeta(obj); if (!meta) { return false; } return meta.matchingListeners(eventName).length > 0; } @@ -255,7 +255,7 @@ export function hasListeners(obj, eventName) { */ export function listenersFor(obj, eventName) { var ret = []; - var meta = obj['__ember_meta__']; + var meta = peekMeta(obj); var actions = meta && meta.matchingListeners(eventName); if (!actions) { return ret; }
true
Other
emberjs
ember.js
e46e056f1d5ed3136efbdf2136febebacd0461c6.json
use peekMeta + deleteMeta is isolate the code-base.
packages/ember-metal/lib/meta.js
@@ -312,10 +312,6 @@ let setMeta = function(obj, meta) { obj[META_FIELD] = meta; }; -export let peekMeta = function(obj) { - return obj[META_FIELD]; -}; - /** Retrieves the meta hash for an object. If `writable` is true ensures the hash is writable for this object as well. @@ -354,3 +350,10 @@ export function meta(obj) { export function peekMeta(obj) { return obj[META_FIELD]; } + +export function deleteMeta(obj) { + if (typeof obj[META_FIELD] !== 'object') { + return; + } + obj[META_FIELD] = null; +}
true
Other
emberjs
ember.js
e46e056f1d5ed3136efbdf2136febebacd0461c6.json
use peekMeta + deleteMeta is isolate the code-base.
packages/ember-metal/lib/mixin.js
@@ -19,7 +19,7 @@ import { wrap, makeArray } from 'ember-metal/utils'; -import { meta as metaFor } from 'ember-metal/meta'; +import { meta as metaFor, peekMeta } from 'ember-metal/meta'; import expandProperties from 'ember-metal/expand_properties'; import { Descriptor, @@ -604,7 +604,7 @@ function _detect(curMixin, targetMixin, seen) { MixinPrototype.detect = function(obj) { if (!obj) { return false; } if (obj instanceof Mixin) { return _detect(obj, this, {}); } - var m = obj.__ember_meta__; + var m = peekMeta(obj); if (!m) { return false; } return !!m.peekMixins(guidFor(this)); }; @@ -645,7 +645,7 @@ MixinPrototype.keys = function() { // returns the mixins currently applied to the specified object // TODO: Make Ember.mixin Mixin.mixins = function(obj) { - var m = obj['__ember_meta__']; + var m = peekMeta(obj); var ret = []; if (!m) { return ret; }
true
Other
emberjs
ember.js
e46e056f1d5ed3136efbdf2136febebacd0461c6.json
use peekMeta + deleteMeta is isolate the code-base.
packages/ember-metal/lib/property_events.js
@@ -1,6 +1,9 @@ import { - guidFor + guidFor, } from 'ember-metal/utils'; +import { + peekMeta +} from 'ember-metal/meta'; import { sendEvent, accumulateListeners @@ -35,7 +38,7 @@ var deferred = 0; @private */ function propertyWillChange(obj, keyName) { - var m = obj['__ember_meta__']; + var m = peekMeta(obj); var watching = (m && m.peekWatching(keyName) > 0) || keyName === 'length'; var proto = m && m.proto; var possibleDesc = obj[keyName]; @@ -75,7 +78,7 @@ function propertyWillChange(obj, keyName) { @private */ function propertyDidChange(obj, keyName) { - var m = obj['__ember_meta__']; + var m = peekMeta(obj); var watching = (m && m.peekWatching(keyName) > 0) || keyName === 'length'; var proto = m && m.proto; var possibleDesc = obj[keyName];
true