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 | 047b869f46ab17b2184c550e3b262e019a3da749.json | Remove unused local variable
`value` is assigned but not referenced anywhere. | packages/ember-metal/lib/map.js | @@ -247,12 +247,10 @@ Map.prototype = {
// to use in browsers that are not ES6 friendly;
var keys = this.keys,
values = this.values,
- guid = guidFor(key),
- value;
+ guid = guidFor(key);
if (values.hasOwnProperty(guid)) {
keys.remove(key);
- value = values[guid];
delete values[guid];
return true;
} else { | false |
Other | emberjs | ember.js | 6c6b6445aa38c58ba7a10133e2d30a3b4dd65ed3.json | Allow option view for Ember.Select overwritable | packages/ember-handlebars/lib/controls/select.js | @@ -13,6 +13,55 @@ var set = Ember.set,
isArray = Ember.isArray,
precompileTemplate = Ember.Handlebars.compile;
+Ember.SelectOption = Ember.View.extend({
+ tagName: 'option',
+ attributeBindings: ['value', 'selected'],
+
+ defaultTemplate: function(context, options) {
+ options = { data: options.data, hash: {} };
+ Ember.Handlebars.helpers.bind.call(context, "view.label", options);
+ },
+
+ init: function() {
+ this.labelPathDidChange();
+ this.valuePathDidChange();
+
+ this._super();
+ },
+
+ selected: Ember.computed(function() {
+ var content = get(this, 'content'),
+ selection = get(this, 'parentView.selection');
+ if (get(this, 'parentView.multiple')) {
+ return selection && indexOf(selection, content.valueOf()) > -1;
+ } else {
+ // Primitives get passed through bindings as objects... since
+ // `new Number(4) !== 4`, we use `==` below
+ return content == selection;
+ }
+ }).property('content', 'parentView.selection'),
+
+ labelPathDidChange: Ember.observer(function() {
+ var labelPath = get(this, 'parentView.optionLabelPath');
+
+ if (!labelPath) { return; }
+
+ Ember.defineProperty(this, 'label', Ember.computed(function() {
+ return get(this, labelPath);
+ }).property(labelPath));
+ }, 'parentView.optionLabelPath'),
+
+ valuePathDidChange: Ember.observer(function() {
+ var valuePath = get(this, 'parentView.optionValuePath');
+
+ if (!valuePath) { return; }
+
+ Ember.defineProperty(this, 'value', Ember.computed(function() {
+ return get(this, valuePath);
+ }).property(valuePath));
+ }, 'parentView.optionValuePath')
+});
+
/**
The `Ember.Select` view class renders a
[select](https://developer.mozilla.org/en/HTML/Element/select) HTML element,
@@ -265,7 +314,7 @@ Ember.Select = Ember.View.extend(
tagName: 'select',
classNames: ['ember-select'],
- defaultTemplate: precompileTemplate('{{#if view.prompt}}<option value="">{{view.prompt}}</option>{{/if}}{{#each view.content}}{{view Ember.SelectOption contentBinding="this"}}{{/each}}'),
+ defaultTemplate: precompileTemplate('{{#if view.prompt}}<option value="">{{view.prompt}}</option>{{/if}}{{#each view.content}}{{view view.optionView contentBinding="this"}}{{/each}}'),
attributeBindings: ['multiple', 'disabled', 'tabindex', 'name'],
/**
@@ -361,6 +410,15 @@ Ember.Select = Ember.View.extend(
*/
optionValuePath: 'content',
+ /**
+ The view class for option.
+
+ @property optionView
+ @type Ember.View
+ @default Ember.SelectOption
+ */
+ optionView: Ember.SelectOption,
+
_change: function() {
if (get(this, 'multiple')) {
this._changeMultiple();
@@ -480,52 +538,3 @@ Ember.Select = Ember.View.extend(
this.on("change", this, this._change);
}
});
-
-Ember.SelectOption = Ember.View.extend({
- tagName: 'option',
- attributeBindings: ['value', 'selected'],
-
- defaultTemplate: function(context, options) {
- options = { data: options.data, hash: {} };
- Ember.Handlebars.helpers.bind.call(context, "view.label", options);
- },
-
- init: function() {
- this.labelPathDidChange();
- this.valuePathDidChange();
-
- this._super();
- },
-
- selected: Ember.computed(function() {
- var content = get(this, 'content'),
- selection = get(this, 'parentView.selection');
- if (get(this, 'parentView.multiple')) {
- return selection && indexOf(selection, content.valueOf()) > -1;
- } else {
- // Primitives get passed through bindings as objects... since
- // `new Number(4) !== 4`, we use `==` below
- return content == selection;
- }
- }).property('content', 'parentView.selection'),
-
- labelPathDidChange: Ember.observer(function() {
- var labelPath = get(this, 'parentView.optionLabelPath');
-
- if (!labelPath) { return; }
-
- Ember.defineProperty(this, 'label', Ember.computed(function() {
- return get(this, labelPath);
- }).property(labelPath));
- }, 'parentView.optionLabelPath'),
-
- valuePathDidChange: Ember.observer(function() {
- var valuePath = get(this, 'parentView.optionValuePath');
-
- if (!valuePath) { return; }
-
- Ember.defineProperty(this, 'value', Ember.computed(function() {
- return get(this, valuePath);
- }).property(valuePath));
- }, 'parentView.optionValuePath')
-}); | false |
Other | emberjs | ember.js | f31afaea169d6645ff9c7786cdecf30b788dd5a1.json | Add routeNames to rendering assertion warning msg
The current message tells you that there may be an issue but doesn't clearly tell you in which routes the issue occurred. This adds the route & parent route ``routeName`` into the warning message | packages/ember-routing/lib/system/route.js | @@ -471,7 +471,7 @@ function parentTemplate(route, isRecursive) {
if (!parent) { return; }
- Ember.warn("The immediate parent route did not render into the main outlet and the default 'into' option may not be expected", !isRecursive);
+ Ember.warn("The immediate parent route ('%@') did not render into the main outlet and the default 'into' option ('%@') may not be expected".fmt(get(parent, 'routeName'), get(route, 'routeName')), !isRecursive);
if (template = parent.lastRenderedTemplate) {
return template; | false |
Other | emberjs | ember.js | 4e55ea5acce9798d9fc7d4f54bb6c1746be4e693.json | remove uneeded closures | packages/ember-handlebars/lib/helpers/binding.js | @@ -13,6 +13,10 @@ var forEach = Ember.ArrayPolyfills.forEach;
var EmberHandlebars = Ember.Handlebars, helpers = EmberHandlebars.helpers;
+function exists(value){
+ return !Ember.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, options, preserveContext, shouldDisplay, valueNormalizer, childProperties) {
@@ -191,9 +195,7 @@ EmberHandlebars.registerHelper('bind', function(property, options) {
return simpleBind.call(context, property, options);
}
- return bind.call(context, property, options, false, function(result) {
- return !Ember.isNone(result);
- });
+ return bind.call(context, property, options, false, exists);
});
/**
@@ -265,9 +267,7 @@ EmberHandlebars.registerHelper('with', function(context, options) {
Ember.bind(options.data.keywords, keywordName, contextPath);
}
- return bind.call(this, path, options, true, function(result) {
- return !Ember.isNone(result);
- });
+ return bind.call(this, path, options, true, exists);
} else {
Ember.assert("You must pass exactly one argument to the with helper", arguments.length === 2);
Ember.assert("You must pass a block to the with helper", options.fn && options.fn !== Handlebars.VM.noop); | false |
Other | emberjs | ember.js | 79fbf54d903d266abcb771ac63971ccb68479158.json | Remove unused valiables | packages/ember-application/lib/system/application.js | @@ -3,10 +3,7 @@
@submodule ember-application
*/
-var get = Ember.get, set = Ember.set,
- classify = Ember.String.classify,
- capitalize = Ember.String.capitalize,
- decamelize = Ember.String.decamelize;
+var get = Ember.get, set = Ember.set;
/**
An instance of `Ember.Application` is the starting point for every Ember | false |
Other | emberjs | ember.js | 4cffb68da64abf56bbf34f6e3d5144a13b321287.json | Fix typo in {{partial}} docs. | packages/ember-handlebars/lib/helpers/partial.js | @@ -15,6 +15,7 @@ require('ember-handlebars/ext');
{{partial user_info}}
{{/with}}
</script>
+ ```
The `data-template-name` attribute of a partial template
is prefixed with an underscore. | false |
Other | emberjs | ember.js | 93ccb694a2668fbcc0e82e5cc398cc7975612763.json | Move Ember.typeOf to metal
*sigh* it's been a long day... | packages/ember-metal/lib/utils.js | @@ -1,5 +1,6 @@
require('ember-metal/core');
require('ember-metal/platform');
+require('ember-metal/array');
/**
@module ember-metal
@@ -527,3 +528,76 @@ if (needsFinallyFix) {
return (finalResult === undefined) ? result : finalResult;
};
}
+
+// ........................................
+// TYPING & ARRAY MESSAGING
+//
+
+var TYPE_MAP = {};
+var t = "Boolean Number String Function Array Date RegExp Object".split(" ");
+Ember.ArrayPolyfills.forEach.call(t, function(name) {
+ TYPE_MAP[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+var toString = Object.prototype.toString;
+
+/**
+ Returns a consistent type for the passed item.
+
+ Use this instead of the built-in `typeof` to get the type of an item.
+ It will return the same result across all browsers and includes a bit
+ more detail. Here is what will be returned:
+
+ | Return Value | Meaning |
+ |---------------|------------------------------------------------------|
+ | 'string' | String primitive |
+ | 'number' | Number primitive |
+ | 'boolean' | Boolean primitive |
+ | 'null' | Null value |
+ | 'undefined' | Undefined value |
+ | 'function' | A function |
+ | 'array' | An instance of Array |
+ | 'class' | An Ember class (created using Ember.Object.extend()) |
+ | 'instance' | An Ember object instance |
+ | 'error' | An instance of the Error object |
+ | 'object' | A JavaScript object not inheriting from Ember.Object |
+
+ Examples:
+
+ ```javascript
+ Ember.typeOf(); // 'undefined'
+ Ember.typeOf(null); // 'null'
+ Ember.typeOf(undefined); // 'undefined'
+ Ember.typeOf('michael'); // 'string'
+ Ember.typeOf(101); // 'number'
+ Ember.typeOf(true); // 'boolean'
+ Ember.typeOf(Ember.makeArray); // 'function'
+ Ember.typeOf([1,2,90]); // 'array'
+ Ember.typeOf(Ember.Object.extend()); // 'class'
+ Ember.typeOf(Ember.Object.create()); // 'instance'
+ Ember.typeOf(new Error('teamocil')); // 'error'
+
+ // "normal" JavaScript object
+ Ember.typeOf({a: 'b'}); // 'object'
+ ```
+
+ @method typeOf
+ @for Ember
+ @param {Object} item the item to check
+ @return {String} the type
+*/
+Ember.typeOf = function(item) {
+ var ret;
+
+ ret = (item === null || item === undefined) ? String(item) : TYPE_MAP[toString.call(item)] || 'object';
+
+ if (ret === 'function') {
+ if (Ember.Object && Ember.Object.detect(item)) ret = 'class';
+ } else if (ret === 'object') {
+ if (item instanceof Error) ret = 'error';
+ else if (Ember.Object && item instanceof Ember.Object) ret = 'instance';
+ else ret = 'object';
+ }
+
+ return ret;
+};
\ No newline at end of file | true |
Other | emberjs | ember.js | 93ccb694a2668fbcc0e82e5cc398cc7975612763.json | Move Ember.typeOf to metal
*sigh* it's been a long day... | packages/ember-metal/lib/watch_key.js | @@ -2,7 +2,7 @@ require('ember-metal/utils');
require('ember-metal/platform');
var metaFor = Ember.meta, // utils.js
- typeOf = Ember.typeOf, // FIXME: defined in runtime
+ typeOf = Ember.typeOf, // utils.js
MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER,
o_defineProperty = Ember.platform.defineProperty;
| true |
Other | emberjs | ember.js | 93ccb694a2668fbcc0e82e5cc398cc7975612763.json | Move Ember.typeOf to metal
*sigh* it's been a long day... | packages/ember-metal/lib/watch_path.js | @@ -1,8 +1,8 @@
require('ember-metal/utils');
require('ember-metal/chains');
-var metaFor = Ember.meta,
- typeOf = Ember.typeOf, // FIXME: defined in runtime
+var metaFor = Ember.meta, // utils.js
+ typeOf = Ember.typeOf, // utils.js
ChainNode = Ember._ChainNode; // chains.js
// get the chains for the current object. If the current object has | true |
Other | emberjs | ember.js | 93ccb694a2668fbcc0e82e5cc398cc7975612763.json | Move Ember.typeOf to metal
*sigh* it's been a long day... | packages/ember-metal/lib/watching.js | @@ -18,7 +18,7 @@ var metaFor = Ember.meta, // utils.js
unwatchKey = Ember.unwatchKey,
watchPath = Ember.watchPath, // watch_path.js
unwatchPath = Ember.unwatchPath,
- typeOf = Ember.typeOf, // FIXME: defined in runtime
+ typeOf = Ember.typeOf, // utils.js
generateGuid = Ember.generateGuid,
IS_PATH = /[\.\*]/;
| true |
Other | emberjs | ember.js | 93ccb694a2668fbcc0e82e5cc398cc7975612763.json | Move Ember.typeOf to metal
*sigh* it's been a long day... | packages/ember-runtime/lib/core.js | @@ -9,79 +9,6 @@ require('ember-metal');
var indexOf = Ember.EnumerableUtils.indexOf;
-// ........................................
-// TYPING & ARRAY MESSAGING
-//
-
-var TYPE_MAP = {};
-var t = "Boolean Number String Function Array Date RegExp Object".split(" ");
-Ember.ArrayPolyfills.forEach.call(t, function(name) {
- TYPE_MAP[ "[object " + name + "]" ] = name.toLowerCase();
-});
-
-var toString = Object.prototype.toString;
-
-/**
- Returns a consistent type for the passed item.
-
- Use this instead of the built-in `typeof` to get the type of an item.
- It will return the same result across all browsers and includes a bit
- more detail. Here is what will be returned:
-
- | Return Value | Meaning |
- |---------------|------------------------------------------------------|
- | 'string' | String primitive |
- | 'number' | Number primitive |
- | 'boolean' | Boolean primitive |
- | 'null' | Null value |
- | 'undefined' | Undefined value |
- | 'function' | A function |
- | 'array' | An instance of Array |
- | 'class' | An Ember class (created using Ember.Object.extend()) |
- | 'instance' | An Ember object instance |
- | 'error' | An instance of the Error object |
- | 'object' | A JavaScript object not inheriting from Ember.Object |
-
- Examples:
-
- ```javascript
- Ember.typeOf(); // 'undefined'
- Ember.typeOf(null); // 'null'
- Ember.typeOf(undefined); // 'undefined'
- Ember.typeOf('michael'); // 'string'
- Ember.typeOf(101); // 'number'
- Ember.typeOf(true); // 'boolean'
- Ember.typeOf(Ember.makeArray); // 'function'
- Ember.typeOf([1,2,90]); // 'array'
- Ember.typeOf(Ember.Object.extend()); // 'class'
- Ember.typeOf(Ember.Object.create()); // 'instance'
- Ember.typeOf(new Error('teamocil')); // 'error'
-
- // "normal" JavaScript object
- Ember.typeOf({a: 'b'}); // 'object'
- ```
-
- @method typeOf
- @for Ember
- @param {Object} item the item to check
- @return {String} the type
-*/
-Ember.typeOf = function(item) {
- var ret;
-
- ret = (item === null || item === undefined) ? String(item) : TYPE_MAP[toString.call(item)] || 'object';
-
- if (ret === 'function') {
- if (Ember.Object && Ember.Object.detect(item)) ret = 'class';
- } else if (ret === 'object') {
- if (item instanceof Error) ret = 'error';
- else if (Ember.Object && item instanceof Ember.Object) ret = 'instance';
- else ret = 'object';
- }
-
- return ret;
-};
-
/**
This will compare two javascript values of possibly different types.
It will tell you which one is greater than the other by returning: | true |
Other | emberjs | ember.js | da77c583999a93abb3f53eef07d0a90fd51d6113.json | Use a string instead of an array in RenderBuffer | packages/ember-views/lib/system/render_buffer.js | @@ -38,7 +38,7 @@ Ember.RenderBuffer = function(tagName) {
Ember._RenderBuffer = function(tagName) {
this.tagNames = [tagName || null];
- this.buffer = [];
+ this.buffer = "";
};
Ember._RenderBuffer.prototype =
@@ -164,7 +164,7 @@ Ember._RenderBuffer.prototype =
@chainable
*/
push: function(string) {
- this.buffer.push(string);
+ this.buffer += string;
return this;
},
@@ -310,35 +310,35 @@ Ember._RenderBuffer.prototype =
style = this.elementStyle,
attr, prop;
- buffer.push('<' + tagName);
+ buffer += '<' + tagName;
if (id) {
- buffer.push(' id="' + this._escapeAttribute(id) + '"');
+ buffer += ' id="' + this._escapeAttribute(id) + '"';
this.elementId = null;
}
if (classes) {
- buffer.push(' class="' + this._escapeAttribute(classes.join(' ')) + '"');
+ buffer += ' class="' + this._escapeAttribute(classes.join(' ')) + '"';
this.classes = null;
}
if (style) {
- buffer.push(' style="');
+ buffer += ' style="';
for (prop in style) {
if (style.hasOwnProperty(prop)) {
- buffer.push(prop + ':' + this._escapeAttribute(style[prop]) + ';');
+ buffer += prop + ':' + this._escapeAttribute(style[prop]) + ';';
}
}
- buffer.push('"');
+ buffer += '"';
this.elementStyle = null;
}
if (attrs) {
for (attr in attrs) {
if (attrs.hasOwnProperty(attr)) {
- buffer.push(' ' + attr + '="' + this._escapeAttribute(attrs[attr]) + '"');
+ buffer += ' ' + attr + '="' + this._escapeAttribute(attrs[attr]) + '"';
}
}
@@ -351,9 +351,9 @@ Ember._RenderBuffer.prototype =
var value = props[prop];
if (value || typeof(value) === 'number') {
if (value === true) {
- buffer.push(' ' + prop + '="' + prop + '"');
+ buffer += ' ' + prop + '="' + prop + '"';
} else {
- buffer.push(' ' + prop + '="' + this._escapeAttribute(props[prop]) + '"');
+ buffer += ' ' + prop + '="' + this._escapeAttribute(props[prop]) + '"';
}
}
}
@@ -362,12 +362,13 @@ Ember._RenderBuffer.prototype =
this.elementProperties = null;
}
- buffer.push('>');
+ buffer += '>';
+ this.buffer = buffer;
},
pushClosingTag: function() {
var tagName = this.tagNames.pop();
- if (tagName) { this.buffer.push('</' + tagName + '>'); }
+ if (tagName) { this.buffer += '</' + tagName + '>'; }
},
currentTagName: function() {
@@ -461,7 +462,7 @@ Ember._RenderBuffer.prototype =
},
innerString: function() {
- return this.buffer.join('');
+ return this.buffer;
},
_escapeAttribute: function(value) { | false |
Other | emberjs | ember.js | 0fa2b3032398a168c7f0569d9b3c949a78e42155.json | Convert a for in loop to a plain for loop | packages/ember-metal/lib/mixin.js | @@ -165,7 +165,7 @@ function addNormalizedProperty(base, key, value, meta, descs, values, concats) {
}
}
-function mergeMixins(mixins, m, descs, values, base) {
+function mergeMixins(mixins, m, descs, values, base, keys) {
var mixin, props, key, concats, meta;
function removeKeys(keyName) {
@@ -186,13 +186,14 @@ function mergeMixins(mixins, m, descs, values, base) {
for (key in props) {
if (!props.hasOwnProperty(key)) { continue; }
+ keys.push(key);
addNormalizedProperty(base, key, props[key], meta, descs, values, concats);
}
// manually copy toString() because some JS engines do not enumerate it
if (props.hasOwnProperty('toString')) { base.toString = props.toString; }
} else if (mixin.mixins) {
- mergeMixins(mixin.mixins, m, descs, values, base);
+ mergeMixins(mixin.mixins, m, descs, values, base, keys);
if (mixin._without) { a_forEach.call(mixin._without, removeKeys); }
}
}
@@ -288,17 +289,18 @@ function replaceObservers(obj, key, observer) {
function applyMixin(obj, mixins, partial) {
var descs = {}, values = {}, m = Ember.meta(obj),
- key, value, desc;
+ key, value, desc, keys = [];
// Go through all mixins and hashes passed in, and:
//
// * Handle concatenated properties
// * Set up _super wrapping if necessary
// * Set up computed property descriptors
// * Copying `toString` in broken browsers
- mergeMixins(mixins, mixinsMeta(obj), descs, values, obj);
+ mergeMixins(mixins, mixinsMeta(obj), descs, values, obj, keys);
- for(key in values) {
+ for(var i = 0, l = keys.length; i < l; i++) {
+ key = keys[i];
if (key === 'constructor' || !values.hasOwnProperty(key)) { continue; }
desc = descs[key]; | false |
Other | emberjs | ember.js | b23292fff540ca74967139c81530b6f18fc7030b.json | remove unneeded asynchrony from routing tests | packages/ember/tests/routing/basic_test.js | @@ -456,8 +456,6 @@ test("The Specials Page defaults to looking models up via `find`", function() {
});
test("The Special Page returning a promise puts the app into a loading state until the promise is resolved", function() {
- stop();
-
Router.map(function() {
this.route("home", { path: "/" });
this.resource("special", { path: "/specials/:menu_item_id" });
@@ -503,15 +501,10 @@ test("The Special Page returning a promise puts the app into a loading state unt
menuItem.resolve(menuItem);
});
- setTimeout(function() {
- equal(Ember.$('p', '#qunit-fixture').text(), "1", "The app is now in the specials state");
- start();
- }, 100);
+ equal(Ember.$('p', '#qunit-fixture').text(), "1", "The app is now in the specials state");
});
test("The Special page returning an error puts the app into the failure state", function() {
- stop();
-
Router.map(function() {
this.route("home", { path: "/" });
this.resource("special", { path: "/specials/:menu_item_id" });
@@ -545,15 +538,10 @@ test("The Special page returning an error puts the app into the failure state",
menuItem.resolve(menuItem);
});
- setTimeout(function() {
- equal(Ember.$('p', '#qunit-fixture').text(), "FAILURE!", "The app is now in the failure state");
- start();
- }, 100);
+ equal(Ember.$('p', '#qunit-fixture').text(), "FAILURE!", "The app is now in the failure state");
});
test("The Special page returning an error puts the app into a default failure state if none provided", function() {
- stop();
-
Router.map(function() {
this.route("home", { path: "/" });
this.resource("special", { path: "/specials/:menu_item_id" });
@@ -589,10 +577,7 @@ test("The Special page returning an error puts the app into a default failure st
menuItem.resolve(menuItem);
});
- setTimeout(function() {
- equal(lastFailure, 'Setup error');
- start();
- }, 100);
+ equal(lastFailure, 'Setup error');
});
test("Moving from one page to another triggers the correct callbacks", function() { | false |
Other | emberjs | ember.js | c48b843265c849e0add3085ea57b97741c60ad64.json | Add {{input action="foo" on="keyPress"}} | packages/ember-handlebars/lib/controls.js | @@ -18,15 +18,20 @@ Ember.Handlebars.registerHelper('input', function(options) {
var hash = options.hash,
types = options.hashTypes,
- inputType = hash.type;
+ inputType = hash.type,
+ onEvent = hash.on;
delete hash.type;
+ delete hash.on;
+
+ hash.onEvent = onEvent;
normalizeHash(hash, types);
if (inputType === 'checkbox') {
return Ember.Handlebars.helpers.view.call(this, Ember.Checkbox, options);
} else {
+ hash.type = inputType;
return Ember.Handlebars.helpers.view.call(this, Ember.TextField, options);
}
});
\ No newline at end of file | true |
Other | emberjs | ember.js | c48b843265c849e0add3085ea57b97741c60ad64.json | Add {{input action="foo" on="keyPress"}} | packages/ember-handlebars/lib/controls/text_field.js | @@ -105,6 +105,20 @@ Ember.TextField = Ember.View.extend(Ember.TextSupport,
*/
action: null,
+ /**
+ The event that should send the action.
+
+ Options are:
+
+ * `enter`: the user pressed enter
+ * `keypress`: the user pressed a key
+
+ @property on
+ @type String
+ @default enter
+ */
+ onEvent: 'enter',
+
/**
Whether they `keyUp` event that triggers an `action` to be sent continues
propagating to other views.
@@ -123,15 +137,27 @@ Ember.TextField = Ember.View.extend(Ember.TextSupport,
bubbles: false,
insertNewline: function(event) {
- var controller = get(this, 'controller'),
- action = get(this, 'action');
+ sendAction('enter', this, event);
+ },
- if (action) {
- controller.send(action, get(this, 'value'), this);
+ keyPress: function(event) {
+ sendAction('keyPress', this, event);
+ }
+});
+
+function sendAction(eventName, view, event) {
+ var action = get(view, 'action'),
+ on = get(view, 'onEvent');
- if (!get(this, 'bubbles')) {
- event.stopPropagation();
- }
+ if (action && on === eventName) {
+ var controller = get(view, 'controller'),
+ value = get(view, 'value'),
+ bubbles = get(view, 'bubbles');
+
+ controller.send(action, value, view);
+
+ if (!bubbles) {
+ event.stopPropagation();
}
}
-});
+}
\ No newline at end of file | true |
Other | emberjs | ember.js | c48b843265c849e0add3085ea57b97741c60ad64.json | Add {{input action="foo" on="keyPress"}} | packages/ember-handlebars/tests/controls/text_field_test.js | @@ -377,6 +377,33 @@ test("should send an action if one is defined when the return key is pressed", f
textField.trigger('keyUp', event);
});
+test("should send an action on keyPress if one is defined with onEvent=keyPress", function() {
+ expect(3);
+
+ var StubController = Ember.Object.extend({
+ send: function(actionName, value, sender) {
+ equal(actionName, 'didTriggerAction', "text field sent correct action name");
+ equal(value, "textFieldValue", "text field sent its current value as first argument");
+ equal(sender, textField, "text field sent itself as second argument");
+ }
+ });
+
+ textField.set('action', 'didTriggerAction');
+ textField.set('onEvent', 'keyPress');
+ textField.set('value', "textFieldValue");
+ textField.set('controller', StubController.create());
+
+ Ember.run(function() { textField.append(); });
+
+ var event = {
+ keyCode: 48,
+ stopPropagation: Ember.K
+ };
+
+ textField.trigger('keyPress', event);
+});
+
+
test("bubbling of handled actions can be enabled via bubbles property", function() {
textField.set('bubbles', true);
textField.set('action', 'didTriggerAction'); | true |
Other | emberjs | ember.js | 434cb04c5612bf8b1fa1fda075e6a25acab1f130.json | remove sync from render to buffer | packages/ember-views/lib/views/view.js | @@ -121,8 +121,6 @@ Ember.CoreView = Ember.Object.extend(Ember.Evented, {
},
_renderToBuffer: function(parentBuffer, bufferOperation) {
- Ember.run.sync();
-
// If this is the top-most view, start a new buffer. Otherwise,
// create a new buffer relative to the original using the
// provided buffer operation (for example, `insertAfter` will | false |
Other | emberjs | ember.js | 1912279ca03767ac7def4ce2dc1428fcc888ff94.json | Define Mixin properties in prototype | packages/ember-metal/lib/mixin.js | @@ -372,6 +372,12 @@ Ember.Mixin = function() { return initMixin(this, arguments); };
Mixin = Ember.Mixin;
+Mixin.prototype = {
+ properties: null,
+ mixins: null,
+ ownerConstructor: null
+};
+
Mixin._apply = applyMixin;
Mixin.applyPartial = function(obj) { | false |
Other | emberjs | ember.js | 711740794ec5cebd20f3783f723ba5ce4d30570a.json | Define Ember.CoreObject#willDestroy. Fixes #1438. | packages/ember-runtime/lib/system/core_object.js | @@ -305,6 +305,8 @@ CoreObject.PrototypeMixin = Mixin.create({
return this;
},
+ willDestroy: Ember.K,
+
/**
@private
| false |
Other | emberjs | ember.js | 6217aff4445e16885e5e05debc19e8bd298a82b2.json | remove duplicate test | packages/ember-metal/tests/performance_test.js | @@ -7,25 +7,6 @@
module("Computed Properties - Number of times evaluated");
-test("computed properties that depend on multiple properties should run only once per run loop", function() {
- var obj = {a: 'a', b: 'b', c: 'c'};
- var count = 0;
- Ember.defineProperty(obj, 'abc', Ember.computed(function(key) {
- count++;
- return 'computed '+key;
- }).property('a', 'b', 'c'));
-
- Ember.beginPropertyChanges();
- Ember.set(obj, 'a', 'aa');
- Ember.set(obj, 'b', 'bb');
- Ember.set(obj, 'c', 'cc');
- Ember.endPropertyChanges();
-
- Ember.get(obj, 'abc');
-
- equal(count, 1, "The computed property is only invoked once");
-});
-
test("computed properties that depend on multiple properties should run only once per run loop", function() {
var obj = {a: 'a', b: 'b', c: 'c'};
var cpCount = 0, obsCount = 0; | false |
Other | emberjs | ember.js | 8e8a7b950198c1407ab8f78bb34671eb8ed6dd2c.json | Match the transitionTo APIs.
When we know we have the full hierarchy, pass false. | packages/ember-views/lib/views/states/in_buffer.js | @@ -47,7 +47,7 @@ Ember.merge(inBuffer, {
destroyElement: function(view) {
view.clearBuffer();
var viewCollection = view._notifyWillDestroyElement();
- viewCollection.transitionTo('preRender');
+ viewCollection.transitionTo('preRender', false);
return view;
}, | true |
Other | emberjs | ember.js | 8e8a7b950198c1407ab8f78bb34671eb8ed6dd2c.json | Match the transitionTo APIs.
When we know we have the full hierarchy, pass false. | packages/ember-views/lib/views/states/pre_render.js | @@ -17,7 +17,7 @@ Ember.merge(preRender, {
viewCollection.trigger('willInsertElement');
// after createElement, the view will be in the hasElement state.
fn.call(view);
- viewCollection.transitionTo('inDOM');
+ viewCollection.transitionTo('inDOM', false);
viewCollection.trigger('didInsertElement');
},
| true |
Other | emberjs | ember.js | 8e8a7b950198c1407ab8f78bb34671eb8ed6dd2c.json | Match the transitionTo APIs.
When we know we have the full hierarchy, pass false. | packages/ember-views/lib/views/view.js | @@ -228,10 +228,10 @@ ViewCollection.prototype = {
}
},
- transitionTo: function(state) {
+ transitionTo: function(state, children) {
var views = this.views;
for (var i = 0, l = views.length; i < l; i++) {
- views[i].transitionTo(state, false);
+ views[i].transitionTo(state, children);
}
},
| true |
Other | emberjs | ember.js | 280db3c69eafdafb69b67fe05751629e8dd2ae4a.json | Extract a private ViewCollection class to aid in
manipulating several views at once. | packages/ember-views/lib/views/container_view.js | @@ -11,6 +11,7 @@ var states = Ember.View.cloneStates(Ember.View.states);
var get = Ember.get, set = Ember.set;
var forEach = Ember.EnumerableUtils.forEach;
+var ViewCollection = Ember._ViewCollection;
/**
A `ContainerView` is an `Ember.View` subclass that implements `Ember.MutableArray`
@@ -373,27 +374,21 @@ Ember.merge(states.hasElement, {
},
ensureChildrenAreInDOM: function(view) {
- var childViews = view._childViews, i, len, childView, previous, buffer, viewCollection = [];
-
- function willInsertElement(v) {
- v.triggerRecursively('willInsertElement');
- }
-
- function didInsertElement(v) {
- v.transitionTo('inDOM');
- v.propertyDidChange('element');
- v.triggerRecursively('didInsertElement');
- }
+ var childViews = view._childViews, i, len, childView, previous, buffer, viewCollection = new ViewCollection();
function insertViewCollection() {
- viewCollection.forEach(willInsertElement);
+ viewCollection.triggerRecursively('willInsertElement');
if (previous) {
previous.domManager.after(previous, buffer.string());
} else {
view.domManager.prepend(view, buffer.string());
}
buffer = null;
- viewCollection.forEach(didInsertElement);
+ viewCollection.forEach(function(v) {
+ v.transitionTo('inDOM');
+ v.propertyDidChange('element');
+ v.triggerRecursively('didInsertElement');
+ });
}
for (i = 0, len = childViews.length; i < len; i++) {
@@ -406,7 +401,7 @@ Ember.merge(states.hasElement, {
} else if (viewCollection.length) {
insertViewCollection();
previous = childView;
- viewCollection = [];
+ viewCollection.clear();
} else {
previous = childView;
} | true |
Other | emberjs | ember.js | 280db3c69eafdafb69b67fe05751629e8dd2ae4a.json | Extract a private ViewCollection class to aid in
manipulating several views at once. | packages/ember-views/lib/views/view.js | @@ -205,6 +205,43 @@ Ember.CoreView = Ember.Object.extend(Ember.Evented, {
destroyElement: Ember.K
});
+var ViewCollection = Ember._ViewCollection = function(views) {
+ this.views = views || [];
+};
+
+ViewCollection.prototype = {
+ length: 0,
+
+ triggerRecursively: function(eventName) {
+ var views = this.views;
+ for (var i = 0, l = views.length; i < l; i++) {
+ views[i].triggerRecursively(eventName);
+ }
+ },
+
+ transitionTo: function(state) {
+ var views = this.views;
+ for (var i = 0, l = views.length; i < l; i++) {
+ views[i].transitionTo(state);
+ }
+ },
+
+ push: function(el) {
+ this.length++;
+ return this.views.push(el);
+ },
+
+ forEach: function() {
+ var views = this.views;
+ return views.forEach.apply(views, arguments);
+ },
+
+ clear: function() {
+ this.length = 0;
+ this.views.length = 0;
+ }
+};
+
/**
`Ember.View` is the class in Ember responsible for encapsulating templates of
HTML content, combining templates with data to render as sections of a page's | true |
Other | emberjs | ember.js | cb648d37cce2efeda180e08b374a0d2eaadd226c.json | Add support for {{input type="checkbox"}} | packages/ember-handlebars/lib/controls.js | @@ -24,5 +24,9 @@ Ember.Handlebars.registerHelper('input', function(options) {
normalizeHash(hash, types);
- return Ember.Handlebars.helpers.view.call(this, Ember.TextField, options);
+ if (inputType === 'checkbox') {
+ return Ember.Handlebars.helpers.view.call(this, Ember.Checkbox, options);
+ } else {
+ return Ember.Handlebars.helpers.view.call(this, Ember.TextField, options);
+ }
});
\ No newline at end of file | true |
Other | emberjs | ember.js | cb648d37cce2efeda180e08b374a0d2eaadd226c.json | Add support for {{input type="checkbox"}} | packages/ember-handlebars/tests/controls/checkbox_test.js | @@ -1,12 +1,111 @@
-var get = Ember.get, set = Ember.set,
- isInternetExplorer = window.navigator.userAgent.match(/msie/i),
- checkboxView, dispatcher;
+var get = Ember.get, set = function(obj, key, value) {
+ Ember.run(function() { Ember.set(obj, key, value); });
+};
+
+var isInternetExplorer = window.navigator.userAgent.match(/msie/i),
+ checkboxView, dispatcher, controller;
+
+
+var compile = Ember.Handlebars.compile;
+
+function destroy(view) {
+ Ember.run(function() {
+ view.destroy();
+ });
+}
+
+module("{{input type='checkbox'}}", {
+ setup: function() {
+ controller = {
+ tab: 6,
+ name: 'hello',
+ val: false
+ };
+
+ checkboxView = Ember.View.extend({
+ controller: controller,
+ template: compile('{{input type="checkbox" disabled=disabled tabindex=tab name=name checked=val}}')
+ }).create();
+
+ append();
+ },
+
+ teardown: function() {
+ destroy(checkboxView);
+ }
+});
+
+test("should append a checkbox", function() {
+ equal(checkboxView.$('input[type=checkbox]').length, 1, "A single checkbox is added");
+});
+
+test("should begin disabled if the disabled attribute is true", function() {
+ equal(checkboxView.$('input[type=checkbox]:disabled').length, 0, "The checkbox isn't disabled");
+ set(controller, 'disabled', true);
+ equal(checkboxView.$('input[type=checkbox]:disabled').length, 1, "The checkbox is now disabled");
+});
+
+test("should support the tabindex property", function() {
+ equal(checkboxView.$('input').prop('tabindex'), '6', 'the initial checkbox tabindex is set in the DOM');
+ set(controller, 'tab', 3);
+ equal(checkboxView.$('input').prop('tabindex'), '3', 'the checkbox tabindex changes when it is changed in the view');
+});
+
+test("checkbox name is updated", function() {
+ equal(checkboxView.$('input').attr('name'), "hello", "renders checkbox with the name");
+ set(controller, 'name', 'bye');
+ equal(checkboxView.$('input').attr('name'), "bye", "updates checkbox after name changes");
+});
+
+test("checkbox checked property is updated", function() {
+ equal(checkboxView.$('input').prop('checked'), false, "the checkbox isn't checked yet");
+ set(controller, 'val', true);
+ equal(checkboxView.$('input').prop('checked'), true, "the checkbox is checked now");
+});
+
+module("{{input type='checkbox'}} - static values", {
+ setup: function() {
+ controller = {
+ tab: 6,
+ name: 'hello',
+ val: false
+ };
+
+ checkboxView = Ember.View.extend({
+ controller: controller,
+ template: compile('{{input type="checkbox" disabled=true tabindex=6 name="hello" checked=false}}')
+ }).create();
+
+ append();
+ },
+
+ teardown: function() {
+ destroy(checkboxView);
+ }
+});
+
+test("should begin disabled if the disabled attribute is true", function() {
+ equal(checkboxView.$('input[type=checkbox]:disabled').length, 1, "The checkbox isn't disabled");
+});
+
+test("should support the tabindex property", function() {
+ equal(checkboxView.$('input').prop('tabindex'), '6', 'the initial checkbox tabindex is set in the DOM');
+});
+
+test("checkbox name is updated", function() {
+ equal(checkboxView.$('input').attr('name'), "hello", "renders checkbox with the name");
+});
+
+test("checkbox checked property is updated", function() {
+ equal(checkboxView.$('input').prop('checked'), false, "the checkbox isn't checked yet");
+});
module("Ember.Checkbox", {
setup: function() {
dispatcher = Ember.EventDispatcher.create();
dispatcher.setup();
},
+
teardown: function() {
Ember.run(function() {
dispatcher.destroy(); | true |
Other | emberjs | ember.js | 7e012d9e7f4c5e5b7ce6e60307aac7cd653df5b9.json | Fix Ember.TextField typo in CHANGELOG | CHANGELOG | @@ -11,7 +11,7 @@
* Support browsers (FF 10 or less) that don't support domElement.outerHTML
* Made it easier to augment the Application's container's resolver
* Support tag as an alias for tagName in the {{view}} helper
-* Add 'name' to attributeBinding for Ember.textField and Ember.Select
+* Add 'name' to attributeBinding for Ember.TextField and Ember.Select
* Return merged object from Ember.merge
* Deprecate setting tagNames on Metamorphs - Refs #2248
* Avoid parent's implicit index route clobbering child's explicit index. | false |
Other | emberjs | ember.js | d4318b7e1090301fa75cbfc05378afd8c33e3091.json | Fix deprecation warnings in tests | packages/ember-routing/tests/helpers/render_test.js | @@ -176,7 +176,7 @@ test("{{render}} helper should render templates with models multiple times", fun
});
var PostController = Ember.ObjectController.extend();
- container.register('controller', 'post', PostController, {singleton: false});
+ container.register('controller:post', PostController, {singleton: false});
Ember.TEMPLATES['post'] = compile("<p>{{title}}</p>");
@@ -214,7 +214,7 @@ test("{{render}} helper should render templates both with and without models", f
});
var PostController = Ember.ObjectController.extend();
- container.register('controller', 'post', PostController, {singleton: false});
+ container.register('controller:post', PostController, {singleton: false});
Ember.TEMPLATES['post'] = compile("<p>Title:{{title}}</p>");
| false |
Other | emberjs | ember.js | 3f87bb809dedba617489e85482615ba79cdcc3c2.json | remove self.isIinitialized check
We where actually initializing multiple times in our tests
and this check was hiding that.
isDestroy check can remain. | packages/ember-application/lib/system/application.js | @@ -305,14 +305,17 @@ var Application = Ember.Application = Ember.Namespace.extend({
@method scheduleInitialize
*/
scheduleInitialize: function() {
+ var self = this;
+
+ function initialize(){
+ if (self.isDestroyed) { return; }
+ Ember.run.schedule('actions', self, 'initialize');
+ }
+
if (!this.$ || this.$.isReady) {
- Ember.run.schedule('actions', this, 'initialize');
+ initialize();
} else {
- var self = this;
- this.$().ready(function() {
- if (self.isDestroyed || self.isInitialized) { return; }
- Ember.run(self, 'initialize');
- });
+ this.$().ready(initialize);
}
},
@@ -440,7 +443,7 @@ var Application = Ember.Application = Ember.Namespace.extend({
this.isInitialized = false;
- Em.run.schedule('actions', this, function(){
+ Ember.run.schedule('actions', this, function(){
this.initialize();
this.startRouting();
}); | true |
Other | emberjs | ember.js | 3f87bb809dedba617489e85482615ba79cdcc3c2.json | remove self.isIinitialized check
We where actually initializing multiple times in our tests
and this check was hiding that.
isDestroy check can remain. | packages/ember-application/tests/system/readiness_test.js | @@ -106,12 +106,7 @@ test("Ember.Application's ready event is called after the document becomes ready
test("Ember.Application's ready event can be deferred by other components", function() {
Ember.run(function() {
application = Application.create({ router: false });
- });
-
- application.deferReadiness();
-
- Ember.run(function() {
- application.initialize();
+ application.deferReadiness();
});
equal(readyWasCalled, 0, "ready wasn't called yet");
@@ -134,10 +129,9 @@ test("Ember.Application's ready event can be deferred by other components", func
Ember.run(function() {
application = Application.create({ router: false });
+ application.deferReadiness();
});
- application.deferReadiness();
-
Ember.run(function() {
domReady();
}); | true |
Other | emberjs | ember.js | 908981282ed8a3ad9ea388b51dd60cada92cdd47.json | Add note about view rerender to didInsertElement | packages/ember-views/lib/views/view.js | @@ -1556,9 +1556,9 @@ Ember.View = Ember.CoreView.extend(
willInsertElement: Ember.K,
/**
- Called when the element of the view has been inserted into the DOM.
- Override this function to do any set up that requires an element in the
- document body.
+ Called when the element of the view has been inserted into the DOM
+ or after the view was re-rendered. Override this function to do any
+ set up that requires an element in the document body.
@event didInsertElement
*/ | false |
Other | emberjs | ember.js | 59342302433fa7e73652bdfaae8b999e56643bbe.json | Add support for jQuery 2.0 | ember-dev.yml | @@ -18,8 +18,10 @@ testing_suites:
- "package=all&jquery=1.7.2&nojshint=true"
- "package=all&jquery=1.8.3&nojshint=true"
- "package=all&jquery=git&nojshint=true"
+ - "package=all&jquery=git2&nojshint=true"
- "package=all&extendprototypes=true&nojshint=true"
- "package=all&extendprototypes=true&jquery=git&nojshint=true"
+ - "package=all&extendprototypes=true&jquery=git2&nojshint=true"
- "package=all&skipPackage=container&dist=build&nojshint=true" # container isn't publicly available in the built version
testing_packages:
- container | true |
Other | emberjs | ember.js | 59342302433fa7e73652bdfaae8b999e56643bbe.json | Add support for jQuery 2.0 | packages/ember-views/lib/core.js | @@ -4,7 +4,7 @@
*/
var jQuery = Ember.imports.jQuery;
-Ember.assert("Ember Views require jQuery 1.8 or 1.9", jQuery && (jQuery().jquery.match(/^1\.(8|9)(\.\d+)?(pre|rc\d?)?/) || Ember.ENV.FORCE_JQUERY));
+Ember.assert("Ember Views require jQuery 1.8, 1.9 or 2.0", jQuery && (jQuery().jquery.match(/^((1\.(8|9))|2.0)(\.\d+)?(pre|rc\d?)?/) || Ember.ENV.FORCE_JQUERY));
/**
Alias for jQuery | true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/container/tests/sub_container_test.js | @@ -16,7 +16,7 @@ module("Container (sub-containers)", {
container = new Container();
var PostController = factory();
- container.register('controller', 'post', PostController);
+ container.register('controller:post', PostController);
},
teardown: function() { | true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-application/lib/system/application.js | @@ -110,7 +110,7 @@ var get = Ember.get, set = Ember.set,
name: "store",
initialize: function(container, application) {
- container.register('store', 'main', application.Store);
+ container.register('store:main', application.Store);
}
});
```
@@ -417,7 +417,7 @@ var Application = Ember.Application = Ember.Namespace.extend({
this.isInitialized = true;
// At this point, the App.Router must already be assigned
- this.register('router', 'main', this.Router);
+ this.register('router:main', this.Router);
this.runInitializers();
Ember.runLoadHooks('application', this);
@@ -610,7 +610,7 @@ Ember.Application.reopenClass({
container.resolver = resolverFor(namespace);
container.optionsForType('view', { singleton: false });
container.optionsForType('template', { instantiate: false });
- container.register('application', 'main', namespace, { instantiate: false });
+ container.register('application:main', namespace, { instantiate: false });
container.register('controller:basic', Ember.Controller, { instantiate: false });
container.register('controller:object', Ember.ObjectController, { instantiate: false }); | true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-application/tests/system/application_test.js | @@ -109,7 +109,7 @@ test('initialized application go to initial route', function() {
location: 'none'
});
- app.register('template', 'application',
+ app.register('template:application',
Ember.Handlebars.compile("{{outlet}}")
);
@@ -157,7 +157,7 @@ test("initialize application with stateManager via initialize call from Router c
location: 'none'
});
- app.register('template', 'application', function() {
+ app.register('template:application', function() {
return "<h1>Hello!</h1>";
});
}); | true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-application/tests/system/controller_test.js | @@ -3,11 +3,11 @@ module("Controller dependencies");
test("If a controller specifies a dependency, it is accessible", function() {
var container = new Ember.Container();
- container.register('controller', 'post', Ember.Controller.extend({
+ container.register('controller:post', Ember.Controller.extend({
needs: 'posts'
}));
- container.register('controller', 'posts', Ember.Controller.extend());
+ container.register('controller:posts', Ember.Controller.extend());
var postController = container.lookup('controller:post'),
postsController = container.lookup('controller:posts');
@@ -18,7 +18,7 @@ test("If a controller specifies a dependency, it is accessible", function() {
test("If a controller specifies an unavailable dependency, it raises", function() {
var container = new Ember.Container();
- container.register('controller', 'post', Ember.Controller.extend({
+ container.register('controller:post', Ember.Controller.extend({
needs: 'posts'
}));
| true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-handlebars/tests/handlebars_test.js | @@ -94,7 +94,7 @@ module("Ember.View - handlebars integration", {
});
test("template view should call the function of the associated template", function() {
- container.register('template', 'testTemplate', Ember.Handlebars.compile("<h1 id='twas-called'>template was called</h1>"));
+ container.register('template:testTemplate', Ember.Handlebars.compile("<h1 id='twas-called'>template was called</h1>"));
view = Ember.View.create({
container: container,
@@ -107,7 +107,7 @@ test("template view should call the function of the associated template", functi
});
test("template view should call the function of the associated template with itself as the context", function() {
- container.register('template', 'testTemplate', Ember.Handlebars.compile("<h1 id='twas-called'>template was called for {{view.personName}}. Yea {{view.personName}}</h1>"));
+ container.register('template:testTemplate', Ember.Handlebars.compile("<h1 id='twas-called'>template was called for {{view.personName}}. Yea {{view.personName}}</h1>"));
view = Ember.View.createWithMixins({
container: container,
@@ -205,8 +205,8 @@ test("should not escape HTML if string is a Handlebars.SafeString", function() {
});
test("child views can be inserted using the {{view}} Handlebars helper", function() {
- container.register('template', 'nester', Ember.Handlebars.compile("<h1 id='hello-world'>Hello {{world}}</h1>{{view \"TemplateTests.LabelView\"}}"));
- container.register('template', 'nested', Ember.Handlebars.compile("<div id='child-view'>Goodbye {{cruel}} {{world}}</div>"));
+ container.register('template:nester', Ember.Handlebars.compile("<h1 id='hello-world'>Hello {{world}}</h1>{{view \"TemplateTests.LabelView\"}}"));
+ container.register('template:nested', Ember.Handlebars.compile("<div id='child-view'>Goodbye {{cruel}} {{world}}</div>"));
var context = {
world: "world!"
@@ -250,9 +250,9 @@ test("should accept relative paths to views", function() {
});
test("child views can be inserted inside a bind block", function() {
- container.register('template', 'nester', Ember.Handlebars.compile("<h1 id='hello-world'>Hello {{world}}</h1>{{view \"TemplateTests.BQView\"}}"));
- container.register('template', 'nested', Ember.Handlebars.compile("<div id='child-view'>Goodbye {{#with content}}{{blah}} {{view \"TemplateTests.OtherView\"}}{{/with}} {{world}}</div>"));
- container.register('template', 'other', Ember.Handlebars.compile("cruel"));
+ container.register('template:nester', Ember.Handlebars.compile("<h1 id='hello-world'>Hello {{world}}</h1>{{view \"TemplateTests.BQView\"}}"));
+ container.register('template:nested', Ember.Handlebars.compile("<div id='child-view'>Goodbye {{#with content}}{{blah}} {{view \"TemplateTests.OtherView\"}}{{/with}} {{world}}</div>"));
+ container.register('template:other', Ember.Handlebars.compile("cruel"));
var context = {
world: "world!"
@@ -332,7 +332,7 @@ test("Ember.View should bind properties in the grandparent context", function()
});
test("Ember.View should update when a property changes and the bind helper is used", function() {
- container.register('template', 'foo', Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{bind "wham"}}{{/with}}</h1>'));
+ container.register('template:foo', Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{bind "wham"}}{{/with}}</h1>'));
view = Ember.View.create({
container: container,
@@ -355,7 +355,7 @@ test("Ember.View should update when a property changes and the bind helper is us
});
test("Ember.View should not use keyword incorrectly - Issue #1315", function() {
- container.register('template', 'foo', Ember.Handlebars.compile('{{#each value in view.content}}{{value}}-{{#each option in view.options}}{{option.value}}:{{option.label}} {{/each}}{{/each}}'));
+ container.register('template:foo', Ember.Handlebars.compile('{{#each value in view.content}}{{value}}-{{#each option in view.options}}{{option.value}}:{{option.label}} {{/each}}{{/each}}'));
view = Ember.View.create({
container: container,
@@ -376,7 +376,7 @@ test("Ember.View should not use keyword incorrectly - Issue #1315", function() {
});
test("Ember.View should update when a property changes and no bind helper is used", function() {
- container.register('template', 'foo', Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>'));
+ container.register('template:foo', Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>'));
var templates = Ember.Object.create({
foo: Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>')
@@ -404,7 +404,7 @@ test("Ember.View should update when a property changes and no bind helper is use
});
test("Ember.View should update when the property used with the #with helper changes", function() {
- container.register('template', 'foo', Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>'));
+ container.register('template:foo', Ember.Handlebars.compile('<h1 id="first">{{#with view.content}}{{wham}}{{/with}}</h1>'));
view = Ember.View.create({
container: container,
@@ -430,7 +430,7 @@ test("Ember.View should update when the property used with the #with helper chan
});
test("should not update when a property is removed from the view", function() {
- container.register('template', 'foo', Ember.Handlebars.compile('<h1 id="first">{{#bind "view.content"}}{{#bind "foo"}}{{bind "baz"}}{{/bind}}{{/bind}}</h1>'));
+ container.register('template:foo', Ember.Handlebars.compile('<h1 id="first">{{#bind "view.content"}}{{#bind "foo"}}{{bind "baz"}}{{/bind}}{{/bind}}</h1>'));
view = Ember.View.create({
container: container,
@@ -471,7 +471,7 @@ test("should not update when a property is removed from the view", function() {
});
test("Handlebars templates update properties if a content object changes", function() {
- container.register('template', 'menu', Ember.Handlebars.compile('<h1>Today\'s Menu</h1>{{#bind "view.coffee"}}<h2>{{color}} coffee</h2><span id="price">{{bind "price"}}</span>{{/bind}}'));
+ container.register('template:menu', Ember.Handlebars.compile('<h1>Today\'s Menu</h1>{{#bind "view.coffee"}}<h2>{{color}} coffee</h2><span id="price">{{bind "price"}}</span>{{/bind}}'));
Ember.run(function() {
view = Ember.View.create({
@@ -522,7 +522,7 @@ test("Handlebars templates update properties if a content object changes", funct
});
test("Template updates correctly if a path is passed to the bind helper", function() {
- container.register('template', 'menu', Ember.Handlebars.compile('<h1>{{bind "view.coffee.price"}}</h1>'));
+ container.register('template:menu', Ember.Handlebars.compile('<h1>{{bind "view.coffee.price"}}</h1>'));
view = Ember.View.create({
container: container,
@@ -587,7 +587,7 @@ test("Template updates correctly if a path is passed to the bind helper", functi
// });
test("should update the block when object passed to #if helper changes", function() {
- container.register('template', 'menu', Ember.Handlebars.compile('<h1>{{#if view.inception}}{{view.INCEPTION}}{{/if}}</h1>'));
+ container.register('template:menu', Ember.Handlebars.compile('<h1>{{#if view.inception}}{{view.INCEPTION}}{{/if}}</h1>'));
view = Ember.View.create({
container: container,
@@ -619,7 +619,7 @@ test("should update the block when object passed to #if helper changes", functio
});
test("should update the block when object passed to #unless helper changes", function() {
- container.register('template', 'advice', Ember.Handlebars.compile('<h1>{{#unless view.onDrugs}}{{view.doWellInSchool}}{{/unless}}</h1>'));
+ container.register('template:advice', Ember.Handlebars.compile('<h1>{{#unless view.onDrugs}}{{view.doWellInSchool}}{{/unless}}</h1>'));
view = Ember.View.create({
container: container,
@@ -651,7 +651,7 @@ test("should update the block when object passed to #unless helper changes", fun
});
test("should update the block when object passed to #if helper changes and an inverse is supplied", function() {
- container.register('template', 'menu', Ember.Handlebars.compile('<h1>{{#if view.inception}}{{view.INCEPTION}}{{else}}{{view.SAD}}{{/if}}</h1>'));
+ container.register('template:menu', Ember.Handlebars.compile('<h1>{{#if view.inception}}{{view.INCEPTION}}{{else}}{{view.SAD}}{{/if}}</h1>'));
view = Ember.View.create({
container: container,
@@ -752,8 +752,8 @@ test("Layout views return throw if their layout cannot be found", function() {
});
test("Template views add an elementId to child views created using the view helper", function() {
- container.register('template', 'parent', Ember.Handlebars.compile('<div>{{view "TemplateTests.ChildView"}}</div>'));
- container.register('template', 'child', Ember.Handlebars.compile("I can't believe it's not butter."));
+ container.register('template:parent', Ember.Handlebars.compile('<div>{{view "TemplateTests.ChildView"}}</div>'));
+ container.register('template:child', Ember.Handlebars.compile("I can't believe it's not butter."));
TemplateTests.ChildView = Ember.View.extend({
container: container,
@@ -771,7 +771,7 @@ test("Template views add an elementId to child views created using the view help
});
test("views set the template of their children to a passed block", function() {
- container.register('template', 'parent', Ember.Handlebars.compile('<h1>{{#view "TemplateTests.NoTemplateView"}}<span>It worked!</span>{{/view}}</h1>'));
+ container.register('template:parent', Ember.Handlebars.compile('<h1>{{#view "TemplateTests.NoTemplateView"}}<span>It worked!</span>{{/view}}</h1>'));
TemplateTests.NoTemplateView = Ember.View.extend();
@@ -785,7 +785,7 @@ test("views set the template of their children to a passed block", function() {
});
test("views render their template in the context of the parent view's context", function() {
- container.register('template', 'parent', Ember.Handlebars.compile('<h1>{{#with content}}{{#view}}{{firstName}} {{lastName}}{{/view}}{{/with}}</h1>'));
+ container.register('template:parent', Ember.Handlebars.compile('<h1>{{#with content}}{{#view}}{{firstName}} {{lastName}}{{/view}}{{/with}}</h1>'));
var context = {
content: {
@@ -805,7 +805,7 @@ test("views render their template in the context of the parent view's context",
});
test("views make a view keyword available that allows template to reference view context", function() {
- container.register('template', 'parent', Ember.Handlebars.compile('<h1>{{#with view.content}}{{#view subview}}{{view.firstName}} {{lastName}}{{/view}}{{/with}}</h1>'));
+ container.register('template:parent', Ember.Handlebars.compile('<h1>{{#with view.content}}{{#view subview}}{{view.firstName}} {{lastName}}{{/view}}{{/with}}</h1>'));
view = Ember.View.create({
container: container,
@@ -1003,7 +1003,7 @@ test("itemViewClass works in the #collection helper relatively", function() {
});
test("should update boundIf blocks if the conditional changes", function() {
- container.register('template', 'foo', Ember.Handlebars.compile('<h1 id="first">{{#boundIf "view.content.myApp.isEnabled"}}{{view.content.wham}}{{/boundIf}}</h1>'));
+ container.register('template:foo', Ember.Handlebars.compile('<h1 id="first">{{#boundIf "view.content.myApp.isEnabled"}}{{view.content.wham}}{{/boundIf}}</h1>'));
view = Ember.View.create({
container: container,
@@ -1088,7 +1088,7 @@ test("boundIf should support parent access", function(){
});
test("{{view}} id attribute should set id on layer", function() {
- container.register('template', 'foo', Ember.Handlebars.compile('{{#view "TemplateTests.IdView" id="bar"}}baz{{/view}}'));
+ container.register('template:foo', Ember.Handlebars.compile('{{#view "TemplateTests.IdView" id="bar"}}baz{{/view}}'));
TemplateTests.IdView = Ember.View;
@@ -1104,7 +1104,7 @@ test("{{view}} id attribute should set id on layer", function() {
});
test("{{view}} tag attribute should set tagName of the view", function() {
- container.register('template', 'foo', Ember.Handlebars.compile('{{#view "TemplateTests.TagView" tag="span"}}baz{{/view}}'));
+ container.register('template:foo', Ember.Handlebars.compile('{{#view "TemplateTests.TagView" tag="span"}}baz{{/view}}'));
TemplateTests.TagView = Ember.View;
@@ -1120,7 +1120,7 @@ test("{{view}} tag attribute should set tagName of the view", function() {
});
test("{{view}} class attribute should set class on layer", function() {
- container.register('template', 'foo', Ember.Handlebars.compile('{{#view "TemplateTests.IdView" class="bar"}}baz{{/view}}'));
+ container.register('template:foo', Ember.Handlebars.compile('{{#view "TemplateTests.IdView" class="bar"}}baz{{/view}}'));
TemplateTests.IdView = Ember.View;
@@ -1295,7 +1295,7 @@ test("{{view}} should evaluate other attributes bindings set in the current cont
});
test("{{view}} should be able to bind class names to truthy properties", function() {
- container.register('template', 'template', Ember.Handlebars.compile('{{#view "TemplateTests.classBindingView" classBinding="view.number:is-truthy"}}foo{{/view}}'));
+ container.register('template:template', Ember.Handlebars.compile('{{#view "TemplateTests.classBindingView" classBinding="view.number:is-truthy"}}foo{{/view}}'));
TemplateTests.classBindingView = Ember.View.extend();
@@ -1317,7 +1317,7 @@ test("{{view}} should be able to bind class names to truthy properties", functio
});
test("{{view}} should be able to bind class names to truthy or falsy properties", function() {
- container.register('template', 'template', Ember.Handlebars.compile('{{#view "TemplateTests.classBindingView" classBinding="view.number:is-truthy:is-falsy"}}foo{{/view}}'));
+ container.register('template:template', Ember.Handlebars.compile('{{#view "TemplateTests.classBindingView" classBinding="view.number:is-truthy:is-falsy"}}foo{{/view}}'));
TemplateTests.classBindingView = Ember.View.extend();
| true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-handlebars/tests/helpers/each_test.js | @@ -213,7 +213,7 @@ test("it supports itemController", function() {
controller: parentController
});
- container.register('controller', 'person', Controller);
+ container.register('controller:person', Controller);
append(view);
@@ -259,7 +259,7 @@ test("it supports itemController when using a custom keyword", function() {
}
});
- container.register('controller', 'person', Controller);
+ container.register('controller:person', Controller);
append(view);
| true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-handlebars/tests/helpers/yield_test.js | @@ -39,8 +39,8 @@ test("a view with a layout set renders its template where the {{yield}} helper a
});
test("block should work properly even when templates are not hard-coded", function() {
- container.register('template', 'nester', Ember.Handlebars.compile('<div class="wrapper"><h1>{{title}}</h1>{{yield}}</div>'));
- container.register('template', 'nested', Ember.Handlebars.compile('{{#view TemplateTests.ViewWithLayout title="My Fancy Page"}}<div class="page-body">Show something interesting here</div>{{/view}}'));
+ container.register('template:nester', Ember.Handlebars.compile('<div class="wrapper"><h1>{{title}}</h1>{{yield}}</div>'));
+ container.register('template:nested', Ember.Handlebars.compile('{{#view TemplateTests.ViewWithLayout title="My Fancy Page"}}<div class="page-body">Show something interesting here</div>{{/view}}'));
TemplateTests.ViewWithLayout = Ember.View.extend({
container: container, | true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-routing/lib/system/controller_for.js | @@ -14,7 +14,7 @@ Ember.controllerFor = function(container, controllerName, context, lookupOptions
`App.ObjectController` and `App.ArrayController`
*/
Ember.generateController = function(container, controllerName, context) {
- var controller, DefaultController;
+ var controller, DefaultController, fullName;
if (context && Ember.isArray(context)) {
DefaultController = container.resolve('controller:array');
@@ -35,6 +35,8 @@ Ember.generateController = function(container, controllerName, context) {
return "(generated " + controllerName + " controller)";
};
- container.register('controller', controllerName, controller);
- return container.lookup('controller:' + controllerName);
+
+ fullName = 'controller:' + controllerName;
+ container.register(fullName, controller);
+ return container.lookup(fullName);
}; | true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-routing/lib/system/router.js | @@ -56,8 +56,8 @@ Ember.Router = Ember.Object.extend({
setupRouter(this, router, location);
- container.register('view', 'default', DefaultView);
- container.register('view', 'toplevel', Ember.View.extend());
+ container.register('view:default', DefaultView);
+ container.register('view:toplevel', Ember.View.extend());
location.onUpdateURL(function(url) {
self.handleURL(url);
@@ -153,7 +153,9 @@ function getHandlerFunction(router) {
DefaultRoute = container.resolve('route:basic');
return function(name) {
- var handler = container.lookup('route:' + name);
+ var routeName = 'route:' + name,
+ handler = container.lookup(routeName);
+
if (seen[name]) { return handler; }
seen[name] = true;
@@ -162,8 +164,8 @@ function getHandlerFunction(router) {
if (name === 'loading') { return {}; }
if (name === 'failure') { return router.constructor.defaultFailureHandler; }
- container.register('route', name, DefaultRoute.extend());
- handler = container.lookup('route:' + name);
+ container.register(routeName, DefaultRoute.extend());
+ handler = container.lookup(routeName);
}
handler.routeName = name;
@@ -172,7 +174,8 @@ function getHandlerFunction(router) {
}
function handlerIsActive(router, handlerName) {
- var handler = router.container.lookup('route:' + handlerName),
+ var routeName = 'route:' + handlerName,
+ handler = router.container.lookup(routeName),
currentHandlerInfos = router.router.currentHandlerInfos,
handlerInfo;
| true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-routing/tests/helpers/render_test.js | @@ -17,7 +17,7 @@ var buildContainer = function(namespace) {
container.resolver = resolverFor(namespace);
container.optionsForType('view', { singleton: false });
container.optionsForType('template', { instantiate: false });
- container.register('application', 'main', namespace, { instantiate: false });
+ container.register('application:main', namespace, { instantiate: false });
container.injection('router:main', 'namespace', 'application:main');
container.register('controller:basic', Ember.Controller, { instantiate: false });
@@ -54,8 +54,8 @@ module("Handlebars {{render}} helper", {
setup: function() {
var namespace = Ember.Namespace.create();
container = buildContainer(namespace);
- container.register('view', 'default', Ember.View.extend());
- container.register('router', 'main', Ember.Router.extend());
+ container.register('view:default', Ember.View.extend());
+ container.register('router:main', Ember.Router.extend());
},
teardown: function() {
Ember.run(function () {
@@ -104,7 +104,7 @@ test("{{render}} helper should render given template with a supplied model", fun
});
var PostController = Ember.ObjectController.extend();
- container.register('controller', 'post', PostController);
+ container.register('controller:post', PostController);
Ember.TEMPLATES['post'] = compile("<p>{{title}}</p>");
@@ -150,7 +150,7 @@ test("{{render}} helper should not use singleton controller with a supplied mode
test("{{render}} helper should render with given controller", function() {
var template = '<h1>HI</h1>{{render home controller="posts"}}';
var controller = Ember.Controller.extend({container: container});
- container.register('controller', 'posts', Ember.ArrayController.extend());
+ container.register('controller:posts', Ember.ArrayController.extend());
view = Ember.View.create({
controller: controller.create(),
template: Ember.Handlebars.compile(template)
@@ -191,7 +191,7 @@ test("{{render}} helper should link child controllers to the parent controller",
}
});
- container.register('controller', 'posts', Ember.ArrayController.extend());
+ container.register('controller:posts', Ember.ArrayController.extend());
view = Ember.View.create({
controller: controller.create(),
@@ -245,7 +245,7 @@ test("{{render}} works with dot notation", function() {
var template = '<h1>BLOG</h1>{{render blog.post}}';
var controller = Ember.Controller.extend({container: container});
- container.register('controller', 'blog.post', Ember.ObjectController.extend());
+ container.register('controller:blog.post', Ember.ObjectController.extend());
view = Ember.View.create({
controller: controller.create(),
@@ -265,7 +265,7 @@ test("{{render}} works with slash notation", function() {
var template = '<h1>BLOG</h1>{{render "blog/post"}}';
var controller = Ember.Controller.extend({container: container});
- container.register('controller', 'blog.post', Ember.ObjectController.extend());
+ container.register('controller:blog.post', Ember.ObjectController.extend());
view = Ember.View.create({
controller: controller.create(), | true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-routing/tests/system/controller_for_test.js | @@ -5,7 +5,7 @@ var buildContainer = function(namespace) {
container.resolver = resolverFor(namespace);
container.optionsForType('view', { singleton: false });
- container.register('application', 'main', namespace, { instantiate: false });
+ container.register('application:main', namespace, { instantiate: false });
container.register('controller:basic', Ember.Controller, { instantiate: false });
container.register('controller:object', Ember.ObjectController, { instantiate: false });
@@ -37,7 +37,7 @@ module("Ember.controllerFor", {
setup: function() {
namespace = Ember.Namespace.create();
container = buildContainer(namespace);
- container.register('controller', 'app', Ember.Controller.extend());
+ container.register('controller:app', Ember.Controller.extend());
appController = container.lookup('controller:app');
},
teardown: function() {
@@ -106,4 +106,4 @@ test("controllerFor should create App.ArrayController if provided", function() {
ok(controller instanceof namespace.ArrayController, 'should create controller');
equal(controller.get('content'), context, 'should set content');
-});
\ No newline at end of file
+}); | true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-runtime/tests/controllers/item_controller_class_test.js | @@ -30,8 +30,8 @@ module("Ember.ArrayController - itemController", {
}
});
- container.register("controller", "Item", controllerClass);
- container.register("controller", "OtherItem", otherControllerClass);
+ container.register("controller:Item", controllerClass);
+ container.register("controller:OtherItem", otherControllerClass);
},
teardown: function() {
Ember.run(function() { | true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-views/tests/views/view/layout_test.js | @@ -15,8 +15,8 @@ module("Ember.View - Layout Functionality", {
test("should call the function of the associated layout", function() {
var templateCalled = 0, layoutCalled = 0;
- container.register('template', 'template', function() { templateCalled++; });
- container.register('template', 'layout', function() { layoutCalled++; });
+ container.register('template:template', function() { templateCalled++; });
+ container.register('template:layout', function() { layoutCalled++; });
view = Ember.View.create({
container: container,
@@ -33,7 +33,7 @@ test("should call the function of the associated layout", function() {
});
test("should call the function of the associated template with itself as the context", function() {
- container.register('template', 'testTemplate', function(dataSource) {
+ container.register('template:testTemplate', function(dataSource) {
return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>";
});
| true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember-views/tests/views/view/template_test.js | @@ -13,7 +13,7 @@ module("Ember.View - Template Functionality", {
});
test("should call the function of the associated template", function() {
- container.register('template', 'testTemplate', function() {
+ container.register('template:testTemplate', function() {
return "<h1 id='twas-called'>template was called</h1>";
});
@@ -30,7 +30,7 @@ test("should call the function of the associated template", function() {
});
test("should call the function of the associated template with itself as the context", function() {
- container.register('template', 'testTemplate', function(dataSource) {
+ container.register('template:testTemplate', function(dataSource) {
return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>";
});
@@ -89,7 +89,7 @@ test("should not use defaultTemplate if template is provided", function() {
test("should not use defaultTemplate if template is provided", function() {
var View;
- container.register('template', 'foobar', function() { return 'foo'; });
+ container.register('template:foobar', function() { return 'foo'; });
View = Ember.View.extend({
container: container, | true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember/tests/helpers/link_to_test.js | @@ -42,8 +42,8 @@ module("The {{linkTo}} helper", {
container = App.__container__;
- container.register('view', 'app');
- container.register('router', 'main', Router);
+ container.register('view:app');
+ container.register('router:main', Router);
});
},
| true |
Other | emberjs | ember.js | a310f8ccc287026017b491d6101d68587cf9af82.json | Fix deprecation warnings 3d3327c brought to light. | packages/ember/tests/routing/basic_test.js | @@ -265,7 +265,7 @@ test("The Homepage with a `setupController` hook", function() {
bootApplication();
- container.register('controller', 'home', Ember.Controller.extend());
+ container.register('controller:home', Ember.Controller.extend());
Ember.run(function() {
router.handleURL("/");
@@ -286,7 +286,7 @@ test("The route controller is still set when overriding the setupController hook
}
});
- container.register('controller', 'home', Ember.Controller.extend());
+ container.register('controller:home', Ember.Controller.extend());
bootApplication();
@@ -315,7 +315,7 @@ test("The default controller's model is still set when overriding the setupContr
"<ul>{{#each entry in hours}}<li>{{entry}}</li>{{/each}}</ul>"
);
- container.register('controller', 'home', Ember.Controller.extend());
+ container.register('controller:home', Ember.Controller.extend());
bootApplication();
@@ -343,7 +343,7 @@ test("The Homepage with a `setupController` hook modifying other controllers", f
bootApplication();
- container.register('controller', 'home', Ember.Controller.extend());
+ container.register('controller:home', Ember.Controller.extend());
Ember.run(function() {
router.handleURL("/");
@@ -379,7 +379,7 @@ test("The Homepage getting its controller context via model", function() {
bootApplication();
- container.register('controller', 'home', Ember.Controller.extend());
+ container.register('controller:home', Ember.Controller.extend());
Ember.run(function() {
router.handleURL("/");
@@ -412,7 +412,7 @@ test("The Specials Page getting its controller context by deserializing the para
bootApplication();
- container.register('controller', 'special', Ember.Controller.extend());
+ container.register('controller:special', Ember.Controller.extend());
Ember.run(function() {
router.handleURL("/specials/1");
@@ -446,7 +446,7 @@ test("The Specials Page defaults to looking models up via `find`", function() {
bootApplication();
- container.register('controller', 'special', Ember.Controller.extend());
+ container.register('controller:special', Ember.Controller.extend());
Ember.run(function() {
router.handleURL("/specials/1");
@@ -491,7 +491,7 @@ test("The Special Page returning a promise puts the app into a loading state unt
bootApplication();
- container.register('controller', 'special', Ember.Controller.extend());
+ container.register('controller:special', Ember.Controller.extend());
Ember.run(function() {
router.handleURL("/specials/1");
@@ -637,7 +637,7 @@ test("Moving from one page to another triggers the correct callbacks", function(
bootApplication();
- container.register('controller', 'special', Ember.Controller.extend());
+ container.register('controller:special', Ember.Controller.extend());
Ember.run(function() {
router.handleURL("/");
@@ -727,7 +727,7 @@ test("Nested callbacks are not exited when moving to siblings", function() {
bootApplication();
});
- container.register('controller', 'special', Ember.Controller.extend());
+ container.register('controller:special', Ember.Controller.extend());
equal(Ember.$('h3', '#qunit-fixture').text(), "Home", "The app is now in the initial state");
equal(rootSetup, 1, "The root setup was triggered");
@@ -783,7 +783,7 @@ asyncTest("Events are triggered on the controller if a matching action name is i
}
});
- container.register('controller', 'home', controller);
+ container.register('controller:home', controller);
bootApplication();
@@ -826,7 +826,7 @@ asyncTest("Events are triggered on the current state", function() {
bootApplication();
- container.register('controller', 'home', Ember.Controller.extend());
+ container.register('controller:home', Ember.Controller.extend());
//var controller = router._container.controller.home = Ember.Controller.create();
//controller.target = router; | true |
Other | emberjs | ember.js | 9d33dfe86293c82db51aa280cc042f8393e6986f.json | Remove unused variable | packages/ember-handlebars/lib/ext.js | @@ -326,7 +326,6 @@ Ember.Handlebars.registerBoundHelper = function(name, fn) {
*/
function evaluateMultiPropertyBoundHelper(context, fn, normalizedProperties, options) {
var numProperties = normalizedProperties.length,
- self = this,
data = options.data,
view = data.view,
hash = options.hash, | true |
Other | emberjs | ember.js | 9d33dfe86293c82db51aa280cc042f8393e6986f.json | Remove unused variable | packages/ember-handlebars/lib/helpers/view.js | @@ -9,7 +9,6 @@ require("ember-handlebars");
*/
var get = Ember.get, set = Ember.set;
-var PARENT_VIEW_PATH = /^parentView\./;
var EmberHandlebars = Ember.Handlebars;
EmberHandlebars.ViewHelper = Ember.Object.create({ | true |
Other | emberjs | ember.js | 3fec7df524c79dc13b36485f23acf62ef1ff07b1.json | Fix document indent | packages/ember-handlebars/lib/controls/text_field.js | @@ -99,9 +99,9 @@ Ember.TextField = Ember.View.extend(Ember.TextSupport,
the user presses the return key when editing a text field, and sends
the value of the field as the context.
- @property action
- @type String
- @default null
+ @property action
+ @type String
+ @default null
*/
action: null,
| false |
Other | emberjs | ember.js | 4fdee7b4e81c8c3ce3d0c986f037b92705265c94.json | Return merged object from Ember.merge | packages/ember-metal/lib/core.js | @@ -227,6 +227,7 @@ Ember.merge = function(original, updates) {
if (!updates.hasOwnProperty(prop)) { continue; }
original[prop] = updates[prop];
}
+ return original;
};
/** | false |
Other | emberjs | ember.js | 99a1c6e95d47f106de896522689ec99e65fc27c4.json | Remove special case readOnly for computed.alias.
Prefer the computed property wide readOnly method. | packages/ember-metal/lib/computed.js | @@ -488,22 +488,13 @@ Ember.computed.bool = function(dependentKey) {
@method computed.alias
@for Ember
- Available options:
-
- * `readOnly`: `true`
-
@param {String} dependentKey
- @param {Object} options
*/
-Ember.computed.alias = function(dependentKey, options) {
+Ember.computed.alias = function(dependentKey) {
return Ember.computed(dependentKey, function(key, value){
if (arguments.length > 1) {
- if (options && options.readOnly){
- throw new Error('Cannot Set: ' + key + ' on: ' + this.toString() );
- } else{
- set(this, dependentKey, value);
- return value;
- }
+ set(this, dependentKey, value);
+ return value;
} else {
return get(this, dependentKey);
} | true |
Other | emberjs | ember.js | 99a1c6e95d47f106de896522689ec99e65fc27c4.json | Remove special case readOnly for computed.alias.
Prefer the computed property wide readOnly method. | packages/ember-metal/tests/computed_test.js | @@ -769,40 +769,3 @@ testBoth('Ember.computed.alias', function(get, set) {
equal(get(obj, 'baz'), 'newBaz');
equal(get(obj, 'quz'), null);
});
-
-testBoth('Ember.computed.alias readOnly: true', function(get, set) {
- var obj = { bar: 'asdf', baz: null, quz: false};
- Ember.defineProperty(obj, 'bay', Ember.computed(function(key){
- return 'apple';
- }));
-
- Ember.defineProperty(obj, 'barAlias', Ember.computed.alias('bar', { readOnly: true }));
- Ember.defineProperty(obj, 'bazAlias', Ember.computed.alias('baz', { readOnly: true }));
- Ember.defineProperty(obj, 'quzAlias', Ember.computed.alias('quz', { readOnly: true }));
- Ember.defineProperty(obj, 'bayAlias', Ember.computed.alias('bay', { readOnly: true }));
-
- equal(get(obj, 'barAlias'), 'asdf');
- equal(get(obj, 'bazAlias'), null);
- equal(get(obj, 'quzAlias'), false);
- equal(get(obj, 'bayAlias'), 'apple');
-
- raises(function(){
- set(obj, 'barAlias', 'newBar');
- }, /Cannot Set: barAlias on:/ );
-
- raises(function(){
- set(obj, 'bazAlias', 'newBaz');
- }, /Cannot Set: bazAlias on:/ );
-
- raises(function(){
- set(obj, 'quzAlias', null);
- }, /Cannot Set: quzAlias on:/ );
-
- equal(get(obj, 'barAlias'), 'asdf');
- equal(get(obj, 'bazAlias'), null);
- equal(get(obj, 'quzAlias'), false);
-
- equal(get(obj, 'bar'), 'asdf');
- equal(get(obj, 'baz'), null);
- equal(get(obj, 'quz'), false);
-}); | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-application/lib/system/application.js | @@ -450,7 +450,7 @@ var Application = Ember.Application = Ember.Namespace.extend({
container = this.__container__,
graph = new Ember.DAG(),
namespace = this,
- properties, i, initializer;
+ i, initializer;
for (i=0; i<initializers.length; i++) {
initializer = initializers[i]; | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-routing/lib/helpers/action.js | @@ -64,9 +64,7 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
event.stopPropagation();
}
- var view = options.view,
- contexts = options.contexts,
- target = options.target;
+ var target = options.target;
if (target.target) {
target = handlebarsGet(target.root, target.target, target.options);
@@ -285,7 +283,7 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
var hash = options.hash,
view = options.data.view,
- controller, link;
+ controller;
// create a hash to pass along to registerAction
var action = { | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-runtime/lib/controllers/array_controller.js | @@ -7,8 +7,8 @@ require('ember-runtime/mixins/sortable');
@submodule ember-runtime
*/
-var get = Ember.get, set = Ember.set, isGlobalPath = Ember.isGlobalPath,
- forEach = Ember.EnumerableUtils.forEach, replace = Ember.EnumerableUtils.replace;
+var get = Ember.get, set = Ember.set, forEach = Ember.EnumerableUtils.forEach,
+ replace = Ember.EnumerableUtils.replace;
/**
`Ember.ArrayController` provides a way for you to publish a collection of | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-runtime/lib/mixins/deferred.js | @@ -9,8 +9,7 @@ RSVP.async = function(callback, binding) {
@submodule ember-runtime
*/
-var get = Ember.get,
- slice = Array.prototype.slice;
+var get = Ember.get;
/**
@class Deferred | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-runtime/lib/mixins/enumerable.js | @@ -828,7 +828,7 @@ Ember.Enumerable = Ember.Mixin.create({
@chainable
*/
enumerableContentDidChange: function(removing, adding) {
- var notify = this.propertyDidChange, removeCnt, addCnt, hasDelta;
+ var removeCnt, addCnt, hasDelta;
if ('number' === typeof removing) removeCnt = removing;
else if (removing) removeCnt = get(removing, 'length'); | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-runtime/lib/mixins/mutable_array.js | @@ -18,7 +18,7 @@ var EMPTY = [];
// HELPERS
//
-var get = Ember.get, set = Ember.set, forEach = Ember.EnumerableUtils.forEach;
+var get = Ember.get, set = Ember.set;
/**
This mixin defines the API for modifying array-like objects. These methods | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-runtime/lib/mixins/sortable.js | @@ -161,7 +161,6 @@ Ember.SortableMixin = Ember.Mixin.create(Ember.MutableEnumerable, {
if (isSorted) {
var addedObjects = array.slice(idx, idx+addedCount);
- var arrangedContent = get(this, 'arrangedContent');
forEach(addedObjects, function(item) {
this.insertItemSorted(item); | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-runtime/lib/system/array_proxy.js | @@ -229,7 +229,6 @@ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,
},
_insertAt: function(idx, object) {
- var content = this.get('content');
if (idx > get(this, 'content.length')) throw new Error(OUT_OF_RANGE_EXCEPTION);
this._replace(idx, 0, [object]);
return this; | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-runtime/lib/system/core_object.js | @@ -13,7 +13,6 @@ require('ember-runtime/system/namespace');
var set = Ember.set, get = Ember.get,
o_create = Ember.create,
o_defineProperty = Ember.platform.defineProperty,
- a_slice = Array.prototype.slice,
GUID_KEY = Ember.GUID_KEY,
guidFor = Ember.guidFor,
generateGuid = Ember.generateGuid, | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-runtime/lib/system/each_proxy.js | @@ -43,7 +43,7 @@ function addObserverForContentKey(content, keyName, proxy, idx, loc) {
Ember.addBeforeObserver(item, keyName, proxy, 'contentKeyWillChange');
Ember.addObserver(item, keyName, proxy, 'contentKeyDidChange');
- // keep track of the indicies each item was found at so we can map
+ // 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] = [];
@@ -115,7 +115,7 @@ Ember.EachProxy = Ember.Object.extend({
// Invokes whenever the content array itself changes.
arrayWillChange: function(content, idx, removedCnt, addedCnt) {
- var keys = this._keys, key, array, lim;
+ var keys = this._keys, key, lim;
lim = removedCnt>0 ? idx+removedCnt : -1;
Ember.beginPropertyChanges(this);
@@ -133,7 +133,7 @@ Ember.EachProxy = Ember.Object.extend({
},
arrayDidChange: function(content, idx, removedCnt, addedCnt) {
- var keys = this._keys, key, array, lim;
+ var keys = this._keys, key, lim;
lim = addedCnt>0 ? idx+addedCnt : -1;
Ember.beginPropertyChanges(this); | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-states/lib/state.js | @@ -66,7 +66,7 @@ Ember.State = Ember.Object.extend(Ember.Evented,
},
init: function() {
- var states = get(this, 'states'), foundStates;
+ var states = get(this, 'states');
set(this, 'childStates', Ember.A());
set(this, 'eventTransitions', get(this, 'eventTransitions') || {});
@@ -216,7 +216,7 @@ Ember.State.reopenClass({
transitionTo: function(target) {
var transitionFunction = function(stateManager, contextOrEvent) {
- var contexts = [], transitionArgs,
+ var contexts = [],
Event = Ember.$ && Ember.$.Event;
if (contextOrEvent && (Event && contextOrEvent instanceof Event)) { | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-views/lib/system/controller.js | @@ -27,8 +27,7 @@ Ember.ControllerMixin.reopen({
},
_modelDidChange: Ember.observer(function() {
- var containers = get(this, '_childContainers'),
- container;
+ var containers = get(this, '_childContainers');
for (var prop in containers) {
if (!containers.hasOwnProperty(prop)) { continue; } | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-views/lib/system/render_buffer.js | @@ -175,7 +175,7 @@ Ember._RenderBuffer.prototype =
*/
addClass: function(className) {
// lazily create elementClasses
- var elementClasses = this.elementClasses = (this.elementClasses || new ClassSet());
+ this.elementClasses = (this.elementClasses || new ClassSet());
this.elementClasses.add(className);
this.classes = this.elementClasses.list;
@@ -280,7 +280,7 @@ Ember._RenderBuffer.prototype =
@chainable
*/
style: function(name, value) {
- var style = this.elementStyle = (this.elementStyle || {});
+ this.elementStyle = (this.elementStyle || {});
this.elementStyle[name] = value;
return this; | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-views/lib/views/collection_view.js | @@ -290,7 +290,7 @@ Ember.CollectionView = Ember.ContainerView.extend(
*/
arrayDidChange: function(content, start, removed, added) {
var itemViewClass = get(this, 'itemViewClass'),
- addedViews = [], view, item, idx, len, itemTagName;
+ addedViews = [], view, item, idx, len;
if ('string' === typeof itemViewClass) {
itemViewClass = get(itemViewClass); | true |
Other | emberjs | ember.js | da51cfdcce465dfd3224ca4c471bb9cb96026664.json | Fix typo and remove unused variables | packages/ember-views/lib/views/states.js | @@ -14,8 +14,6 @@ Ember.View.cloneStates = function(from) {
into.hasElement = Ember.create(into._default);
into.inDOM = Ember.create(into.hasElement);
- var viewState;
-
for (var stateName in from) {
if (!from.hasOwnProperty(stateName)) { continue; }
Ember.merge(into[stateName], from[stateName]); | true |
Other | emberjs | ember.js | b22618f9135cf08825b78bdabd83d89110061ba7.json | allow tag for tagName in the view helper | packages/ember-handlebars/lib/helpers/view.js | @@ -25,6 +25,11 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
dup = true;
}
+ if (hash.tag) {
+ extensions.tagName = hash.tag;
+ dup = true;
+ }
+
if (classes) {
classes = classes.split(' ');
extensions.classNames = classes;
@@ -51,6 +56,7 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
if (dup) {
hash = Ember.$.extend({}, hash);
delete hash.id;
+ delete hash.tag;
delete hash['class'];
delete hash.classBinding;
} | true |
Other | emberjs | ember.js | b22618f9135cf08825b78bdabd83d89110061ba7.json | allow tag for tagName in the view helper | packages/ember-handlebars/tests/handlebars_test.js | @@ -1103,6 +1103,22 @@ test("{{view}} id attribute should set id on layer", function() {
equal(view.$('#bar').text(), 'baz', "emits content");
});
+test("{{view}} tag attribute should set tagName of the view", function() {
+ container.register('template', 'foo', Ember.Handlebars.compile('{{#view "TemplateTests.TagView" tag="span"}}baz{{/view}}'));
+
+ TemplateTests.TagView = Ember.View;
+
+ view = Ember.View.create({
+ container: container,
+ templateName: 'foo'
+ });
+
+ appendView();
+
+ equal(view.$('span').length, 1, "renders with tag name");
+ equal(view.$('span').text(), 'baz', "emits content");
+});
+
test("{{view}} class attribute should set class on layer", function() {
container.register('template', 'foo', Ember.Handlebars.compile('{{#view "TemplateTests.IdView" class="bar"}}baz{{/view}}'));
| true |
Other | emberjs | ember.js | b22afef0eb0358bf1ccac34db26bf28dfd69e70a.json | Fix deprecation warning in tests | packages/ember-handlebars/tests/helpers/each_test.js | @@ -286,24 +286,29 @@ test("it supports {{itemViewClass=}}", function() {
});
test("it supports {{itemViewClass=}} with tagName", function() {
- Ember.run(function() { view.destroy(); }); // destroy existing view
- view = Ember.View.create({
- template: templateFor('{{each view.people itemViewClass="MyView" tagName="ul"}}'),
- people: people
- });
+ Ember.TESTING_DEPRECATION = true;
- append(view);
+ try {
+ Ember.run(function() { view.destroy(); }); // destroy existing view
+ view = Ember.View.create({
+ template: templateFor('{{each view.people itemViewClass="MyView" tagName="ul"}}'),
+ people: people
+ });
- var html = view.$().html();
+ append(view);
- // IE 8 (and prior?) adds the \r\n
- html = html.replace(/<script[^>]*><\/script>/ig, '').replace(/[\r\n]/g, '');
- html = html.replace(/<div[^>]*><\/div>/ig, '').replace(/[\r\n]/g, '');
- html = html.replace(/<li[^>]*/ig, '<li');
+ var html = view.$().html();
- // Use lowercase since IE 8 make tagnames uppercase
- equal(html.toLowerCase(), "<ul><li>steve holt</li><li>annabelle</li></ul>");
+ // IE 8 (and prior?) adds the \r\n
+ html = html.replace(/<script[^>]*><\/script>/ig, '').replace(/[\r\n]/g, '');
+ html = html.replace(/<div[^>]*><\/div>/ig, '').replace(/[\r\n]/g, '');
+ html = html.replace(/<li[^>]*/ig, '<li');
+ // Use lowercase since IE 8 make tagnames uppercase
+ equal(html.toLowerCase(), "<ul><li>steve holt</li><li>annabelle</li></ul>");
+ } finally {
+ Ember.TESTING_DEPRECATION = false;
+ }
});
test("it supports {{itemViewClass=}} with in format", function() { | false |
Other | emberjs | ember.js | 8779648aa8d3a3f8c123e327593c8663b0d148f4.json | Remove unused variables | packages/ember-metal/lib/run_loop.js | @@ -212,8 +212,7 @@ Ember.RunLoop = RunLoop;
@return {Object} return value from invoking the passed function.
*/
Ember.run = function(target, method) {
- var loop,
- args = arguments;
+ var args = arguments;
run.begin();
function tryable() { | true |
Other | emberjs | ember.js | 8779648aa8d3a3f8c123e327593c8663b0d148f4.json | Remove unused variables | packages/ember-routing/lib/system/route.js | @@ -4,8 +4,7 @@
*/
var get = Ember.get, set = Ember.set,
- classify = Ember.String.classify,
- decamelize = Ember.String.decamelize;
+ classify = Ember.String.classify;
/**
The `Ember.Route` class is used to define individual routes. Refer to | true |
Other | emberjs | ember.js | 8779648aa8d3a3f8c123e327593c8663b0d148f4.json | Remove unused variables | packages/ember-routing/lib/system/router.js | @@ -4,7 +4,7 @@
*/
var Router = requireModule("router");
-var get = Ember.get, set = Ember.set, classify = Ember.String.classify;
+var get = Ember.get, set = Ember.set;
var DefaultView = Ember._MetamorphView;
| true |
Other | emberjs | ember.js | 8779648aa8d3a3f8c123e327593c8663b0d148f4.json | Remove unused variables | packages/ember-views/lib/system/render_buffer.js | @@ -4,11 +4,6 @@
*/
var get = Ember.get, set = Ember.set;
-var indexOf = Ember.ArrayPolyfills.indexOf;
-
-
-
-
var ClassSet = function() {
this.seen = {}; | true |
Other | emberjs | ember.js | 8779648aa8d3a3f8c123e327593c8663b0d148f4.json | Remove unused variables | packages/ember-views/lib/views/container_view.js | @@ -9,7 +9,7 @@ var states = Ember.View.cloneStates(Ember.View.states);
@submodule ember-views
*/
-var get = Ember.get, set = Ember.set, meta = Ember.meta;
+var get = Ember.get, set = Ember.set;
var forEach = Ember.EnumerableUtils.forEach;
/** | true |
Other | emberjs | ember.js | 8779648aa8d3a3f8c123e327593c8663b0d148f4.json | Remove unused variables | packages/ember-views/lib/views/states/in_buffer.js | @@ -5,7 +5,7 @@ require('ember-views/views/states/default');
@submodule ember-views
*/
-var get = Ember.get, set = Ember.set, meta = Ember.meta;
+var get = Ember.get, set = Ember.set;
var inBuffer = Ember.View.states.inBuffer = Ember.create(Ember.View.states._default);
| true |
Other | emberjs | ember.js | 8779648aa8d3a3f8c123e327593c8663b0d148f4.json | Remove unused variables | packages/ember-views/lib/views/states/in_dom.js | @@ -5,7 +5,7 @@ require('ember-views/views/states/default');
@submodule ember-views
*/
-var get = Ember.get, set = Ember.set, meta = Ember.meta;
+var get = Ember.get, set = Ember.set;
var hasElement = Ember.View.states.hasElement = Ember.create(Ember.View.states._default);
| true |
Other | emberjs | ember.js | 8779648aa8d3a3f8c123e327593c8663b0d148f4.json | Remove unused variables | packages/ember-views/lib/views/view.js | @@ -7,9 +7,8 @@ var states = {};
@submodule ember-views
*/
-var get = Ember.get, set = Ember.set, addObserver = Ember.addObserver, removeObserver = Ember.removeObserver;
-var meta = Ember.meta, guidFor = Ember.guidFor, fmt = Ember.String.fmt;
-var a_slice = [].slice;
+var get = Ember.get, set = Ember.set;
+var guidFor = Ember.guidFor;
var a_forEach = Ember.EnumerableUtils.forEach;
var a_addObject = Ember.EnumerableUtils.addObject;
| true |
Other | emberjs | ember.js | f092c6a8df521e08b94c65d8e4e5cf0af20e81b0.json | Remove old comment
Now it is wrong. | packages/ember-metal/lib/computed.js | @@ -50,7 +50,6 @@ function keysForDep(obj, depsMeta, depKey) {
return keys;
}
-/* return obj[META_KEY].deps */
function metaForDeps(obj, meta) {
return keysForDep(obj, meta, 'deps');
} | false |
Other | emberjs | ember.js | 8bad49801c34a0791a8beea3eccbaf0e4fe6d589.json | Remove unused argument | packages/ember-metal/lib/watching.js | @@ -559,7 +559,7 @@ Ember.finishChains = function(obj) {
@param {String} keyName The property key (or path) that will change.
@return {void}
*/
-function propertyWillChange(obj, keyName, value) {
+function propertyWillChange(obj, keyName) {
var m = metaFor(obj, false),
watching = m.watching[keyName] > 0 || keyName === 'length',
proto = m.proto, | false |
Other | emberjs | ember.js | 2f143e0ff0e292261915cff52a4350ba1bb4a46f.json | Use defined function to remove duplicates | packages/ember-metal/lib/computed.js | @@ -52,18 +52,7 @@ function keysForDep(obj, depsMeta, depKey) {
/* return obj[META_KEY].deps */
function metaForDeps(obj, meta) {
- var deps = meta.deps;
- // If the current object has no dependencies...
- if (!deps) {
- // initialize the dependencies with a pointer back to
- // the current object
- deps = meta.deps = {};
- } else if (!meta.hasOwnProperty('deps')) {
- // otherwise if the dependencies are inherited from the
- // object's superclass, clone the deps
- deps = meta.deps = o_create(deps);
- }
- return deps;
+ return keysForDep(obj, meta, 'deps');
}
function addDependentKeys(desc, obj, keyName, meta) { | false |
Other | emberjs | ember.js | 47cdef2b6b872a3ab894895e3f471824a18c84da.json | Remove unused variables | packages/ember-metal/lib/computed.js | @@ -14,7 +14,6 @@ Ember.warn("The CP_DEFAULT_CACHEABLE flag has been removed and computed properti
var get = Ember.get,
set = Ember.set,
metaFor = Ember.meta,
- guidFor = Ember.guidFor,
a_slice = [].slice,
o_create = Ember.create,
META_KEY = Ember.META_KEY, | true |
Other | emberjs | ember.js | 47cdef2b6b872a3ab894895e3f471824a18c84da.json | Remove unused variables | packages/ember-metal/lib/events.js | @@ -8,7 +8,6 @@ require('ember-metal/utils');
var o_create = Ember.create,
metaFor = Ember.meta,
- metaPath = Ember.metaPath,
META_KEY = Ember.META_KEY;
/* | true |
Other | emberjs | ember.js | 47cdef2b6b872a3ab894895e3f471824a18c84da.json | Remove unused variables | packages/ember-metal/lib/mixin.js | @@ -16,7 +16,6 @@ var Mixin, REQUIRED, Alias,
a_indexOf = Ember.ArrayPolyfills.indexOf,
a_forEach = Ember.ArrayPolyfills.forEach,
a_slice = [].slice,
- EMPTY_META = {}, // dummy for non-writable meta
o_create = Ember.create,
defineProperty = Ember.defineProperty,
guidFor = Ember.guidFor; | true |
Other | emberjs | ember.js | 47cdef2b6b872a3ab894895e3f471824a18c84da.json | Remove unused variables | packages/ember-metal/lib/properties.js | @@ -7,11 +7,8 @@ require('ember-metal/accessors');
@module ember-metal
*/
-var GUID_KEY = Ember.GUID_KEY,
- META_KEY = Ember.META_KEY,
- EMPTY_META = Ember.EMPTY_META,
+var META_KEY = Ember.META_KEY,
metaFor = Ember.meta,
- o_create = Ember.create,
objectDefineProperty = Ember.platform.defineProperty;
var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER; | true |
Other | emberjs | ember.js | 47cdef2b6b872a3ab894895e3f471824a18c84da.json | Remove unused variables | packages/ember-metal/lib/watching.js | @@ -19,7 +19,6 @@ var guidFor = Ember.guidFor, // utils.js
META_KEY = Ember.META_KEY, // utils.js
// circular reference observer depends on Ember.watch
// we should move change events to this file or its own property_events.js
- notifyObservers = Ember.notifyObservers, // observer.js
forEach = Ember.ArrayPolyfills.forEach, // array.js
FIRST_KEY = /^([^\.\*]+)/,
IS_PATH = /[\.\*]/; | true |
Other | emberjs | ember.js | 7ba9475a3a364a4083928ca4ac29859c73130cf5.json | Remove trailing whitespace | packages/ember-handlebars/lib/ext.js | @@ -184,7 +184,7 @@ Ember.Handlebars.registerHelper('helperMissing', function(path, options) {
## Example with bound options
- Bound hash options are also supported. Example:
+ Bound hash options are also supported. Example:
```handlebars
{{repeat text countBinding="numRepeats"}}
@@ -222,15 +222,15 @@ Ember.Handlebars.registerHelper('helperMissing', function(path, options) {
{{concatenate prop1 prop2 prop3}}. If any of the properties change,
the helpr will re-render. Note that dependency keys cannot be
using in conjunction with multi-property helpers, since it is ambiguous
- which property the dependent keys would belong to.
-
+ which property the dependent keys would belong to.
+
## Use with unbound helper
- The {{unbound}} helper can be used with bound helper invocations
+ The {{unbound}} helper can be used with bound helper invocations
to render them in their unbound form, e.g.
```handlebars
- {{unbound capitalize name}}
+ {{unbound capitalize name}}
```
In this example, if the name property changes, the helper
@@ -256,7 +256,7 @@ Ember.Handlebars.registerBoundHelper = function(name, fn) {
view = data.view,
currentContext = (options.contexts && options.contexts[0]) || this,
normalized,
- pathRoot, path,
+ pathRoot, path,
loc, hashOption;
// Detect bound options (e.g. countBinding="otherCount")
@@ -362,7 +362,7 @@ function evaluateMultiPropertyBoundHelper(context, fn, normalizedProperties, opt
// Assemble liast of watched properties that'll re-render this helper.
watchedProperties = [];
for (boundOption in boundOptions) {
- if (boundOptions.hasOwnProperty(boundOption)) {
+ if (boundOptions.hasOwnProperty(boundOption)) {
watchedProperties.push(normalizePath(context, boundOptions[boundOption], data));
}
} | true |
Other | emberjs | ember.js | 7ba9475a3a364a4083928ca4ac29859c73130cf5.json | Remove trailing whitespace | packages/ember-handlebars/lib/helpers/binding.js | @@ -375,14 +375,14 @@ EmberHandlebars.registerHelper('unless', function(context, options) {
Result in the following rendered output:
- ```html
+ ```html
<img class="aValue">
```
A boolean return value will insert a specified class name if the property
returns `true` and remove the class name if the property returns `false`.
- A class name is provided via the syntax
+ A class name is provided via the syntax
`somePropertyName:class-name-if-true`.
```javascript
@@ -541,9 +541,9 @@ EmberHandlebars.registerHelper('bindAttr', function(options) {
@method bindClasses
@for Ember.Handlebars
@param {Ember.Object} context The context from which to lookup properties
- @param {String} classBindings A string, space-separated, of class bindings
+ @param {String} classBindings A string, space-separated, of class bindings
to use
- @param {Ember.View} view The view in which observers should look for the
+ @param {Ember.View} view The view in which observers should look for the
element to update
@param {Srting} bindAttrId Optional bindAttr id used to lookup elements
@return {Array} An array of class names to add | true |
Other | emberjs | ember.js | 7ba9475a3a364a4083928ca4ac29859c73130cf5.json | Remove trailing whitespace | packages/ember-handlebars/lib/helpers/unbound.js | @@ -36,7 +36,7 @@ Ember.Handlebars.registerHelper('unbound', function(property, fn) {
// Unbound helper call.
options.data.isUnbound = true;
helper = Ember.Handlebars.helpers[arguments[0]] || Ember.Handlebars.helperMissing;
- out = helper.apply(this, Array.prototype.slice.call(arguments, 1));
+ out = helper.apply(this, Array.prototype.slice.call(arguments, 1));
delete options.data.isUnbound;
return out;
} | true |
Other | emberjs | ember.js | 7ba9475a3a364a4083928ca4ac29859c73130cf5.json | Remove trailing whitespace | packages/ember-handlebars/tests/helpers/bound_helper_test.js | @@ -37,28 +37,28 @@ test("should update bound helpers when properties change", function() {
Ember.Handlebars.registerBoundHelper('capitalize', function(value) {
return value.toUpperCase();
});
-
+
view = Ember.View.create({
controller: Ember.Object.create({name: "Brogrammer"}),
template: Ember.Handlebars.compile("{{capitalize name}}")
});
appendView();
-
+
equal(view.$().text(), 'BROGRAMMER', "helper output is correct");
-
+
Ember.run(function() {
set(view.controller, 'name', 'wes');
});
-
+
equal(view.$().text(), 'WES', "helper output updated");
});
test("should allow for computed properties with dependencies", function() {
Ember.Handlebars.registerBoundHelper('capitalizeName', function(value) {
return get(value, 'name').toUpperCase();
}, 'name');
-
+
view = Ember.View.create({
controller: Ember.Object.create({
person: Ember.Object.create({
@@ -69,27 +69,27 @@ test("should allow for computed properties with dependencies", function() {
});
appendView();
-
+
equal(view.$().text(), 'BROGRAMMER', "helper output is correct");
-
+
Ember.run(function() {
set(view.controller.person, 'name', 'wes');
});
-
+
equal(view.$().text(), 'WES', "helper output updated");
});
test("bound helpers should support options", function() {
registerRepeatHelper();
-
+
view = Ember.View.create({
controller: Ember.Object.create({text: 'ab'}),
template: Ember.Handlebars.compile("{{repeat text count=3}}")
});
appendView();
-
+
ok(view.$().text() === 'ababab', "helper output is correct");
});
@@ -112,7 +112,7 @@ test("bound helpers should support global paths", function() {
Ember.Handlebars.registerBoundHelper('capitalize', function(value) {
return value.toUpperCase();
});
-
+
TemplateTests.text = 'ab';
view = Ember.View.create({
@@ -142,14 +142,14 @@ test("bound helper should support this keyword", function() {
test("bound helpers should support bound options", function() {
registerRepeatHelper();
-
+
view = Ember.View.create({
controller: Ember.Object.create({text: 'ab', numRepeats: 3}),
template: Ember.Handlebars.compile('{{repeat text countBinding="numRepeats"}}')
});
appendView();
-
+
equal(view.$().text(), 'ababab', "helper output is correct");
Ember.run(function() {
@@ -172,14 +172,14 @@ test("bound helpers should support multiple bound properties", function() {
Ember.Handlebars.registerBoundHelper('concat', function() {
return [].slice.call(arguments, 0, -1).join('');
});
-
+
view = Ember.View.create({
controller: Ember.Object.create({thing1: 'ZOID', thing2: 'BERG'}),
template: Ember.Handlebars.compile('{{concat thing1 thing2}}')
});
appendView();
-
+
equal(view.$().text(), 'ZOIDBERG', "helper output is correct");
Ember.run(function() {
@@ -209,35 +209,35 @@ test("bound helpers should expose property names in options.data.properties", fu
}
return a.join(' ');
});
-
+
view = Ember.View.create({
controller: Ember.Object.create({
- thing1: 'ZOID',
- thing2: 'BERG',
- thing3: Ember.Object.create({
- foo: 123
+ thing1: 'ZOID',
+ thing2: 'BERG',
+ thing3: Ember.Object.create({
+ foo: 123
})
}),
template: Ember.Handlebars.compile('{{echo thing1 thing2 thing3.foo}}')
});
appendView();
-
+
equal(view.$().text(), 'thing1 thing2 thing3.foo', "helper output is correct");
});
test("bound helpers can be invoked with zero args", function() {
Ember.Handlebars.registerBoundHelper('troll', function(options) {
return options.hash.text || "TROLOLOL";
});
-
+
view = Ember.View.create({
controller: Ember.Object.create({trollText: "yumad"}),
template: Ember.Handlebars.compile('{{troll}} and {{troll text="bork"}}')
});
appendView();
-
+
equal(view.$().text(), 'TROLOLOL and bork', "helper output is correct");
});
| true |
Other | emberjs | ember.js | 7ba9475a3a364a4083928ca4ac29859c73130cf5.json | Remove trailing whitespace | packages/ember-metal/lib/accessors.js | @@ -29,7 +29,7 @@ var FIRST_KEY = /^([^\.\*]+)/;
If you plan to run on IE8 and older browsers then you should use this
method anytime you want to retrieve a property on an object that you don't
- know for sure is private. (Properties beginning with an underscore '_'
+ know for sure is private. (Properties beginning with an underscore '_'
are considered private.)
On all newer browsers, you only need to use this method to retrieve
@@ -91,7 +91,7 @@ get = function get(obj, keyName) {
If you plan to run on IE8 and older browsers then you should use this
method anytime you want to set a property on an object that you don't
- know for sure is private. (Properties beginning with an underscore '_'
+ know for sure is private. (Properties beginning with an underscore '_'
are considered private.)
On all newer browsers, you only need to use this method to set | true |
Other | emberjs | ember.js | 7ba9475a3a364a4083928ca4ac29859c73130cf5.json | Remove trailing whitespace | packages/ember-metal/lib/map.js | @@ -323,7 +323,7 @@ var MapWithDefault = Ember.MapWithDefault = function(options) {
@static
@param [options]
@param {anything} [options.defaultValue]
- @return {Ember.MapWithDefault|Ember.Map} If options are passed, returns
+ @return {Ember.MapWithDefault|Ember.Map} If options are passed, returns
`Ember.MapWithDefault` otherwise returns `Ember.Map`
*/
MapWithDefault.create = function(options) { | true |
Other | emberjs | ember.js | 7ba9475a3a364a4083928ca4ac29859c73130cf5.json | Remove trailing whitespace | packages/ember-metal/lib/mixin.js | @@ -387,7 +387,7 @@ Ember.anyUnprocessedMixins = false;
/**
Creates an instance of a class. Accepts either no arguments, or an object
containing values to initialize the newly instantiated object with.
-
+
```javascript
App.Person = Ember.Object.extend({
helloWorld: function() { | true |
Other | emberjs | ember.js | 7ba9475a3a364a4083928ca4ac29859c73130cf5.json | Remove trailing whitespace | packages/ember-metal/lib/run_loop.js | @@ -196,7 +196,7 @@ Ember.RunLoop = RunLoop;
```javascript
Ember.run(function(){
- // code to be execute within a RunLoop
+ // code to be execute within a RunLoop
});
```
@@ -235,7 +235,7 @@ var run = Ember.run;
```javascript
Ember.run.begin();
- // code to be execute within a RunLoop
+ // code to be execute within a RunLoop
Ember.run.end();
```
@@ -253,7 +253,7 @@ Ember.run.begin = function() {
```javascript
Ember.run.begin();
- // code to be execute within a RunLoop
+ // code to be execute within a RunLoop
Ember.run.end();
```
@@ -417,8 +417,8 @@ function invokeLaterTimers() {
}
// schedule next timeout to fire when the earliest timer expires
- if (earliest > 0) {
- scheduledLater = setTimeout(invokeLaterTimers, earliest - now);
+ if (earliest > 0) {
+ scheduledLater = setTimeout(invokeLaterTimers, earliest - now);
scheduledLaterExpires = earliest;
}
});
@@ -469,18 +469,18 @@ Ember.run.later = function(target, method) {
timer = { target: target, method: method, expires: expires, args: args };
guid = Ember.guidFor(timer);
timers[guid] = timer;
-
+
if(scheduledLater && expires < scheduledLaterExpires) {
// Cancel later timer (then reschedule earlier timer below)
clearTimeout(scheduledLater);
scheduledLater = null;
}
- if (!scheduledLater) {
+ if (!scheduledLater) {
// Schedule later timers to be run.
scheduledLater = setTimeout(invokeLaterTimers, wait);
scheduledLaterExpires = expires;
- }
+ }
return guid;
};
@@ -536,19 +536,19 @@ function scheduleOnce(queue, target, method, args) {
// doFoo will only be executed once at the end of the RunLoop
});
```
-
+
Also note that passing an anonymous function to `Ember.run.once` will
- not prevent additional calls with an identical anonymous function from
+ not prevent additional calls with an identical anonymous function from
scheduling the items multiple times, e.g.:
-
+
```javascript
function scheduleIt() {
Ember.run.once(myContext, function() { console.log("Closure"); });
}
scheduleIt();
scheduleIt();
// "Closure" will print twice, even though we're using `Ember.run.once`,
- // because the function we pass to it is anonymous and won't match the
+ // because the function we pass to it is anonymous and won't match the
// previously scheduled operation.
```
@@ -570,7 +570,7 @@ Ember.run.scheduleOnce = function(queue, target, method, args) {
/**
Schedules an item to run after control has been returned to the system.
- This is equivalent to calling `Ember.run.later` with a wait time of 1ms.
+ This is equivalent to calling `Ember.run.later` with a wait time of 1ms.
```javascript
Ember.run.next(myContext, function(){ | true |
Other | emberjs | ember.js | 7ba9475a3a364a4083928ca4ac29859c73130cf5.json | Remove trailing whitespace | packages/ember-metal/tests/run_loop/later_test.js | @@ -60,19 +60,19 @@ asyncTest('should always invoke within a separate runloop', function() {
var obj = { invoked: 0 }, firstRunLoop, secondRunLoop;
Ember.run(function() {
- firstRunLoop = Ember.run.currentRunLoop;
+ firstRunLoop = Ember.run.currentRunLoop;
- Ember.run.later(obj, function(amt) {
- this.invoked += amt;
+ Ember.run.later(obj, function(amt) {
+ this.invoked += amt;
secondRunLoop = Ember.run.currentRunLoop;
}, 10, 1);
// Synchronous "sleep". This simulates work being done
// after run.later was called but before the run loop
// has flushed. In previous versions, this would have
// caused the run.later callback to have run from
- // within the run loop flush, since by the time the
- // run loop has to flush, it would have considered
+ // within the run loop flush, since by the time the
+ // run loop has to flush, it would have considered
// the timer already expired.
var pauseUntil = +new Date() + 100;
while(+new Date() < pauseUntil) { /* do nothing - sleeping */ }
@@ -143,12 +143,12 @@ asyncTest('inception calls to run.later should run callbacks in separate run loo
ok(runLoop);
Ember.run.later(function() {
- ok(Ember.run.currentRunLoop && Ember.run.currentRunLoop !== runLoop,
+ ok(Ember.run.currentRunLoop && Ember.run.currentRunLoop !== runLoop,
'first later callback has own run loop');
runLoop = Ember.run.currentRunLoop;
Ember.run.later(function() {
- ok(Ember.run.currentRunLoop && Ember.run.currentRunLoop !== runLoop,
+ ok(Ember.run.currentRunLoop && Ember.run.currentRunLoop !== runLoop,
'second later callback has own run loop');
finished = true;
}, 40); | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.