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
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-extension-support/lib/container_debug_adapter.js
@@ -77,7 +77,10 @@ export default EmberObject.extend({ @return {boolean} whether a list is available for this type. */ canCatalogEntriesByType: function(type) { - if (type === 'model' || type === 'template') return false; + if (type === 'model' || type === 'template') { + return false; + } + return true; },
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-htmlbars/tests/helpers/yield_test.js
@@ -321,7 +321,10 @@ test("yield with nested components (#3220)", function(){ layout: compile("{{yield}}"), _yield: function (context, options, morph) { count++; - if (count > 1) throw new EmberError('is looping'); + if (count > 1) { + throw new EmberError('is looping'); + } + return this._super(context, options, morph); } });
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/lib/array.js
@@ -79,12 +79,20 @@ var lastIndexOf = defineNativeShim(ArrayPrototype.lastIndexOf, function(obj, fro var len = this.length; var idx; - if (fromIndex === undefined) fromIndex = len-1; - else fromIndex = (fromIndex < 0) ? Math.ceil(fromIndex) : Math.floor(fromIndex); - if (fromIndex < 0) fromIndex += len; + if (fromIndex === undefined) { + fromIndex = len-1; + } else { + fromIndex = (fromIndex < 0) ? Math.ceil(fromIndex) : Math.floor(fromIndex); + } + + if (fromIndex < 0) { + fromIndex += len; + } for(idx = fromIndex;idx>=0;idx--) { - if (this[idx] === obj) return idx ; + if (this[idx] === obj) { + return idx ; + } } return -1; });
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/lib/chains.js
@@ -104,7 +104,9 @@ function ChainNode(parent, key, value) { var ChainNodePrototype = ChainNode.prototype; function lazyGet(obj, key) { - if (!obj) return undefined; + if (!obj) { + return undefined; + } var meta = obj['__ember_meta__']; // check if object meant only to be a prototype
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/lib/dependent_keys.js
@@ -53,7 +53,9 @@ export function addDependentKeys(desc, obj, keyName, meta) { // add all of its dependent keys. var depsMeta, idx, len, depKey, keys; var depKeys = desc._dependentKeys; - if (!depKeys) return; + if (!depKeys) { + return; + } depsMeta = metaForDeps(meta); @@ -73,7 +75,9 @@ export function removeDependentKeys(desc, obj, keyName, meta) { // remove all of its dependent keys. var depKeys = desc._dependentKeys; var depsMeta, idx, len, depKey, keys; - if (!depKeys) return; + if (!depKeys) { + return; + } depsMeta = metaForDeps(meta);
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/lib/events.js
@@ -127,9 +127,13 @@ export function addListener(obj, eventName, target, method, once) { var actionIndex = indexOf(actions, target, method); var flags = 0; - if (once) flags |= ONCE; + if (once) { + flags |= ONCE; + } - if (actionIndex !== -1) { return; } + if (actionIndex !== -1) { + return; + } actions.push(target, method, flags);
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/lib/platform/define_property.js
@@ -24,7 +24,10 @@ @return {void} */ var defineProperty = (function checkCompliance(defineProperty) { - if (!defineProperty) return; + if (!defineProperty) { + return; + } + try { var a = 5; var obj = {}; @@ -38,9 +41,14 @@ var defineProperty = (function checkCompliance(defineProperty) { a = v; } }); - if (obj.a !== 5) return; + if (obj.a !== 5) { + return; + } + obj.a = 10; - if (a !== 10) return; + if (a !== 10) { + return; + } // check non-enumerability defineProperty(obj, 'a', { @@ -50,19 +58,25 @@ var defineProperty = (function checkCompliance(defineProperty) { value: true }); for (var key in obj) { - if (key === 'a') return; + if (key === 'a') { + return; + } } // Detects a bug in Android <3.2 where you cannot redefine a property using // Object.defineProperty once accessors have already been set. - if (obj.a !== true) return; + if (obj.a !== true) { + return; + } // Detects a bug in Android <3 where redefining a property without a value changes the value // Object.defineProperty once accessors have already been set. defineProperty(obj, 'a', { enumerable: false }); - if (obj.a !== true) return; + if (obj.a !== true) { + return; + } // defineProperty is compliant return defineProperty;
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/lib/properties.js
@@ -91,7 +91,9 @@ export function DEFAULT_GETTER_FUNCTION(name) { export function defineProperty(obj, keyName, desc, data, meta) { var descs, existingDesc, watching, value; - if (!meta) meta = metaFor(obj); + if (!meta) { + meta = metaFor(obj); + } descs = meta.descs; existingDesc = meta.descs[keyName]; var watchEntry = meta.watching[keyName];
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/lib/property_get.js
@@ -115,8 +115,13 @@ function normalizeTuple(target, path) { var isGlobal = !hasThis && isGlobalPath(path); var key; - if (!target || isGlobal) target = Ember.lookup; - if (hasThis) path = path.slice(5); + if (!target || isGlobal) { + target = Ember.lookup; + } + + if (hasThis) { + path = path.slice(5); + } Ember.deprecate( "normalizeTuple will return '"+path+"' as a non-global. This behavior will change in the future (issue #3852)", @@ -130,7 +135,9 @@ function normalizeTuple(target, path) { } // must return some kind of path to be valid else other things will break. - if (!path || path.length===0) throw new EmberError('Path cannot be empty'); + if (!path || path.length===0) { + throw new EmberError('Path cannot be empty'); + } return [ target, path ]; }
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/lib/utils.js
@@ -98,7 +98,9 @@ function intern(str) { var obj = {}; obj[str] = 1; for (var key in obj) { - if (key === str) return key; + if (key === str) { + return key; + } } return str; } @@ -181,7 +183,10 @@ export var NEXT_SUPER_PROPERTY = { @return {String} the guid */ export function generateGuid(obj, prefix) { - if (!prefix) prefix = GUID_PREFIX; + if (!prefix) { + prefix = GUID_PREFIX; + } + var ret = (prefix + uuid()); if (obj) { if (obj[GUID_KEY] === null) { @@ -215,8 +220,13 @@ export function generateGuid(obj, prefix) { export function guidFor(obj) { // special cases where we don't want to add a key to object - if (obj === undefined) return "(undefined)"; - if (obj === null) return "(null)"; + if (obj === undefined) { + return "(undefined)"; + } + + if (obj === null) { + return "(null)"; + } var ret; var type = typeof obj; @@ -225,21 +235,38 @@ export function guidFor(obj) { switch(type) { case 'number': ret = numberCache[obj]; - if (!ret) ret = numberCache[obj] = 'nu'+obj; + + if (!ret) { + ret = numberCache[obj] = 'nu'+obj; + } + return ret; case 'string': ret = stringCache[obj]; - if (!ret) ret = stringCache[obj] = 'st' + uuid(); + + if (!ret) { + ret = stringCache[obj] = 'st' + uuid(); + } + return ret; case 'boolean': return obj ? '(true)' : '(false)'; default: - if (obj[GUID_KEY]) return obj[GUID_KEY]; - if (obj === Object) return '(Object)'; - if (obj === Array) return '(Array)'; + if (obj[GUID_KEY]) { + return obj[GUID_KEY]; + } + + if (obj === Object) { + return '(Object)'; + } + + if (obj === Array) { + return '(Array)'; + } + ret = GUID_PREFIX + uuid(); if (obj[GUID_KEY] === null) { @@ -320,7 +347,9 @@ if (Ember.FEATURES.isEnabled('mandatory-setter')) { */ function meta(obj, writable) { var ret = obj['__ember_meta__']; - if (writable===false) return ret || EMPTY_META; + if (writable===false) { + return ret || EMPTY_META; + } if (!ret) { if (canDefineNonEnumerableProperties) { @@ -847,11 +876,17 @@ function typeOf(item) { ret = (item === null || item === undefined) ? String(item) : TYPE_MAP[toString.call(item)] || 'object'; if (ret === 'function') { - if (EmberObject && EmberObject.detect(item)) ret = 'class'; + if (EmberObject && EmberObject.detect(item)) { + ret = 'class'; + } } else if (ret === 'object') { - if (item instanceof Error) ret = 'error'; - else if (EmberObject && item instanceof EmberObject) ret = 'instance'; - else if (item instanceof Date) ret = 'date'; + if (item instanceof Error) { + ret = 'error'; + } else if (EmberObject && item instanceof EmberObject) { + ret = 'instance'; + } else if (item instanceof Date) { + ret = 'date'; + } } return ret;
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/tests/accessors/get_test.js
@@ -22,7 +22,9 @@ test('should get arbitrary properties on an object', function() { }; for(var key in obj) { - if (!obj.hasOwnProperty(key)) continue; + if (!obj.hasOwnProperty(key)) { + continue; + } equal(get(obj, key), obj[key], key); } @@ -105,7 +107,9 @@ test('should get arbitrary properties on an object', function() { }; for(var key in obj) { - if (!obj.hasOwnProperty(key)) continue; + if (!obj.hasOwnProperty(key)) { + continue; + } equal(getWithDefault(obj, key, "fail"), obj[key], key); }
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/tests/accessors/set_test.js
@@ -18,7 +18,10 @@ test('should set arbitrary properties on an object', function() { }; for(var key in obj) { - if (!obj.hasOwnProperty(key)) continue; + if (!obj.hasOwnProperty(key)) { + continue; + } + equal(set(newObj, key, obj[key]), obj[key], 'should return value'); equal(get(newObj, key), obj[key], 'should set value'); }
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/tests/binding/connect_test.js
@@ -9,7 +9,9 @@ import { set } from 'ember-metal/property_set'; import { get } from 'ember-metal/property_get'; function performTest(binding, a, b, get, set, connect) { - if (connect === undefined) connect = function() {binding.connect(a);}; + if (connect === undefined) { + connect = function() {binding.connect(a);}; + } ok(!run.currentRunLoop, 'performTest should not have a currentRunLoop');
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/tests/computed_test.js
@@ -629,7 +629,9 @@ test('adding a computed property should show up in key iteration',function() { defineProperty(obj, 'foo', computed(function() {})); var found = []; - for(var key in obj) found.push(key); + for(var key in obj) { + found.push(key); + } ok(indexOf(found, 'foo')>=0, 'should find computed property in iteration found=' + found); ok('foo' in obj, 'foo in obj should pass'); });
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/tests/mixin/method_test.js
@@ -136,7 +136,9 @@ test('_super from a first-of-two mixins with no superclass function does not err var remaining = 3; var MixinA = Mixin.create({ foo: function() { - if (remaining-- > 0) this._super(); + if (remaining-- > 0) { + this._super(); + } } });
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/tests/observer_test.js
@@ -450,8 +450,9 @@ testBoth('deferring property change notifications safely despite exceptions', fu throw exc; }); } catch(err) { - if (err !== exc) + if (err !== exc) { throw err; + } } equal(fooCount, 1, 'foo should have fired once');
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/tests/platform/defineProperty_test.js
@@ -4,7 +4,9 @@ import EnumerableUtils from 'ember-metal/enumerable_utils'; function isEnumerable(obj, keyName) { var keys = []; for(var key in obj) { - if (obj.hasOwnProperty(key)) keys.push(key); + if (obj.hasOwnProperty(key)) { + keys.push(key); + } } return EnumerableUtils.indexOf(keys, keyName)>=0; }
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/tests/props_helper.js
@@ -15,8 +15,11 @@ var testBoth = function(testname, callback) { }); test(testname+' using accessors', function() { - if (Ember.USES_ACCESSORS) callback(aget, aset); - else ok('SKIPPING ACCESSORS'); + if (Ember.USES_ACCESSORS) { + callback(aget, aset); + } else { + ok('SKIPPING ACCESSORS'); + } }); }; @@ -45,8 +48,11 @@ var testWithDefault = function(testname, callback) { }); test(testname+' using accessors', function() { - if (Ember.USES_ACCESSORS) callback(aget, aset); - else ok('SKIPPING ACCESSORS'); + if (Ember.USES_ACCESSORS) { + callback(aget, aset); + } else { + ok('SKIPPING ACCESSORS'); + } }); };
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/tests/run_loop/sync_test.js
@@ -10,7 +10,9 @@ test('sync() will immediately flush the sync queue only', function() { function cntup() { cnt++; } function syncfunc() { - if (++cnt<5) run.schedule('sync', syncfunc); + if (++cnt<5) { + run.schedule('sync', syncfunc); + } run.schedule('actions', cntup); }
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/tests/watching/unwatch_test.js
@@ -29,7 +29,10 @@ testBoth('unwatching a computed property - regular get/set', function(get, set) var obj = {}; defineProperty(obj, 'foo', computed(function(keyName, value) { - if (value !== undefined) this.__foo = value; + if (value !== undefined) { + this.__foo = value; + } + return this.__foo; })); addListeners(obj, 'foo');
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-metal/tests/watching/watch_test.js
@@ -41,7 +41,10 @@ function addListeners(obj, keyPath) { testBoth('watching a computed property', function(get, set) { var obj = {}; Ember.defineProperty(obj, 'foo', Ember.computed(function(keyName, value) { - if (value !== undefined) this.__foo = value; + if (value !== undefined) { + this.__foo = value; + } + return this.__foo; })); addListeners(obj, 'foo');
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-routing-views/lib/views/link.js
@@ -20,8 +20,9 @@ var numberOfContextsAcceptedByHandler = function(handler, handlerInfos) { var req = 0; for (var i = 0, l = handlerInfos.length; i < l; i++) { req = req + handlerInfos[i].names.length; - if (handlerInfos[i].handler === handler) + if (handlerInfos[i].handler === handler) { break; + } } return req;
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-routing/lib/ext/view.js
@@ -138,7 +138,10 @@ EmberView.reopen({ @method _finishDisconnections */ _finishDisconnections: function() { - if (this.isDestroyed) return; // _outlets will be gone anyway + if (this.isDestroyed) { + return; // _outlets will be gone anyway + } + var outlets = get(this, '_outlets'); var pendingDisconnections = this._pendingDisconnections; this._pendingDisconnections = null;
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/lib/mixins/freezable.js
@@ -82,7 +82,10 @@ export var Freezable = Mixin.create({ @return {Object} receiver */ freeze: function() { - if (get(this, 'isFrozen')) return this; + if (get(this, 'isFrozen')) { + return this; + } + set(this, 'isFrozen', true); return this; }
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/lib/mixins/mutable_array.js
@@ -83,7 +83,10 @@ export default Mixin.create(EmberArray, MutableEnumerable, { */ clear: function () { var len = get(this, 'length'); - if (len === 0) return this; + if (len === 0) { + return this; + } + this.replace(0, len, EMPTY); return this; }, @@ -104,7 +107,10 @@ export default Mixin.create(EmberArray, MutableEnumerable, { @return {Ember.Array} receiver */ insertAt: function(idx, object) { - if (idx > get(this, 'length')) throw new EmberError(OUT_OF_RANGE_EXCEPTION); + if (idx > get(this, 'length')) { + throw new EmberError(OUT_OF_RANGE_EXCEPTION); + } + this.replace(idx, 0, [object]); return this; }, @@ -136,7 +142,10 @@ export default Mixin.create(EmberArray, MutableEnumerable, { } // fast case - if (len === undefined) len = 1; + if (len === undefined) { + len = 1; + } + this.replace(start, len, EMPTY); } @@ -198,7 +207,9 @@ export default Mixin.create(EmberArray, MutableEnumerable, { */ popObject: function() { var len = get(this, 'length'); - if (len === 0) return null; + if (len === 0) { + return null; + } var ret = this.objectAt(len-1); this.removeAt(len-1, 1); @@ -219,7 +230,10 @@ export default Mixin.create(EmberArray, MutableEnumerable, { @return object */ shiftObject: function() { - if (get(this, 'length') === 0) return null; + if (get(this, 'length') === 0) { + return null; + } + var ret = this.objectAt(0); this.removeAt(0); return ret; @@ -272,7 +286,10 @@ export default Mixin.create(EmberArray, MutableEnumerable, { */ reverseObjects: function() { var len = get(this, 'length'); - if (len === 0) return this; + if (len === 0) { + return this; + } + var objects = this.toArray().reverse(); this.replace(0, len, objects); return this; @@ -294,7 +311,9 @@ export default Mixin.create(EmberArray, MutableEnumerable, { @return {Ember.Array} receiver with the new content */ setObjects: function(objects) { - if (objects.length === 0) return this.clear(); + if (objects.length === 0) { + return this.clear(); + } var len = get(this, 'length'); this.replace(0, len, objects); @@ -323,7 +342,10 @@ export default Mixin.create(EmberArray, MutableEnumerable, { var loc = get(this, 'length') || 0; while(--loc >= 0) { var curObject = this.objectAt(loc); - if (curObject === obj) this.removeAt(loc); + + if (curObject === obj) { + this.removeAt(loc); + } } return this; }, @@ -343,7 +365,10 @@ export default Mixin.create(EmberArray, MutableEnumerable, { @return {Ember.Array} receiver */ addObject: function(obj) { - if (!this.contains(obj)) this.pushObject(obj); + if (!this.contains(obj)) { + this.pushObject(obj); + } + return this; }
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/lib/mixins/target_action_support.js
@@ -33,7 +33,10 @@ var TargetActionSupport = Mixin.create({ if (typeOf(target) === "string") { var value = get(this, target); - if (value === undefined) { value = get(Ember.lookup, target); } + if (value === undefined) { + value = get(Ember.lookup, target); + } + return value; } else { return target; @@ -131,7 +134,9 @@ var TargetActionSupport = Mixin.create({ ret = target[action].apply(target, args(actionContext)); } - if (ret !== false) ret = true; + if (ret !== false) { + ret = true; + } return ret; } else {
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/lib/system/array_proxy.js
@@ -261,7 +261,10 @@ var ArrayProxy = EmberObject.extend(MutableArray, { _replace: function(idx, amt, objects) { var content = get(this, 'content'); Ember.assert('The content property of '+ this.constructor + ' should be set before modifying it', content); - if (content) this.replaceContent(idx, amt, objects); + if (content) { + this.replaceContent(idx, amt, objects); + } + return this; }, @@ -274,7 +277,10 @@ var ArrayProxy = EmberObject.extend(MutableArray, { }, _insertAt: function(idx, object) { - if (idx > get(this, 'content.length')) throw new EmberError(OUT_OF_RANGE_EXCEPTION); + if (idx > get(this, 'content.length')) { + throw new EmberError(OUT_OF_RANGE_EXCEPTION); + } + this._replace(idx, 0, [object]); return this; }, @@ -298,7 +304,9 @@ var ArrayProxy = EmberObject.extend(MutableArray, { throw new EmberError(OUT_OF_RANGE_EXCEPTION); } - if (len === undefined) len = 1; + if (len === undefined) { + len = 1; + } // Get a list of indices in original content to remove for (i=start; i<start+len; i++) { @@ -333,7 +341,9 @@ var ArrayProxy = EmberObject.extend(MutableArray, { }, setObjects: function(objects) { - if (objects.length === 0) return this.clear(); + if (objects.length === 0) { + return this.clear(); + } var len = get(this, 'length'); this._replace(0, len, objects);
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/lib/system/each_proxy.js
@@ -55,7 +55,9 @@ var IS_OBSERVER = /^.+:(before|change)$/; function addObserverForContentKey(content, keyName, proxy, idx, loc) { var objects = proxy._objects; var guid; - if (!objects) objects = proxy._objects = {}; + if (!objects) { + objects = proxy._objects = {}; + } while(--loc>=idx) { var item = content.objectAt(loc); @@ -67,15 +69,21 @@ function addObserverForContentKey(content, keyName, proxy, idx, loc) { // keep track of the index each item was found at so we can map // it back when the obj changes. guid = guidFor(item); - if (!objects[guid]) objects[guid] = []; + if (!objects[guid]) { + objects[guid] = []; + } + objects[guid].push(loc); } } } function removeObserverForContentKey(content, keyName, proxy, idx, loc) { var objects = proxy._objects; - if (!objects) objects = proxy._objects = {}; + if (!objects) { + objects = proxy._objects = {}; + } + var indicies, guid; while(--loc>=idx) { @@ -194,7 +202,10 @@ var EachProxy = EmberObject.extend({ beginObservingContentKey: function(keyName) { var keys = this._keys; - if (!keys) keys = this._keys = {}; + if (!keys) { + keys = this._keys = {}; + } + if (!keys[keyName]) { keys[keyName] = 1; var content = this._content;
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/lib/system/native_array.js
@@ -41,9 +41,13 @@ var NativeArray = Mixin.create(MutableArray, Observable, Copyable, { // because length is a built-in property we need to know to just get the // original property. get: function(key) { - if (key==='length') return this.length; - else if ('number' === typeof key) return this[key]; - else return this._super(key); + if (key==='length') { + return this.length; + } else if ('number' === typeof key) { + return this[key]; + } else { + return this._super(key); + } }, objectAt: function(idx) { @@ -53,7 +57,9 @@ var NativeArray = Mixin.create(MutableArray, Observable, Copyable, { // primitive for array support. replace: function(idx, amt, objects) { - if (this.isFrozen) throw FROZEN_ERROR; + if (this.isFrozen) { + throw FROZEN_ERROR; + } // if we replaced exactly the same number of items, then pass only the // replaced range. Otherwise, pass the full remaining array length @@ -97,7 +103,9 @@ var NativeArray = Mixin.create(MutableArray, Observable, Copyable, { // Remove any methods implemented natively so we don't override them var ignore = ['length']; forEach(NativeArray.keys(), function(methodName) { - if (Array.prototype[methodName]) ignore.push(methodName); + if (Array.prototype[methodName]) { + ignore.push(methodName); + } }); if (ignore.length > 0) {
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/lib/system/set.js
@@ -197,13 +197,19 @@ export default CoreObject.extend(MutableEnumerable, Copyable, Freezable, { */ isEqual: function(obj) { // fail fast - if (!Enumerable.detect(obj)) return false; + if (!Enumerable.detect(obj)) { + return false; + } var loc = get(this, 'length'); - if (get(obj, 'length') !== loc) return false; + if (get(obj, 'length') !== loc) { + return false; + } while(--loc >= 0) { - if (!obj.contains(this[loc])) return false; + if (!obj.contains(this[loc])) { + return false; + } } return true; @@ -263,7 +269,10 @@ export default CoreObject.extend(MutableEnumerable, Copyable, Freezable, { @return {Object} The removed object from the set or null. */ pop: function() { - if (get(this, 'isFrozen')) throw new EmberError(FROZEN_ERROR); + if (get(this, 'isFrozen')) { + throw new EmberError(FROZEN_ERROR); + } + var obj = this.length > 0 ? this[this.length-1] : null; this.remove(obj); return obj; @@ -361,7 +370,10 @@ export default CoreObject.extend(MutableEnumerable, Copyable, Freezable, { init: function(items) { Ember.deprecate('Ember.Set is deprecated and will be removed in a future release.'); this._super(); - if (items) this.addObjects(items); + + if (items) { + this.addObjects(items); + } }, // implement Ember.Enumerable @@ -381,15 +393,22 @@ export default CoreObject.extend(MutableEnumerable, Copyable, Freezable, { // implements Ember.MutableEnumerable addObject: function(obj) { - if (get(this, 'isFrozen')) throw new EmberError(FROZEN_ERROR); - if (isNone(obj)) return this; // nothing to do + if (get(this, 'isFrozen')) { + throw new EmberError(FROZEN_ERROR); + } + + if (isNone(obj)) { + return this; // nothing to do + } var guid = guidFor(obj); var idx = this[guid]; var len = get(this, 'length'); var added; - if (idx>=0 && idx<len && (this[idx] === obj)) return this; // added + if (idx>=0 && idx<len && (this[idx] === obj)) { + return this; // added + } added = [obj]; @@ -409,8 +428,13 @@ export default CoreObject.extend(MutableEnumerable, Copyable, Freezable, { // implements Ember.MutableEnumerable removeObject: function(obj) { - if (get(this, 'isFrozen')) throw new EmberError(FROZEN_ERROR); - if (isNone(obj)) return this; // nothing to do + if (get(this, 'isFrozen')) { + throw new EmberError(FROZEN_ERROR); + } + + if (isNone(obj)) { + return this; // nothing to do + } var guid = guidFor(obj); var idx = this[guid];
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js
@@ -372,12 +372,17 @@ QUnit.module("Computed properties", { // two computed properties that depend on a third property state: 'on', isOn: computed(function(key, value) { - if (value !== undefined) this.set('state', 'on'); + if (value !== undefined) { + this.set('state', 'on'); + } + return this.get('state') === 'on'; }).property('state').volatile(), isOff: computed(function(key, value) { - if (value !== undefined) this.set('state', 'off'); + if (value !== undefined) { + this.set('state', 'off'); + } return this.get('state') === 'off'; }).property('state').volatile()
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/tests/mixins/copyable_test.js
@@ -30,7 +30,10 @@ CopyableTests.extend({ }, isEqual: function(a, b) { - if (!(a instanceof CopyableObject) || !(b instanceof CopyableObject)) return false; + if (!(a instanceof CopyableObject) || !(b instanceof CopyableObject)) { + return false; + } + return get(a, 'id') === get(b,'id'); } }).run();
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/tests/mixins/enumerable_test.js
@@ -25,7 +25,10 @@ var TestEnumerable = EmberObject.extend(Enumerable, { }, addObject: function(obj) { - if (indexOf(this._content, obj)>=0) return this; + if (indexOf(this._content, obj)>=0) { + return this; + } + this._content.push(obj); this.enumerableContentDidChange(); },
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/tests/mixins/mutable_enumerable_test.js
@@ -14,15 +14,20 @@ var TestMutableEnumerable = EmberObject.extend(MutableEnumerable, { _content: null, addObject: function(obj) { - if (indexOf(this._content, obj)>=0) return this; + if (indexOf(this._content, obj)>=0) { + return this; + } + this.enumerableContentWillChange(null, [obj]); this._content.push(obj); this.enumerableContentDidChange(null, [obj]); }, removeObject: function(obj) { var idx = indexOf(this._content, obj); - if (idx<0) return this; + if (idx<0) { + return this; + } this.enumerableContentWillChange([obj], null); this._content.splice(idx, 1);
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/tests/suites/enumerable.js
@@ -55,7 +55,10 @@ var ObserverClass = EmberObject.extend({ observeBefore: function(obj) { var keys = Array.prototype.slice.call(arguments, 1); var loc = keys.length; - while(--loc>=0) addBeforeObserver(obj, keys[loc], this, 'propertyWillChange'); + while(--loc>=0) { + addBeforeObserver(obj, keys[loc], this, 'propertyWillChange'); + } + return this; }, @@ -73,7 +76,9 @@ var ObserverClass = EmberObject.extend({ var keys = Array.prototype.slice.call(arguments, 1); var loc = keys.length; - while(--loc>=0) obj.addObserver(keys[loc], this, 'propertyDidChange'); + while(--loc>=0) { + obj.addObserver(keys[loc], this, 'propertyDidChange'); + } } else { this.isEnabled = false; } @@ -93,10 +98,19 @@ var ObserverClass = EmberObject.extend({ @returns {Boolean} */ validate: function(key, value) { - if (!this.isEnabled) return true; - if (!this._keys[key]) return false; - if (arguments.length>1) return this._values[key] === value; - else return true; + if (!this.isEnabled) { + return true; + } + + if (!this._keys[key]) { + return false; + } + + if (arguments.length>1) { + return this._values[key] === value; + } else { + return true; + } }, /** @@ -169,7 +183,10 @@ var EnumerableTests = Suite.extend({ */ newFixture: function(cnt) { var ret = []; - while(--cnt >= 0) ret.push(generateGuid()); + while(--cnt >= 0) { + ret.push(generateGuid()); + } + return ret; }, @@ -246,8 +263,14 @@ var EnumerableTests = Suite.extend({ */ newObserver: function(obj) { var ret = get(this, 'observerClass').create(); - if (arguments.length>0) ret.observeBefore.apply(ret, arguments); - if (arguments.length>0) ret.observe.apply(ret, arguments); + if (arguments.length>0) { + ret.observeBefore.apply(ret, arguments); + } + + if (arguments.length>0) { + ret.observe.apply(ret, arguments); + } + return ret; },
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/tests/suites/suite.js
@@ -64,7 +64,10 @@ Suite.reopenClass({ }, module: function(desc, opts) { - if (!opts) opts = {}; + if (!opts) { + opts = {}; + } + var setup = opts.setup; var teardown = opts.teardown; this.reopen({ @@ -74,11 +77,15 @@ Suite.reopenClass({ var ctx = this; QUnit.module(title, { setup: function() { - if (setup) setup.call(ctx); + if (setup) { + setup.call(ctx); + } }, teardown: function() { - if (teardown) teardown.call(ctx); + if (teardown) { + teardown.call(ctx); + } } }); } @@ -90,8 +97,12 @@ Suite.reopenClass({ run: function() { this._super(); var ctx = this; - if (!func) test(name); // output warning - else test(name, function() { func.call(ctx); }); + + if (!func) { + test(name); // output warning + } else { + test(name, function() { func.call(ctx); }); + } } }); },
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/tests/system/native_array/copyable_suite_test.js
@@ -9,9 +9,18 @@ CopyableTests.extend({ }, isEqual: function(a,b) { - if (!(a instanceof Array)) return false; - if (!(b instanceof Array)) return false; - if (a.length !== b.length) return false; + if (!(a instanceof Array)) { + return false; + } + + if (!(b instanceof Array)) { + return false; + } + + if (a.length !== b.length) { + return false; + } + return a[0]===b[0]; },
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-runtime/tests/system/set/copyable_suite_test.js
@@ -29,8 +29,14 @@ CopyableTests.extend({ }, isEqual: function(a,b) { - if (!(a instanceof Set)) return false; - if (!(b instanceof Set)) return false; + if (!(a instanceof Set)) { + return false; + } + + if (!(b instanceof Set)) { + return false; + } + return get(a, 'firstObject') === get(b, 'firstObject'); },
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-views/lib/views/states/default.js
@@ -26,8 +26,10 @@ export default { }, destroyElement: function(view) { - if (view._renderer) + if (view._renderer) { view._renderer.remove(view, false); + } + return view; },
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-views/lib/views/states/has_element.js
@@ -35,7 +35,10 @@ merge(hasElement, { } // TODO: should be scheduled with renderer run.scheduleOnce('render', function () { - if (view.isDestroying) return; + if (view.isDestroying) { + return; + } + view._renderer.renderTree(view, view._parentView); }); },
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-views/lib/views/states/in_dom.js
@@ -35,7 +35,9 @@ merge(inDOM, { exit: function(view) { if (!View) { View = requireModule('ember-views/views/view')["default"]; } // ES6TODO: this sucks. Have to avoid cycles... - if (!this.isVirtual) delete View.views[view.elementId]; + if (!this.isVirtual) { + delete View.views[view.elementId]; + } } });
true
Other
emberjs
ember.js
374ff0a33709fd284c3f988cc4c32b0dcddde6b8.json
Require curly brackets.
packages/ember-views/lib/views/view.js
@@ -1067,7 +1067,10 @@ var View = CoreView.extend({ keywords.view.setSource(this.isVirtual ? parentKeywords.view : this); for (var name in parentKeywords) { - if (keywords[name]) continue; + if (keywords[name]) { + continue; + } + keywords[name] = parentKeywords[name]; } } else {
true
Other
emberjs
ember.js
b27712aac7b58061bb00792002054ad2d533b974.json
Exclude files with invalid ES6 syntax.
.jscsrc
@@ -1,5 +1,6 @@ { "esnext": true, + "excludeFiles": ["ember-runtime/ext/rsvp.js"], "additionalRules": [ "lib/jscs-rules/*.js" ], "disallowMultipleVarDeclWithAssignment": true }
false
Other
emberjs
ember.js
09fe6652b4a180f552e952b43ade3bdb94a73cea.json
Use jscs for style checking.
.jscsrc
@@ -0,0 +1,5 @@ +{ + "esnext": true, + "additionalRules": [ "lib/jscs-rules/*.js" ], + "disallowMultipleVarDeclWithAssignment": true +}
true
Other
emberjs
ember.js
09fe6652b4a180f552e952b43ade3bdb94a73cea.json
Use jscs for style checking.
lib/jscs-rules/disallow-multiple-var-decl-with-assignment.js
@@ -0,0 +1,39 @@ +var assert = require('assert'); + +module.exports = function() {}; + +module.exports.prototype = { + configure: function(disallowMultipleVarDeclWithAssignment) { + assert( + typeof disallowMultipleVarDeclWithAssignment === 'boolean', + 'disallowMultipleVarDeclWithAssignment option requires boolean value' + ); + assert( + disallowMultipleVarDeclWithAssignment === true, + 'disallowMultipleVarDeclWithAssignment option requires true value or should be removed' + ); + }, + + getOptionName: function() { + return 'disallowMultipleVarDeclWithAssignment'; + }, + + check: function(file, errors) { + file.iterateNodesByType('VariableDeclaration', function(node) { + // allow multiple var declarations in for statement + // for (var i = 0, j = myArray.length; i < j; i++) {} + if (node.parentNode.type === 'ForStatement') { return; } + + var hasAssignment = false; + var multiDeclaration = node.declarations.length > 1; + + node.declarations.forEach(function(declaration) { + if (declaration.init) { hasAssignment = true; } + }); + + if (hasAssignment && multiDeclaration) { + errors.add('Multiple assigning variable declarations', node.loc.start); + } + }); + } +};
true
Other
emberjs
ember.js
013b99b61bd693b98d22b3dd2c9102a9d423c451.json
Remove lines with only spaces.
packages/container/lib/container.js
@@ -25,7 +25,7 @@ function Container(registry, options) { // TODO - See note above about transpiler import workaround. if (!Registry) { Registry = requireModule('container/registry')['default']; } - + return new Registry(); }());
true
Other
emberjs
ember.js
013b99b61bd693b98d22b3dd2c9102a9d423c451.json
Remove lines with only spaces.
packages/ember-debug/lib/main.js
@@ -188,7 +188,7 @@ Ember.runInDebug = function(func) { any specific FEATURES flag is truthy. This method is called automatically in debug canary builds. - + @private @method _warnIfUsingStrippedFeatureFlags @return {void} @@ -210,7 +210,7 @@ if (!Ember.testing) { // Complain if they're using FEATURE flags in builds other than canary Ember.FEATURES['features-stripped-test'] = true; var featuresWereStripped = true; - + if (Ember.FEATURES.isEnabled('features-stripped-test')) { featuresWereStripped = false; }
true
Other
emberjs
ember.js
013b99b61bd693b98d22b3dd2c9102a9d423c451.json
Remove lines with only spaces.
packages/ember-routing/lib/location/hash_location.js
@@ -52,7 +52,7 @@ export default EmberObject.extend({ getURL: function() { var originalPath = this.getHash().substr(1); var outPath = originalPath; - + if (outPath.charAt(0) !== '/') { outPath = '/';
true
Other
emberjs
ember.js
013b99b61bd693b98d22b3dd2c9102a9d423c451.json
Remove lines with only spaces.
packages/ember-routing/tests/location/hash_location_test.js
@@ -90,7 +90,7 @@ test("HashLocation.getURL() returns a normal forward slash when there is no loca createLocation({ _location: mockBrowserLocation('/') }); - + equal(location.getURL(), '/'); }); @@ -183,4 +183,4 @@ test("HashLocation.willDestroy() cleans up hashchange event listener", function( // clean up Ember.$ = oldJquery; -}); \ No newline at end of file +});
true
Other
emberjs
ember.js
013b99b61bd693b98d22b3dd2c9102a9d423c451.json
Remove lines with only spaces.
packages/ember-runtime/lib/mixins/enumerable.js
@@ -221,7 +221,7 @@ export default Mixin.create({ var found = this.find(function(item) { return item === obj; }); - + return found !== undefined; },
true
Other
emberjs
ember.js
013b99b61bd693b98d22b3dd2c9102a9d423c451.json
Remove lines with only spaces.
packages/ember-views/tests/views/view/stream_test.js
@@ -61,7 +61,7 @@ test("the stream returned is labeled with the requested path", function() { controller: { name: 'Robert' }, - + foo: 'bar' });
true
Other
emberjs
ember.js
468fe7bd286048b59b900347a4f741ba4da0cb39.json
Remove code duplication in view helper
packages/ember-htmlbars/lib/helpers/view.js
@@ -123,73 +123,38 @@ export var ViewHelper = EmberObject.create({ return extensions; }, - helper: function(newView, hash, options, env) { - var data = env.data; - var template = options.template; - var newViewProto; + helper: function(viewInstanceOrClass, hash, options, env) { + var currentView = env.data.view; + var viewProto; - makeBindings(hash, options, env.data.view); + makeBindings(hash, options, currentView); - var viewOptions = this.propertiesFromHTMLOptions(hash, options, env); - var currentView = data.view; + var props = this.propertiesFromHTMLOptions(hash, options, env); - if (View.detectInstance(newView)) { - newViewProto = newView; + if (View.detectInstance(viewInstanceOrClass)) { + viewProto = viewInstanceOrClass; } else { - newViewProto = newView.proto(); - } - - if (template) { - Ember.assert( - "You cannot provide a template block if you also specified a templateName", - !get(viewOptions, 'templateName') && !get(newViewProto, 'templateName') - ); - viewOptions.template = template; - } - - // We only want to override the `_context` computed property if there is - // no specified controller. See View#_context for more information. - if (!newViewProto.controller && !newViewProto.controllerBinding && !viewOptions.controller && !viewOptions.controllerBinding) { - viewOptions._context = get(currentView, 'context'); // TODO: is this right?! + viewProto = viewInstanceOrClass.proto(); } - viewOptions._morph = options.morph; - - currentView.appendChild(newView, viewOptions); - }, - - instanceHelper: function(newView, hash, options, env) { - var data = env.data; var template = options.template; - - makeBindings(hash, options, env.data.view); - - Ember.assert( - 'Only a instance of a view may be passed to the ViewHelper.instanceHelper', - View.detectInstance(newView) - ); - - var viewOptions = this.propertiesFromHTMLOptions(hash, options, env); - var currentView = data.view; - if (template) { Ember.assert( "You cannot provide a template block if you also specified a templateName", - !get(viewOptions, 'templateName') && !get(newView, 'templateName') + !get(props, 'templateName') && !get(viewProto, 'templateName') ); - viewOptions.template = template; + props.template = template; } // We only want to override the `_context` computed property if there is // no specified controller. See View#_context for more information. - if (!newView.controller && !newView.controllerBinding && - !viewOptions.controller && !viewOptions.controllerBinding) { - viewOptions._context = get(currentView, 'context'); // TODO: is this right?! + if (!viewProto.controller && !viewProto.controllerBinding && !props.controller && !props.controllerBinding) { + props._context = get(currentView, 'context'); // TODO: is this right?! } - viewOptions._morph = options.morph; + props._morph = options.morph; - currentView.appendChild(newView, viewOptions); + currentView.appendChild(viewInstanceOrClass, props); } });
true
Other
emberjs
ember.js
468fe7bd286048b59b900347a4f741ba4da0cb39.json
Remove code duplication in view helper
packages/ember-routing-htmlbars/lib/helpers/render.js
@@ -169,5 +169,5 @@ export function renderHelper(params, hash, options, env) { options.helperName = options.helperName || ('render "' + name + '"'); - ViewHelper.instanceHelper(view, hash, options, env); + ViewHelper.helper(view, hash, options, env); }
true
Other
emberjs
ember.js
e6f4f4910629334eb4bd5a44f3852e602e20770a.json
Fix quotes in example code
packages/ember-routing/lib/system/route.js
@@ -995,7 +995,7 @@ var Route = EmberObject.extend(ActionHandler, Evented, { ```javascript App.Router.map(function() { - this.route("index"); + this.route('index'); }); App.ApplicationRoute = Ember.Route.extend({
false
Other
emberjs
ember.js
95b2f2b969a0958c3cd6f51ca1d5c8a84639737e.json
Use Node 0.11.
.travis.yml
@@ -1,5 +1,7 @@ --- language: node_js +node_js: + - "0.11" sudo: false
false
Other
emberjs
ember.js
c24b7910d661492734e92d4e4aab22a2fd608e16.json
Fix YUIDoc generation. The builds were not publishing to S3 because `ember yuidoc` command did not exist after refactoring the Brocfile into its own repo. This brings back the addon (and therefore the command) so that we can properly generate the data.json output.
.travis.yml
@@ -9,7 +9,6 @@ cache: install: - "npm install" - - "npm run docs" after_success: - "./bin/publish_builds"
true
Other
emberjs
ember.js
c24b7910d661492734e92d4e4aab22a2fd608e16.json
Fix YUIDoc generation. The builds were not publishing to S3 because `ember yuidoc` command did not exist after refactoring the Brocfile into its own repo. This brings back the addon (and therefore the command) so that we can properly generate the data.json output.
bin/publish_builds
@@ -9,6 +9,7 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ember build --environment=production fi + npm run docs # generate documentation to be published ./bin/publish_to_s3.js ./bin/bower_ember_build fi
true
Other
emberjs
ember.js
c24b7910d661492734e92d4e4aab22a2fd608e16.json
Fix YUIDoc generation. The builds were not publishing to S3 because `ember yuidoc` command did not exist after refactoring the Brocfile into its own repo. This brings back the addon (and therefore the command) so that we can properly generate the data.json output.
package.json
@@ -15,13 +15,14 @@ "bower": "~1.3.2", "chalk": "~0.4.0", "ember-cli": "0.0.46", + "ember-cli-yuidoc": "^0.3.1", "ember-publisher": "0.0.6", + "emberjs-build": "0.0.4", "express": "^4.5.0", "glob": "~3.2.8", "htmlbars": "0.5.0", - "rsvp": "~3.0.6", "qunit-extras": "^1.3.0", "qunitjs": "^1.16.0", - "emberjs-build": "0.0.4" + "rsvp": "~3.0.6" } }
true
Other
emberjs
ember.js
e34dd12f1921cba438c2f5d16cc249f1f832b612.json
Remove bind helper
packages/ember-htmlbars/lib/helpers/binding.js
@@ -1,115 +0,0 @@ -/** -@module ember -@submodule ember-htmlbars -*/ - -import isNone from 'ember-metal/is_none'; -import run from "ember-metal/run_loop"; -import { get } from "ember-metal/property_get"; -import SimpleStream from "ember-metal/streams/simple"; -import BoundView from "ember-views/views/bound_view"; -import { isStream } from "ember-metal/streams/utils"; - -function exists(value) { - return !isNone(value); -} - -// Binds a property into the DOM. This will create a hook in DOM that the -// KVO system will look for and update if the property changes. -function bind(property, hash, options, env, preserveContext, shouldDisplay, valueNormalizer, childProperties, _viewClass) { - var valueStream = isStream(property) ? property : this.getStream(property); - var lazyValue; - - if (childProperties) { - lazyValue = new SimpleStream(valueStream); - - var subscriber = function(childStream) { - childStream.value(); - lazyValue.notify(); - }; - - for (var i = 0; i < childProperties.length; i++) { - var childStream = valueStream.get(childProperties[i]); - childStream.value(); - childStream.subscribe(subscriber); - } - } else { - lazyValue = valueStream; - } - - // Set up observers for observable objects - var viewClass = _viewClass || BoundView; - var viewOptions = { - _morph: options.morph, - preserveContext: preserveContext, - shouldDisplayFunc: shouldDisplay, - valueNormalizerFunc: valueNormalizer, - displayTemplate: options.template, - inverseTemplate: options.inverse, - lazyValue: lazyValue, - previousContext: get(this, 'context'), - templateHash: hash, - helperName: options.helperName - }; - - if (options.keywords) { - viewOptions._keywords = options.keywords; - } - - // Create the view that will wrap the output of this template/property - // and add it to the nearest view's childViews array. - // See the documentation of Ember._BoundView for more. - var bindView = this.createChildView(viewClass, viewOptions); - - this.appendChild(bindView); - - lazyValue.subscribe(this._wrapAsScheduled(function() { - run.scheduleOnce('render', bindView, 'rerenderIfNeeded'); - })); -} - -/** - `bind` can be used to display a value, then update that value if it - changes. For example, if you wanted to print the `title` property of - `content`: - - ```handlebars - {{bind "content.title"}} - ``` - - This will return the `title` property as a string, then create a new observer - at the specified path. If it changes, it will update the value in DOM. Note - that if you need to support IE7 and IE8 you must modify the model objects - properties using `Ember.get()` and `Ember.set()` for this to work as it - relies on Ember's KVO system. For all other browsers this will be handled for - you automatically. - - @private - @method bind - @for Ember.Handlebars.helpers - @param {String} property Property to bind - @param {Function} render Context to provide for rendering - @return {String} HTML string -*/ -function bindHelper(params, hash, options, env) { - Ember.assert("You must pass exactly one argument to the bind helper", params.length === 1); - - var property = params[0]; - - if (typeof property === 'string') { - property = this.getStream(property); - } - - if (options.template) { - options.helperName = 'bind'; - Ember.deprecate("The block form of bind, {{#bind foo}}{{/bind}}, has been deprecated and will be removed."); - bind.call(this, property, hash, options, env, false, exists); - } else { - return property; - } -} - -export { - bind, - bindHelper -};
true
Other
emberjs
ember.js
e34dd12f1921cba438c2f5d16cc249f1f832b612.json
Remove bind helper
packages/ember-htmlbars/lib/main.js
@@ -18,7 +18,6 @@ import { helper, default as helpers } from "ember-htmlbars/helpers"; -import { bindHelper } from "ember-htmlbars/helpers/binding"; import { viewHelper } from "ember-htmlbars/helpers/view"; import { yieldHelper } from "ember-htmlbars/helpers/yield"; import { withHelper } from "ember-htmlbars/helpers/with"; @@ -57,8 +56,6 @@ import "ember-htmlbars/system/bootstrap"; // Ember.Handlebars global if htmlbars is enabled import "ember-htmlbars/compat"; -registerHelper('bindHelper', bindHelper); -registerHelper('bind', bindHelper); registerHelper('view', viewHelper); registerHelper('yield', yieldHelper); registerHelper('with', withHelper);
true
Other
emberjs
ember.js
e34dd12f1921cba438c2f5d16cc249f1f832b612.json
Remove bind helper
packages/ember-htmlbars/tests/helpers/bind_test.js
@@ -1,286 +0,0 @@ -import EmberView from "ember-views/views/view"; -import EmberObject from "ember-runtime/system/object"; -import run from "ember-metal/run_loop"; -import _MetamorphView from 'ember-views/views/metamorph_view'; -import compile from "ember-htmlbars/system/compile"; -import { Registry } from "ember-runtime/system/container"; -import ObjectController from "ember-runtime/controllers/object_controller"; - -import { get } from "ember-metal/property_get"; -import { set } from "ember-metal/property_set"; -import { runAppend, runDestroy } from "ember-runtime/tests/utils"; - -var view, registry, container; - -QUnit.module("ember-htmlbars: {{bind}} helper", { - setup: function() { - registry = new Registry(); - container = registry.container(); - registry.optionsForType('template', { instantiate: false }); - registry.register('view:default', _MetamorphView); - registry.register('view:toplevel', EmberView.extend()); - }, - teardown: function() { - runDestroy(container); - runDestroy(view); - registry = container = view = null; - } -}); - -test("it should render the current value of a property on the context", function() { - view = EmberView.create({ - template: compile('{{bind foo}}'), - context: EmberObject.create({ - foo: "BORK" - }) - }); - - runAppend(view); - - equal(view.$().text(), "BORK", "initial value is rendered"); - - run(view, view.set, 'context.foo', 'MWEEER'); - - equal(view.$().text(), "MWEEER", "value can be updated"); -}); - -test("it should render the current value of a path on the context", function() { - view = EmberView.create({ - template: compile('{{bind foo.bar}}'), - context: EmberObject.create({ - foo: { - bar: "BORK" - } - }) - }); - - runAppend(view); - - equal(view.$().text(), "BORK", "initial value is rendered"); - - run(view, view.set, 'context.foo.bar', 'MWEEER'); - - equal(view.$().text(), "MWEEER", "value can be updated"); -}); - -test("it should render the current value of a string path on the context", function() { - view = EmberView.create({ - template: compile('{{bind "foo.bar"}}'), - context: EmberObject.create({ - foo: { - bar: "BORK" - } - }) - }); - - runAppend(view); - - equal(view.$().text(), "BORK", "initial value is rendered"); - - run(view, view.set, 'context.foo.bar', 'MWEEER'); - - equal(view.$().text(), "MWEEER", "value can be updated"); -}); - -QUnit.module("ember-htmlbars: {{bind}} with a container, block forms", { - setup: function() { - registry = new Registry(); - container = registry.container(); - registry.optionsForType('template', { instantiate: false }); - }, - teardown: function() { - runDestroy(container); - runDestroy(view); - registry = container = view = null; - } -}); - -test("should not update when a property is removed from the view", function() { - if (Ember.FEATURES.isEnabled('ember-htmlbars')) { - expectDeprecation(/block form of bind.*has been deprecated/); - } - var template = compile( - '<h1 id="first">{{#bind view.content}}{{#bind foo}}{{bind baz}}{{/bind}}{{/bind}}</h1>' ); - registry.register('template:foo', template); - - view = EmberView.create({ - container: container, - templateName: 'foo', - - content: EmberObject.create({ - foo: EmberObject.create({ - baz: "unicorns" - }) - }) - }); - - runAppend(view); - - equal(view.$('#first').text(), "unicorns", "precond - renders the bound value"); - - var oldContent = get(view, 'content'); - - run(function() { - set(view, 'content', EmberObject.create({ - foo: EmberObject.create({ - baz: "ninjas" - }) - })); - }); - - equal(view.$('#first').text(), 'ninjas', "updates to new content value"); - - run(function() { - set(oldContent, 'foo.baz', 'rockstars'); - }); - - run(function() { - set(oldContent, 'foo.baz', 'ewoks'); - }); - - equal(view.$('#first').text(), "ninjas", "does not update removed object"); -}); - -test("Handlebars templates update properties if a content object changes", function() { - if (Ember.FEATURES.isEnabled('ember-htmlbars')) { - expectDeprecation(/block form of bind.*has been deprecated/); - } - var template = compile( - '<h1>Today\'s Menu</h1>{{#bind view.coffee}}<h2>{{color}} coffee</h2><span id="price">{{bind price}}</span>{{/bind}}'); - registry.register('template:menu', template); - - run(function() { - view = EmberView.create({ - container: container, - templateName: 'menu', - - coffee: EmberObject.create({ - color: 'brown', - price: '$4' - }) - }); - }); - - runAppend(view); - - equal(view.$('h2').text(), "brown coffee", "precond - renders color correctly"); - equal(view.$('#price').text(), '$4', "precond - renders price correctly"); - - run(function() { - set(view, 'coffee', EmberObject.create({ - color: "mauve", - price: "$4.50" - })); - }); - - equal(view.$('h2').text(), "mauve coffee", "should update name field when content changes"); - equal(view.$('#price').text(), "$4.50", "should update price field when content changes"); - - run(function() { - set(view, 'coffee', EmberObject.create({ - color: "mauve", - price: "$5.50" - })); - }); - - equal(view.$('h2').text(), "mauve coffee", "should update name field when content changes"); - equal(view.$('#price').text(), "$5.50", "should update price field when content changes"); - - run(function() { - set(view, 'coffee.price', "$5"); - }); - - equal(view.$('#price').text(), "$5", "should update price field when price property is changed"); - - runDestroy(view); -}); - -test("Template updates correctly if a path is passed to the bind helper", function() { - var template = compile('<h1>{{bind view.coffee.price}}</h1>'); - registry.register('template:menu', template); - - view = EmberView.create({ - container: container, - templateName: 'menu', - - coffee: EmberObject.create({ - price: '$4' - }) - }); - - runAppend(view); - - equal(view.$('h1').text(), "$4", "precond - renders price"); - - run(function() { - set(view, 'coffee.price', "$5"); - }); - - equal(view.$('h1').text(), "$5", "updates when property changes"); - - run(function() { - set(view, 'coffee', { price: "$6" }); - }); - - equal(view.$('h1').text(), "$6", "updates when parent property changes"); -}); - -test("Template updates correctly if a path is passed to the bind helper and the context object is an ObjectController", function() { - var template = compile('<h1>{{bind view.coffee.price}}</h1>'); - registry.register('template:menu', template); - - var controller = ObjectController.create(); - - var realObject = EmberObject.create({ - price: "$4" - }); - - set(controller, 'model', realObject); - - view = EmberView.create({ - container: container, - templateName: 'menu', - - coffee: controller - }); - - runAppend(view); - - equal(view.$('h1').text(), "$4", "precond - renders price"); - - run(function() { - set(realObject, 'price', "$5"); - }); - - equal(view.$('h1').text(), "$5", "updates when property is set on real object"); - - run(function() { - set(controller, 'price', "$6" ); - }); - - equal(view.$('h1').text(), "$6", "updates when property is set on object controller"); -}); - -test('View should update when a property changes and the bind helper is used', function() { - registry.register('template:foo', compile('<h1 id="first">{{#with view.content as thing}}{{bind "thing.wham"}}{{/with}}</h1>')); - - view = EmberView.create({ - container: container, - templateName: 'foo', - - content: EmberObject.create({ - wham: 'bam', - thankYou: "ma'am" - }) - }); - - runAppend(view); - - equal(view.$('#first').text(), 'bam', 'precond - view renders Handlebars template'); - - run(function() { - set(get(view, 'content'), 'wham', 'bazam'); - }); - - equal(view.$('#first').text(), 'bazam', 'view updates when a bound property changes'); -});
true
Other
emberjs
ember.js
e34dd12f1921cba438c2f5d16cc249f1f832b612.json
Remove bind helper
packages/ember-views/lib/main.js
@@ -36,7 +36,6 @@ import TextSupport from "ember-views/mixins/text_support"; import TextField from "ember-views/views/text_field"; import TextArea from "ember-views/views/text_area"; -import BoundView from "ember-views/views/bound_view"; import SimpleBoundView from "ember-views/views/simple_bound_view"; import _MetamorphView from "ember-views/views/metamorph_view"; import { _Metamorph } from "ember-views/views/metamorph_view"; @@ -74,7 +73,6 @@ Ember.TextField = TextField; Ember.TextArea = TextArea; Ember._SimpleBoundView = SimpleBoundView; -Ember._BoundView = BoundView; Ember._MetamorphView = _MetamorphView; Ember._Metamorph = _Metamorph; Ember.Select = Select;
true
Other
emberjs
ember.js
e34dd12f1921cba438c2f5d16cc249f1f832b612.json
Remove bind helper
packages/ember-views/lib/views/bound_view.js
@@ -1,153 +0,0 @@ -/** -@module ember -@submodule ember-views -*/ - -import { get } from "ember-metal/property_get"; -import { set } from "ember-metal/property_set"; -import _MetamorphView from "ember-views/views/metamorph_view"; -import NormalizedRerenderIfNeededSupport from "ember-views/mixins/normalized_rerender_if_needed"; - -/** - `Ember._BoundView` is a private view created by the Handlebars - `{{bind}}` helpers that is used to keep track of bound properties. - - Every time a property is bound using a `{{mustache}}`, an anonymous subclass - of `Ember._BoundView` is created with the appropriate sub-template - and context set up. When the associated property changes, just the template - for this view will re-render. - - @class _BoundView - @namespace Ember - @extends Ember._MetamorphView - @private -*/ -export default _MetamorphView.extend(NormalizedRerenderIfNeededSupport, { - instrumentName: 'bound', - - /** - The function used to determine if the `displayTemplate` or - `inverseTemplate` should be rendered. This should be a function that takes - a value and returns a Boolean. - - @property shouldDisplayFunc - @type Function - @default null - */ - shouldDisplayFunc: null, - - /** - Whether the template rendered by this view gets passed the context object - of its parent template, or gets passed the value of retrieving `path` - from the `pathRoot`. - - For example, this is true when using the `{{#if}}` helper, because the - template inside the helper should look up properties relative to the same - object as outside the block. This would be `false` when used with `{{#with - foo}}` because the template should receive the object found by evaluating - `foo`. - - @property preserveContext - @type Boolean - @default false - */ - preserveContext: false, - - /** - If `preserveContext` is true, this is the object that will be used - to render the template. - - @property previousContext - @type Object - */ - previousContext: null, - - /** - The template to render when `shouldDisplayFunc` evaluates to `true`. - - @property displayTemplate - @type Function - @default null - */ - displayTemplate: null, - - /** - The template to render when `shouldDisplayFunc` evaluates to `false`. - - @property inverseTemplate - @type Function - @default null - */ - inverseTemplate: null, - - lazyValue: null, - - /** - Determines which template to invoke, sets up the correct state based on - that logic, then invokes the default `Ember.View` `render` implementation. - - This method will first look up the `path` key on `pathRoot`, - then pass that value to the `shouldDisplayFunc` function. If that returns - `true,` the `displayTemplate` function will be rendered to DOM. Otherwise, - `inverseTemplate`, if specified, will be rendered. - - For example, if this `Ember._BoundView` represented the `{{#with - foo}}` helper, it would look up the `foo` property of its context, and - `shouldDisplayFunc` would always return true. The object found by looking - up `foo` would be passed to `displayTemplate`. - - @method render - @param {Ember.RenderBuffer} buffer - */ - render: function(buffer) { - var shouldDisplay = get(this, 'shouldDisplayFunc'); - var preserveContext = get(this, 'preserveContext'); - var context = get(this, 'previousContext'); - - var inverseTemplate = get(this, 'inverseTemplate'); - var displayTemplate = get(this, 'displayTemplate'); - - var result = this.normalizedValue(); - - this._lastNormalizedValue = result; - - // First, test the conditional to see if we should - // render the template or not. - if (shouldDisplay(result)) { - set(this, 'template', displayTemplate); - - // If we are preserving the context (for example, if this - // is an #if block, call the template with the same object. - if (preserveContext) { - set(this, '_context', context); - } else { - // Otherwise, determine if this is a block bind or not. - // If so, pass the specified object to the template - if (displayTemplate) { - set(this, '_context', result); - } else { - // This is not a bind block, just push the result of the - // expression to the render context and return. - if (result === null || result === undefined) { - result = ""; - } - - buffer.push(result); - return; - } - } - } else if (inverseTemplate) { - set(this, 'template', inverseTemplate); - - if (preserveContext) { - set(this, '_context', context); - } else { - set(this, '_context', result); - } - } else { - set(this, 'template', function() { return ''; }); - } - - return this._super(buffer); - } -});
true
Other
emberjs
ember.js
310cec8dcf5ce3bc124817fbe10345882a11b759.json
Improve arguments check in Container#reset As per @stefanpenner’s concerns, checking `arguments.length` is more strict and can prevent a reset of the entire cache if `fullName` is mistakenly set to a falsey value. Also, adds docs for `reset`.
packages/container/lib/container.js
@@ -133,10 +133,13 @@ Container.prototype = { }, /** + Clear either the entire cache or just the cache for a particular key. + @method reset + @param {String} fullName optional key to reset; if missing, resets everything */ reset: function(fullName) { - if (fullName) { + if (arguments.length > 0) { resetMember(this, this._registry.normalize(fullName)); } else { resetCache(this);
false
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/container/lib/container.js
@@ -65,7 +65,7 @@ Container.prototype = { ```javascript var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('api:twitter', Twitter); @@ -84,7 +84,7 @@ Container.prototype = { ```javascript var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('api:twitter', Twitter);
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/container/lib/registry.js
@@ -1,5 +1,6 @@ import Ember from 'ember-metal/core'; // Ember.assert import dictionary from 'ember-metal/dictionary'; +import Container from 'container/container'; var VALID_FULL_NAME_REGEXP = /^[^:]+.+:[^:]+$/; @@ -103,6 +104,16 @@ Registry.prototype = { */ _typeOptions: null, + /** + Creates a container based on this registry. + + @method container + @param {Object} options + */ + container: function(options) { + return new Container(this, options); + }, + /** Registers a factory for later injection. @@ -270,7 +281,7 @@ Registry.prototype = { ```javascript var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); // if all of type `connection` must not be singletons registry.optionsForType('connection', { singleton: false }); @@ -349,7 +360,7 @@ Registry.prototype = { ```javascript var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('router:main', Router); registry.register('controller:user', UserController); @@ -402,7 +413,7 @@ Registry.prototype = { ```javascript var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('source:main', Source); registry.register('model:user', User); @@ -498,7 +509,7 @@ Registry.prototype = { ```javascript var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('store:main', Store); registry.register('store:secondary', OtherStore);
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/container/tests/container_test.js
@@ -2,7 +2,6 @@ import { factory } from 'container/tests/container_helper'; -import Container from 'container/container'; import Registry from 'container/registry'; var originalModelInjections; @@ -18,7 +17,7 @@ QUnit.module("Container", { test("A registered factory returns the same instance each time", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); registry.register('controller:post', PostController); @@ -32,7 +31,7 @@ test("A registered factory returns the same instance each time", function() { test("A registered factory is returned from lookupFactory", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); registry.register('controller:post', PostController); @@ -45,7 +44,7 @@ test("A registered factory is returned from lookupFactory", function() { test("A registered factory is returned from lookupFactory is the same factory each time", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); registry.register('controller:post', PostController); @@ -55,7 +54,7 @@ test("A registered factory is returned from lookupFactory is the same factory ea test("A factory returned from lookupFactory has a debugkey", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); registry.register('controller:post', PostController); @@ -67,7 +66,7 @@ test("A factory returned from lookupFactory has a debugkey", function() { test("fallback for to create time injections if factory has no extend", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var AppleController = factory(); var PostController = factory(); @@ -87,7 +86,7 @@ test("fallback for to create time injections if factory has no extend", function test("The descendants of a factory returned from lookupFactory have a container and debugkey", function(){ var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); var instance; @@ -102,7 +101,7 @@ test("The descendants of a factory returned from lookupFactory have a container test("A registered factory returns a fresh instance if singleton: false is passed as an option", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); registry.register('controller:post', PostController); @@ -125,7 +124,7 @@ test("A registered factory returns a fresh instance if singleton: false is passe test("A container lookup has access to the container", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); registry.register('controller:post', PostController); @@ -137,7 +136,7 @@ test("A container lookup has access to the container", function() { test("A factory type with a registered injection's instances receive that injection", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); var Store = factory(); @@ -154,7 +153,7 @@ test("A factory type with a registered injection's instances receive that inject test("An individual factory with a registered injection receives the injection", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); var Store = factory(); @@ -176,7 +175,7 @@ test("An individual factory with a registered injection receives the injection", test("A factory with both type and individual injections", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); var Store = factory(); var Router = factory(); @@ -198,7 +197,7 @@ test("A factory with both type and individual injections", function() { test("A factory with both type and individual factoryInjections", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); var Store = factory(); var Router = factory(); @@ -220,7 +219,7 @@ test("A factory with both type and individual factoryInjections", function() { test("A non-singleton instance is never cached", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostView = factory(); registry.register('view:post', PostView, { singleton: false }); @@ -233,7 +232,7 @@ test("A non-singleton instance is never cached", function() { test("A non-instantiated property is not instantiated", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var template = function() {}; registry.register('template:foo', template, { instantiate: false }); @@ -242,14 +241,14 @@ test("A non-instantiated property is not instantiated", function() { test("A failed lookup returns undefined", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); equal(container.lookup('doesnot:exist'), undefined); }); test("An invalid factory throws an error", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('controller:foo', {}); @@ -262,7 +261,7 @@ test("Injecting a failed lookup raises an error", function() { Ember.MODEL_FACTORY_INJECTIONS = true; var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var fooInstance = {}; var fooFactory = {}; @@ -282,7 +281,7 @@ test("Injecting a failed lookup raises an error", function() { test("Injecting a falsy value does not raise an error", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var ApplicationController = factory(); registry.register('controller:application', ApplicationController); @@ -294,7 +293,7 @@ test("Injecting a falsy value does not raise an error", function() { test("Destroying the container destroys any cached singletons", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); var PostView = factory(); var template = function() {}; @@ -318,7 +317,7 @@ test("Destroying the container destroys any cached singletons", function() { test("The container can use a registry hook to resolve factories lazily", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); registry.resolver = function(fullName) { @@ -334,7 +333,7 @@ test("The container can use a registry hook to resolve factories lazily", functi test("The container normalizes names before resolving", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); registry.normalizeFullName = function(fullName) { @@ -349,7 +348,7 @@ test("The container normalizes names before resolving", function() { test("The container normalizes names when looking factory up", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); registry.normalizeFullName = function(fullName) { @@ -364,7 +363,7 @@ test("The container normalizes names when looking factory up", function() { test("The container can get options that should be applied to a given factory", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostView = factory(); registry.resolver = function(fullName) { @@ -386,7 +385,7 @@ test("The container can get options that should be applied to a given factory", test("The container can get options that should be applied to all factories for a given type", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostView = factory(); registry.resolver = function(fullName) { @@ -408,7 +407,7 @@ test("The container can get options that should be applied to all factories for test("factory resolves are cached", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); var resolveWasCalled = []; registry.resolve = function(fullName) { @@ -426,7 +425,7 @@ test("factory resolves are cached", function() { test("factory for non extendables (MODEL) resolves are cached", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = factory(); var resolveWasCalled = []; registry.resolve = function(fullName) { @@ -444,7 +443,7 @@ test("factory for non extendables (MODEL) resolves are cached", function() { test("factory for non extendables resolves are cached", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var PostController = {}; var resolveWasCalled = []; @@ -466,7 +465,7 @@ if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { expect(2); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var Apple = factory(); Apple.reopenClass({ @@ -484,7 +483,7 @@ if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { test("A factory's lazy injections are validated when first instantiated", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var Apple = factory(); var Orange = factory(); @@ -506,7 +505,7 @@ if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { expect(1); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var Apple = factory(); var Orange = factory();
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-application/lib/system/application.js
@@ -4,7 +4,6 @@ */ import DAG from 'dag-map'; import Registry from 'container/registry'; -import Container from 'container/container'; import Ember from "ember-metal"; // Ember.FEATURES, Ember.deprecate, Ember.assert, Ember.libraries, LOG_VERSION, Namespace, BOOTED import { get } from "ember-metal/property_get"; @@ -320,7 +319,7 @@ var Application = Namespace.extend(DeferredMixin, { @return {Ember.Container} the configured container */ buildContainer: function() { - var container = this.__container__ = new Container(this.__registry__); + var container = this.__container__ = this.__registry__.container(); return container; },
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-application/tests/system/controller_test.js
@@ -3,7 +3,7 @@ import Controller from "ember-runtime/controllers/controller"; import "ember-application/ext/controller"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import { A } from "ember-runtime/system/native_array"; import ArrayController from "ember-runtime/controllers/array_controller"; import { computed } from "ember-metal/computed"; @@ -22,7 +22,7 @@ test("If a controller specifies a dependency, but does not have a container it s test("If a controller specifies a dependency, it is accessible", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('controller:post', Controller.extend({ needs: 'posts' @@ -38,7 +38,7 @@ test("If a controller specifies a dependency, it is accessible", function() { test("If a controller specifies an unavailable dependency, it raises", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('controller:post', Controller.extend({ needs: ['comments'] @@ -59,7 +59,7 @@ test("If a controller specifies an unavailable dependency, it raises", function( test("Mixin sets up controllers if there is needs before calling super", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('controller:other', ArrayController.extend({ needs: 'posts', @@ -81,7 +81,7 @@ test("Mixin sets up controllers if there is needs before calling super", functio test("raises if trying to get a controller that was not pre-defined in `needs`", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('controller:foo', Controller.extend()); registry.register('controller:bar', Controller.extend({ @@ -106,7 +106,7 @@ test("raises if trying to get a controller that was not pre-defined in `needs`", test ("setting the value of a controller dependency should not be possible", function(){ var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('controller:post', Controller.extend({ needs: 'posts' @@ -129,7 +129,7 @@ test ("setting the value of a controller dependency should not be possible", fun test("raises if a dependency with a period is requested", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('controller:big.bird', Controller.extend()); registry.register('controller:foo', Controller.extend({
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/compat/handlebars_get_test.js
@@ -2,7 +2,7 @@ import Ember from "ember-metal/core"; // Ember.lookup import _MetamorphView from "ember-views/views/metamorph_view"; import EmberView from "ember-views/views/view"; import handlebarsGet from "ember-htmlbars/compat/handlebars-get"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import { runAppend, runDestroy } from "ember-runtime/tests/utils"; import EmberHandlebars from "ember-htmlbars/compat"; @@ -16,7 +16,7 @@ QUnit.module("ember-htmlbars: Ember.Handlebars.get", { setup: function() { Ember.lookup = lookup = {}; registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); registry.optionsForType('helper', { instantiate: false }); registry.register('view:default', _MetamorphView);
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/compat/make-view-helper_test.js
@@ -1,6 +1,5 @@ import EmberView from "ember-views/views/view"; import Registry from "container/registry"; -import Container from "container/container"; import compile from "ember-htmlbars/system/compile"; import makeViewHelper from "ember-htmlbars/system/make-view-helper"; import Component from "ember-views/views/component"; @@ -11,7 +10,7 @@ var registry, container, view; QUnit.module('ember-htmlbars: makeViewHelper compat', { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('helper', { instantiate: false }); },
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/helpers/bind_attr_test.js
@@ -8,7 +8,7 @@ import EmberObject from "ember-runtime/system/object"; import { A } from "ember-runtime/system/native_array"; import { computed } from "ember-metal/computed"; import { observersFor } from "ember-metal/observer"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import { set } from "ember-metal/property_set"; import { runAppend, runDestroy } from "ember-runtime/tests/utils"; import { equalInnerHTML } from "htmlbars-test-helpers"; @@ -33,7 +33,7 @@ QUnit.module("ember-htmlbars: {{bind-attr}}", { Ember.lookup = lookup = {}; lookup.TemplateTests = TemplateTests = Namespace.create(); registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); registry.register('view:default', _MetamorphView); registry.register('view:toplevel', EmberView.extend());
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/helpers/bind_test.js
@@ -3,7 +3,7 @@ import EmberObject from "ember-runtime/system/object"; import run from "ember-metal/run_loop"; import _MetamorphView from 'ember-views/views/metamorph_view'; import compile from "ember-htmlbars/system/compile"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import ObjectController from "ember-runtime/controllers/object_controller"; import { get } from "ember-metal/property_get"; @@ -15,7 +15,7 @@ var view, registry, container; QUnit.module("ember-htmlbars: {{bind}} helper", { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); registry.register('view:default', _MetamorphView); registry.register('view:toplevel', EmberView.extend()); @@ -85,7 +85,7 @@ test("it should render the current value of a string path on the context", funct QUnit.module("ember-htmlbars: {{bind}} with a container, block forms", { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); }, teardown: function() {
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/helpers/collection_test.js
@@ -4,7 +4,7 @@ import EmberObject from "ember-runtime/system/object"; import EmberView from "ember-views/views/view"; import ArrayProxy from "ember-runtime/system/array_proxy"; import Namespace from "ember-runtime/system/namespace"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import { A } from "ember-runtime/system/native_array"; import run from "ember-metal/run_loop"; import { get } from "ember-metal/property_get"; @@ -38,7 +38,7 @@ QUnit.module("collection helper", { Ember.lookup = lookup = {}; lookup.TemplateTests = TemplateTests = Namespace.create(); registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); // registry.register('view:default', _MetamorphView); @@ -156,7 +156,7 @@ test("passing a block to the collection helper sets it as the template for examp test("collection helper should try to use container to resolve view", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var ACollectionView = CollectionView.extend({ tagName: 'ul', @@ -542,7 +542,7 @@ test("tagName works in the #collection helper", function() { test("should render nested collections", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('view:inner-list', CollectionView.extend({ tagName: 'ul', content: A(['one','two','three']) @@ -660,7 +660,7 @@ test("context should be content", function() { var view; registry = new Registry(); - container = new Container(registry); + container = registry.container(); var items = A([ EmberObject.create({name: 'Dave'}),
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/helpers/each_test.js
@@ -9,7 +9,7 @@ import ArrayController from "ember-runtime/controllers/array_controller"; import { A } from "ember-runtime/system/native_array"; import { default as EmberController } from "ember-runtime/controllers/controller"; import ObjectController from "ember-runtime/controllers/object_controller"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import { get } from "ember-metal/property_get"; import { set } from "ember-metal/property_set"; @@ -83,7 +83,7 @@ QUnit.module("the #each helper [DEPRECATED]", { people = A([{ name: "Steve Holt" }, { name: "Annabelle" }]); registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.register('view:default', _MetamorphView); registry.register('view:toplevel', EmberView.extend()); @@ -697,7 +697,7 @@ function testEachWithItem(moduleName, useBlockParams) { QUnit.module(moduleName, { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.register('view:default', _MetamorphView); registry.register('view:toplevel', EmberView.extend()); @@ -819,7 +819,7 @@ function testEachWithItem(moduleName, useBlockParams) { }); registry = new Registry(); - container = new Container(registry); + container = registry.container(); people = A([{ name: "Steve Holt" }, { name: "Annabelle" }]); @@ -873,7 +873,7 @@ function testEachWithItem(moduleName, useBlockParams) { controllerName: 'controller:people' }); registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.register('controller:people', PeopleController); registry.register('controller:person', PersonController);
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/helpers/if_unless_test.js
@@ -1,6 +1,6 @@ import run from "ember-metal/run_loop"; import Namespace from 'ember-runtime/system/namespace'; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import EmberView from "ember-views/views/view"; import ObjectProxy from "ember-runtime/system/object_proxy"; import EmberObject from "ember-runtime/system/object"; @@ -22,7 +22,7 @@ QUnit.module("ember-htmlbars: {{#if}} and {{#unless}} helpers", { Ember.lookup = lookup = {}; lookup.TemplateTests = TemplateTests = Namespace.create(); registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); registry.register('view:default', _MetamorphView); registry.register('view:toplevel', EmberView.extend());
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/helpers/partial_test.js
@@ -3,7 +3,7 @@ import run from "ember-metal/run_loop"; import EmberView from "ember-views/views/view"; import jQuery from "ember-views/system/jquery"; var trim = jQuery.trim; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import compile from "ember-htmlbars/system/compile"; import { runAppend, runDestroy } from "ember-runtime/tests/utils"; @@ -15,7 +15,7 @@ QUnit.module("Support for {{partial}} helper", { Ember.lookup = lookup = { Ember: Ember }; MyApp = lookup.MyApp = EmberObject.create({}); registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); }, teardown: function() {
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/helpers/template_test.js
@@ -3,7 +3,7 @@ import EmberObject from "ember-runtime/system/object"; import jQuery from "ember-views/system/jquery"; var trim = jQuery.trim; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import compile from "ember-htmlbars/system/compile"; import { runAppend, runDestroy } from "ember-runtime/tests/utils"; @@ -15,7 +15,7 @@ QUnit.module("Support for {{template}} helper", { Ember.lookup = lookup = { Ember: Ember }; MyApp = lookup.MyApp = EmberObject.create({}); registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); }, teardown: function() {
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/helpers/unbound_test.js
@@ -13,7 +13,7 @@ import helpers from "ember-htmlbars/helpers"; import registerBoundHelper from "ember-htmlbars/compat/register-bound-helper"; import makeBoundHelper from "ember-htmlbars/compat/make-bound-helper"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import { runAppend, runDestroy } from "ember-runtime/tests/utils"; function expectDeprecationInHTMLBars() { @@ -286,7 +286,7 @@ QUnit.module("ember-htmlbars: {{#unbound}} helper -- Container Lookup", { setup: function() { Ember.lookup = lookup = { Ember: Ember }; registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('helper', { instantiate: false }); },
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/helpers/view_test.js
@@ -2,7 +2,6 @@ import { set } from "ember-metal/property_set"; import EmberView from "ember-views/views/view"; import Registry from "container/registry"; -import Container from "container/container"; import run from "ember-metal/run_loop"; import jQuery from "ember-views/system/jquery"; import TextField from 'ember-views/views/text_field'; @@ -47,7 +46,7 @@ QUnit.module("ember-htmlbars: {{#view}} helper", { Ember.lookup = lookup = {}; registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); registry.register('view:default', _MetamorphView); registry.register('view:toplevel', EmberView.extend()); @@ -363,7 +362,7 @@ test("allows you to pass attributes that will be assigned to the class instance, expect(4); registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.register('view:toplevel', EmberView.extend()); view = EmberView.extend({
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/helpers/with_test.js
@@ -6,7 +6,7 @@ import { computed } from "ember-metal/computed"; import { set } from "ember-metal/property_set"; import { get } from "ember-metal/property_get"; import ObjectController from "ember-runtime/controllers/object_controller"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import compile from "ember-htmlbars/system/compile"; import { runAppend, runDestroy } from "ember-runtime/tests/utils"; @@ -220,7 +220,7 @@ test("it should wrap context with object controller [DEPRECATED]", function() { var person = EmberObject.create({name: 'Steve Holt'}); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var parentController = EmberObject.create({ container: container, @@ -277,7 +277,7 @@ test("it should still have access to original parentController within an {{#each var people = A([{ name: "Steve Holt" }, { name: "Carl Weathers" }]); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var parentController = EmberObject.create({ container: container, @@ -310,7 +310,7 @@ test("it should wrap keyword with object controller", function() { var person = EmberObject.create({name: 'Steve Holt'}); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var parentController = EmberObject.create({ container: container, @@ -364,7 +364,7 @@ test("destroys the controller generated with {{with foo controller='blah'}} [DEP var person = EmberObject.create({name: 'Steve Holt'}); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var parentController = EmberObject.create({ container: container, @@ -400,7 +400,7 @@ test("destroys the controller generated with {{with foo as bar controller='blah' var person = EmberObject.create({name: 'Steve Holt'}); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var parentController = EmberObject.create({ container: container,
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/helpers/yield_test.js
@@ -2,7 +2,7 @@ import run from "ember-metal/run_loop"; import EmberView from "ember-views/views/view"; import { computed } from "ember-metal/computed"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import { get } from "ember-metal/property_get"; import { set } from "ember-metal/property_set"; import { A } from "ember-runtime/system/native_array"; @@ -21,7 +21,7 @@ var view, registry, container; QUnit.module("ember-htmlbars: Support for {{yield}} helper", { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); }, teardown: function() {
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/hooks/component_test.js
@@ -1,6 +1,5 @@ import ComponentLookup from "ember-views/component_lookup"; import Registry from "container/registry"; -import Container from "container/container"; import EmberView from "ember-views/views/view"; import compile from "ember-htmlbars/system/compile"; import { runAppend, runDestroy } from "ember-runtime/tests/utils"; @@ -19,7 +18,7 @@ if (Ember.FEATURES.isEnabled('ember-htmlbars')) { QUnit.module("ember-htmlbars: component hook", { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); registry.register('component-lookup:main', ComponentLookup);
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/integration/block_params_test.js
@@ -1,5 +1,4 @@ import Registry from "container/registry"; -import Container from "container/container"; import run from "ember-metal/run_loop"; import ComponentLookup from 'ember-views/component_lookup'; import View from "ember-views/views/view"; @@ -26,7 +25,7 @@ QUnit.module("ember-htmlbars: block params", { registerHelper('alias', aliasHelper); registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('component', { singleton: false }); registry.optionsForType('view', { singleton: false }); registry.optionsForType('template', { instantiate: false });
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/integration/component_invocation_test.js
@@ -1,6 +1,5 @@ import EmberView from "ember-views/views/view"; import Registry from "container/registry"; -import Container from "container/container"; import jQuery from "ember-views/system/jquery"; import compile from "ember-htmlbars/system/compile"; import ComponentLookup from 'ember-views/component_lookup'; @@ -11,7 +10,7 @@ var registry, container, view; QUnit.module('component - invocation', { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('component', { singleton: false }); registry.optionsForType('view', { singleton: false }); registry.optionsForType('template', { instantiate: false });
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/integration/with_view_test.js
@@ -1,7 +1,7 @@ import run from 'ember-metal/run_loop'; import jQuery from 'ember-views/system/jquery'; import EmberView from 'ember-views/views/view'; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import EmberObject from 'ember-runtime/system/object'; import _MetamorphView from 'ember-views/views/metamorph_view'; import compile from 'ember-htmlbars/system/compile'; @@ -15,7 +15,7 @@ var trim = jQuery.trim; QUnit.module('ember-htmlbars: {{#with}} and {{#view}} integration', { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); registry.register('view:default', _MetamorphView); registry.register('view:toplevel', EmberView.extend());
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/system/lookup-helper_test.js
@@ -1,7 +1,6 @@ import lookupHelper from "ember-htmlbars/system/lookup-helper"; import ComponentLookup from "ember-views/component_lookup"; import Registry from "container/registry"; -import Container from "container/container"; import Component from "ember-views/views/component"; function generateEnv(helpers) { @@ -12,7 +11,7 @@ function generateEnv(helpers) { function generateContainer() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.optionsForType('helper', { instantiate: false }); registry.register('component-lookup:main', ComponentLookup);
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-htmlbars/tests/system/make_bound_helper_test.js
@@ -1,7 +1,6 @@ import EmberView from "ember-views/views/view"; import run from "ember-metal/run_loop"; import Registry from "container/registry"; -import Container from "container/container"; import makeBoundHelper from "ember-htmlbars/system/make_bound_helper"; import compile from "ember-htmlbars/system/compile"; import { runAppend, runDestroy } from "ember-runtime/tests/utils"; @@ -25,7 +24,7 @@ if (Ember.FEATURES.isEnabled('ember-htmlbars')) { QUnit.module("ember-htmlbars: makeBoundHelper", { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('helper', { instantiate: false }); },
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-routing-htmlbars/tests/helpers/action_test.js
@@ -4,7 +4,7 @@ import run from "ember-metal/run_loop"; import EventDispatcher from "ember-views/system/event_dispatcher"; import ActionManager from "ember-views/system/action_manager"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import EmberObject from "ember-runtime/system/object"; import { default as EmberController } from "ember-runtime/controllers/controller"; import EmberObjectController from "ember-runtime/controllers/object_controller"; @@ -187,7 +187,7 @@ test("should target the with-controller inside an {{#with controller='person'}} var PersonController = EmberObjectController.extend(); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var parentController = EmberObject.create({ container: container }); @@ -222,7 +222,7 @@ test("should target the with-controller inside an {{each}} in a {{#with controll }); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var parentController = EmberObject.create({ container: container, people: Ember.A([
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-routing-htmlbars/tests/helpers/outlet_test.js
@@ -4,7 +4,6 @@ import { set } from "ember-metal/property_set"; import run from "ember-metal/run_loop"; import Registry from "container/registry"; -import Container from "container/container"; import Namespace from "ember-runtime/system/namespace"; import { decamelize, @@ -51,7 +50,7 @@ var buildRegistry = function(namespace) { }; var buildContainer = function(registry) { - return new Container(registry); + return registry.container(); }; function resolverFor(namespace) {
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-routing-htmlbars/tests/helpers/render_test.js
@@ -6,7 +6,6 @@ import { canDefineNonEnumerableProperties } from 'ember-metal/platform'; import { observer } from 'ember-metal/mixin'; import Registry from 'container/registry'; -import Container from 'container/container'; import Namespace from "ember-runtime/system/namespace"; import { classify, @@ -43,7 +42,7 @@ function set(object, key, value) { function buildContainer(namespace) { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.set = emberSet; registry.resolver = resolverFor(namespace);
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-routing/tests/system/controller_for_test.js
@@ -4,7 +4,6 @@ import { set } from "ember-metal/property_set"; import run from "ember-metal/run_loop"; import Registry from 'container/registry'; -import Container from 'container/container'; import Namespace from "ember-runtime/system/namespace"; import { classify } from "ember-runtime/system/string"; import Controller from "ember-runtime/controllers/controller"; @@ -18,7 +17,7 @@ import { var buildContainer = function(namespace) { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.set = set; registry.resolver = resolverFor(namespace);
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-routing/tests/system/route_test.js
@@ -1,6 +1,5 @@ import run from "ember-metal/run_loop"; import Registry from "container/registry"; -import Container from "container/container"; import Service from "ember-runtime/system/service"; import EmberObject from "ember-runtime/system/object"; import EmberRoute from "ember-routing/system/route"; @@ -59,7 +58,7 @@ test("'store' can be injected by data persistence frameworks", function() { run(route, 'destroy'); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var post = { id: 1 }; @@ -89,7 +88,7 @@ test("assert if 'store.find' method is not found", function() { run(route, 'destroy'); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var Post = EmberObject.extend(); registry.register('route:index', EmberRoute); @@ -107,7 +106,7 @@ test("asserts if model class is not found", function() { run(route, 'destroy'); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('route:index', EmberRoute); route = container.lookup('route:index'); @@ -123,7 +122,7 @@ test("'store' does not need to be injected", function() { run(route, 'destroy'); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('route:index', EmberRoute); @@ -138,7 +137,7 @@ test("'store' does not need to be injected", function() { test("modelFor doesn't require the router", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); route.container = container; var foo = { name: 'foo' }; @@ -238,7 +237,7 @@ if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { test("services can be injected into routes", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('route:application', EmberRoute.extend({ authService: inject.service('auth')
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-routing/tests/system/router_test.js
@@ -3,7 +3,6 @@ import copy from "ember-runtime/copy"; import merge from "ember-metal/merge"; import { map } from "ember-metal/enumerable_utils"; import Registry from "container/registry"; -import Container from "container/container"; import HashLocation from "ember-routing/location/hash_location"; import AutoLocation from "ember-routing/location/auto_location"; import EmberRouter from "ember-routing/system/router"; @@ -19,7 +18,7 @@ function createRouter(overrides) { QUnit.module("Ember Router", { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); //register the HashLocation (the default) registry.register('location:hash', HashLocation);
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-runtime/tests/controllers/controller_test.js
@@ -5,7 +5,7 @@ import Service from "ember-runtime/system/service"; import ObjectController from "ember-runtime/controllers/object_controller"; import Mixin from "ember-metal/mixin"; import Object from "ember-runtime/system/object"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import inject from "ember-runtime/inject"; import { get } from "ember-metal/property_get"; @@ -187,7 +187,7 @@ if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { test("defining a controller on a non-controller should fail assertion", function(){ expectAssertion(function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var AnObject = Object.extend({ container: container, @@ -204,7 +204,7 @@ if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { test("controllers can be injected into controllers", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('controller:post', Controller.extend({ postsController: inject.controller('posts') @@ -220,7 +220,7 @@ if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { test("services can be injected into controllers", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('controller:application', Controller.extend({ authService: inject.service('auth')
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-runtime/tests/controllers/item_controller_class_test.js
@@ -9,15 +9,14 @@ import ArrayController from "ember-runtime/controllers/array_controller"; import ObjectController from "ember-runtime/controllers/object_controller"; import {sort} from "ember-runtime/computed/reduce_computed_macros"; import Registry from "container/registry"; -import Container from "container/container"; var lannisters, arrayController, controllerClass, otherControllerClass, registry, container, itemControllerCount, tywin, jaime, cersei, tyrion; QUnit.module("Ember.ArrayController - itemController", { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); tywin = EmberObject.create({ name: 'Tywin' }); jaime = EmberObject.create({ name: 'Jaime' }); @@ -337,7 +336,7 @@ test("`itemController`'s life cycle should be entangled with its parent controll QUnit.module('Ember.ArrayController - itemController with arrayComputed', { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); cersei = EmberObject.create({ name: 'Cersei' }); jaime = EmberObject.create({ name: 'Jaime' });
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-runtime/tests/inject_test.js
@@ -5,7 +5,7 @@ import { createInjectionHelper, default as inject } from "ember-runtime/inject"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import Object from "ember-runtime/system/object"; if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { @@ -28,7 +28,7 @@ if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { }); var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var AnObject = Object.extend({ container: container, @@ -43,7 +43,7 @@ if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { test("attempting to inject a nonexistent container key should error", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); var AnObject = Object.extend({ container: container, foo: new InjectedProperty('bar', 'baz')
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-views/tests/views/component_test.js
@@ -2,7 +2,7 @@ import { set } from "ember-metal/property_set"; import run from "ember-metal/run_loop"; import EmberObject from "ember-runtime/system/object"; import Service from "ember-runtime/system/service"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import inject from "ember-runtime/inject"; import { get } from "ember-metal/property_get"; @@ -195,7 +195,7 @@ if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { test("services can be injected into components", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('component:application', Component.extend({ profilerService: inject.service('profiler')
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-views/tests/views/view/inject_test.js
@@ -1,5 +1,5 @@ import Service from "ember-runtime/system/service"; -import { Registry, Container } from "ember-runtime/system/container"; +import { Registry } from "ember-runtime/system/container"; import inject from "ember-runtime/inject"; import View from "ember-views/views/view"; @@ -8,7 +8,7 @@ if (Ember.FEATURES.isEnabled('ember-metal-injected-properties')) { test("services can be injected into views", function() { var registry = new Registry(); - var container = new Container(registry); + var container = registry.container(); registry.register('view:application', View.extend({ profilerService: inject.service('profiler')
true
Other
emberjs
ember.js
2bde50dc4252dffeba0ff34eef1ae0368cbf18b3.json
Introduce Registry#container method This is the preferred method for constructing a Container based on its associated Registry.
packages/ember-views/tests/views/view/layout_test.js
@@ -1,5 +1,4 @@ import Registry from "container/registry"; -import Container from "container/container"; import { get } from "ember-metal/property_get"; import run from "ember-metal/run_loop"; import EmberView from "ember-views/views/view"; @@ -9,7 +8,7 @@ var registry, container, view; QUnit.module("EmberView - Layout Functionality", { setup: function() { registry = new Registry(); - container = new Container(registry); + container = registry.container(); registry.optionsForType('template', { instantiate: false }); },
true