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 | 43d342e794d2c5bcd7e6a0b2e0c1cb252b752261.json | Use local npm packages for defeatureify.
Update to the latest `ember-dev` which requires `defeatureify` and
`yuidocjs` to be installed locally (previously these were required to be
global).
Also, adds a `package.json` to make installing as simple as `npm install`. | package.json | @@ -0,0 +1,6 @@
+{
+ "devDependencies": {
+ "defeatureify": "~0.1.4",
+ "yuidocjs": "~0.3.46"
+ }
+} | true |
Other | emberjs | ember.js | 35ac0f429acbe41d3f80155b369b99efdd760f62.json | Add test for Function.prototype.property. | packages/ember-runtime/tests/ext/function_test.js | @@ -79,3 +79,30 @@ testBoth('can be chained with observes', function(get, set) {
obj.trigger('bar');
equal(get(obj, 'count'), 2, 'should invoke observer and listener');
});
+
+module('Function.prototype.property() helper');
+
+testBoth('sets up a ComputedProperty', function(get, set) {
+
+ if (Ember.EXTEND_PROTOTYPES === false) {
+ ok('Function.prototype helper disabled');
+ return ;
+ }
+
+ var MyClass = Ember.Object.extend({
+ firstName: null,
+ lastName: null,
+ fullName: function() {
+ return get(this, 'firstName') + ' ' + get(this, 'lastName');
+ }.property('firstName', 'lastName')
+ });
+
+ var obj = MyClass.create({firstName: 'Fred', lastName: 'Flinstone'});
+ equal(get(obj, 'fullName'), 'Fred Flinstone', 'should return the computed value');
+
+ set(obj, 'firstName', "Wilma");
+ equal(get(obj, 'fullName'), 'Wilma Flinstone', 'should return the new computed value');
+
+ set(obj, 'lastName', "");
+ equal(get(obj, 'fullName'), 'Wilma ', 'should return the new computed value');
+}); | false |
Other | emberjs | ember.js | 9c675b4740b3328bca4056050d9d3dfb331cc1fc.json | Use matrix builds. | .travis.yml | @@ -8,7 +8,7 @@ install:
- "npm install -g yuidocjs"
- "bundle install --deployment"
after_success: bundle exec rake publish_build
-script: rake test\[standard]
+script: rake test\[$TEST_SUITE]
notifications:
campfire:
rooms:
@@ -32,3 +32,8 @@ env:
PZ8DNTxX0zsp2jjY8NwTR5MC8NBH+J5VjuTSGv82t5sm0i0jzaBmOOSLbKqH
I/BFT0MbnR6JVCZiPV7TCWPgY1gvgZ6TEEIKGqauDMUBdL8ZK6I='
+ matrix:
+ - TEST_SUITE=packages
+ - TEST_SUITE=old_jquery
+ - TEST_SUITE=extend_prototypes
+ - TEST_SUITE=built | true |
Other | emberjs | ember.js | 9c675b4740b3328bca4056050d9d3dfb331cc1fc.json | Use matrix builds. | ember-dev.yml | @@ -2,6 +2,14 @@
name: Ember
assetfile: 'Assetfile'
testing_suites:
+ packages:
+ - "EACH_PACKAGE"
+ old_jquery:
+ - "package=all&jquery=1.7.2&nojshint=true"
+ - "package=all&jquery=1.7.2&nojshint=true&enableallfeatures=true"
+ extend_prototypes:
+ - "package=all&extendprototypes=true&nojshint=true"
+ - "package=all&extendprototypes=true&nojshint=true&enableallfeatures=true"
built:
- "package=all&skipPackage=container&dist=build&nojshint=true" # container isn't publicly available in the built version
runtime: | true |
Other | emberjs | ember.js | dd019796722a28b0ecf84142014c5b1b6ecd1f42.json | Add features.json to mirror beta enabled features. | features.json | @@ -0,0 +1,14 @@
+{
+ "ember-routing-didTransition-hook": true,
+ "ember-routing-loading-error-substates": true,
+ "ember-runtime-sortBy": true,
+ "container-renderables": true,
+ "link-to-non-block": true,
+ "reduceComputedSelf": true,
+ "ember-testing-wait-hooks": null,
+ "query-params": null,
+ "string-humanize": null,
+ "propertyBraceExpansion": null,
+ "ember-runtime-sortBy": null,
+ "ember-routing-loading-error-substates": null
+} | false |
Other | emberjs | ember.js | 86266b27607cafa7678f45cb7047e4a7d974b0fd.json | Remove old require | packages/ember-routing/lib/helpers.js | @@ -3,4 +3,3 @@ require('ember-routing/helpers/link_to');
require('ember-routing/helpers/outlet');
require('ember-routing/helpers/render');
require('ember-routing/helpers/action');
-require('ember-routing/helpers/control'); | false |
Other | emberjs | ember.js | 2b68585db02795a43a434e03c32348d60efade51.json | Try something else to fix Travis build | Gemfile.lock | @@ -27,7 +27,7 @@ GIT
PATH
remote: .
specs:
- ember-source (1.1.0)
+ ember-source (1.3.0.beta.1.canary)
handlebars-source (= 1.0.12)
GEM | false |
Other | emberjs | ember.js | a0c3321c6f4a5442a7ff2130f3925fc10aa7a2a9.json | Fix typo in route.js
 | packages/ember-routing/lib/system/route.js | @@ -845,6 +845,7 @@ Ember.Route = Ember.Object.extend(Ember.ActionHandler, {
instance would be used.
Example
+
```js
App.PostRoute = Ember.Route.extend({
setupController: function(controller, model) { | false |
Other | emberjs | ember.js | 3d8d23af6d9f1387ee37d9588bd567704730ee21.json | Use consistent versioning.
Update to latest `ember-dev` and utilize a consistent version number for
all builds. This means that the version comment and the `Ember.VERSION`
constant will be the same.
The `/VERSION` file in each branches directory will indicate the next
tagged release version along with custom metadata (`+pre` for release/beta and
`+canary` for master) indicating it is a prerelease version.
See
https://github.com/emberjs/ember-dev/commit/4018355f5ee9c2dd0533e78c9cfa15dd72497096
for a more complete explanation. | Assetfile | @@ -60,6 +60,7 @@ distros.each do |name, modules|
filter EmberDefeatureify
end
filter AddMicroLoader unless name == "ember-template-compiler"
+ filter AddProjectVersionNumber
end
# Add debug to the main distro | true |
Other | emberjs | ember.js | 3d8d23af6d9f1387ee37d9588bd567704730ee21.json | Use consistent versioning.
Update to latest `ember-dev` and utilize a consistent version number for
all builds. This means that the version comment and the `Ember.VERSION`
constant will be the same.
The `/VERSION` file in each branches directory will indicate the next
tagged release version along with custom metadata (`+pre` for release/beta and
`+canary` for master) indicating it is a prerelease version.
See
https://github.com/emberjs/ember-dev/commit/4018355f5ee9c2dd0533e78c9cfa15dd72497096
for a more complete explanation. | Gemfile.lock | @@ -1,6 +1,6 @@
GIT
remote: https://github.com/emberjs/ember-dev.git
- revision: b0b12c4758e264db45ef1e9d804105e6b3daeca1
+ revision: a71fb819341c94df0bde8bedda7ccae5e089c913
branch: master
specs:
ember-dev (0.1)
@@ -27,7 +27,7 @@ GIT
PATH
remote: .
specs:
- ember-source (1.0.0)
+ ember-source (1.2.0.betabeta)
handlebars-source (= 1.0.12)
GEM
@@ -48,10 +48,10 @@ GEM
mime-types (~> 1.15)
posix-spawn (~> 0.3.6)
handlebars-source (1.0.12)
- json (1.8.0)
+ json (1.8.1)
kicker (2.6.1)
listen
- listen (2.1.0)
+ listen (2.1.1)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9) | true |
Other | emberjs | ember.js | 3d8d23af6d9f1387ee37d9588bd567704730ee21.json | Use consistent versioning.
Update to latest `ember-dev` and utilize a consistent version number for
all builds. This means that the version comment and the `Ember.VERSION`
constant will be the same.
The `/VERSION` file in each branches directory will indicate the next
tagged release version along with custom metadata (`+pre` for release/beta and
`+canary` for master) indicating it is a prerelease version.
See
https://github.com/emberjs/ember-dev/commit/4018355f5ee9c2dd0533e78c9cfa15dd72497096
for a more complete explanation. | VERSION | @@ -1 +1 @@
-1.0.0
+1.2.0-beta.1+canary | true |
Other | emberjs | ember.js | 3d8d23af6d9f1387ee37d9588bd567704730ee21.json | Use consistent versioning.
Update to latest `ember-dev` and utilize a consistent version number for
all builds. This means that the version comment and the `Ember.VERSION`
constant will be the same.
The `/VERSION` file in each branches directory will indicate the next
tagged release version along with custom metadata (`+pre` for release/beta and
`+canary` for master) indicating it is a prerelease version.
See
https://github.com/emberjs/ember-dev/commit/4018355f5ee9c2dd0533e78c9cfa15dd72497096
for a more complete explanation. | packages/ember-metal/lib/core.js | @@ -49,10 +49,10 @@ Ember.toString = function() { return "Ember"; };
/**
@property VERSION
@type String
- @default '1.0.0'
+ @default 'VERSION_STRING_PLACEHOLDER'
@final
*/
-Ember.VERSION = '1.0.0';
+Ember.VERSION = 'VERSION_STRING_PLACEHOLDER';
/**
Standard environmental variables. You can define these in a global `ENV` | true |
Other | emberjs | ember.js | 87d5b06491b010b95c7cc94ba4c7a1353a18bc42.json | Fix component name in documentation example | packages/ember-handlebars/lib/helpers/yield.js | @@ -64,11 +64,11 @@ var get = Ember.get, set = Ember.set;
<!-- application.hbs -->
{{#labeled-textfield value=someProperty}}
First name:
- {{/my-component}}
+ {{/labeled-textfield}}
```
```handlebars
- <!-- components/my-component.hbs -->
+ <!-- components/labeled-textfield.hbs -->
<label>
{{yield}} {{input value=value}}
</label> | false |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-handlebars/lib/controls/select.js | @@ -42,25 +42,25 @@ Ember.SelectOption = Ember.View.extend({
}
}).property('content', 'parentView.selection'),
- labelPathDidChange: Ember.observer(function() {
+ labelPathDidChange: Ember.observer('parentView.optionLabelPath', 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() {
+ valuePathDidChange: Ember.observer('parentView.optionValuePath', 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')
+ })
});
Ember.SelectOptgroup = Ember.CollectionView.extend({
@@ -489,7 +489,7 @@ Ember.Select = Ember.View.extend(
}
},
- selectionDidChange: Ember.observer(function() {
+ selectionDidChange: Ember.observer('selection.@each', function() {
var selection = get(this, 'selection');
if (get(this, 'multiple')) {
if (!isArray(selection)) {
@@ -500,9 +500,9 @@ Ember.Select = Ember.View.extend(
} else {
this._selectionDidChangeSingle();
}
- }, 'selection.@each'),
+ }),
- valueDidChange: Ember.observer(function() {
+ valueDidChange: Ember.observer('value', function() {
var content = get(this, 'content'),
value = get(this, 'value'),
valuePath = get(this, 'optionValuePath').replace(/^content\.?/, ''),
@@ -516,7 +516,7 @@ Ember.Select = Ember.View.extend(
this.set('selection', selection);
}
- }, 'value'),
+ }),
_triggerChange: function() { | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-handlebars/lib/controls/text_area.js | @@ -34,14 +34,14 @@ Ember.TextArea = Ember.Component.extend(Ember.TextSupport, {
rows: null,
cols: null,
- _updateElementValue: Ember.observer(function() {
+ _updateElementValue: Ember.observer('value', function() {
// We do this check so cursor position doesn't get affected in IE
var value = get(this, 'value'),
$el = this.$();
if ($el && value !== $el.val()) {
$el.val(value);
}
- }, 'value'),
+ }),
init: function() {
this._super(); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-handlebars/tests/views/metamorph_view_test.js | @@ -169,9 +169,9 @@ test("replacing a Metamorph should invalidate childView elements", function() {
this.get('element');
},
- elementDidChange: Ember.observer(function() {
+ elementDidChange: Ember.observer('element', function() {
elementOnDidChange = this.get('element');
- }, 'element'),
+ }),
didInsertElement: function() {
elementOnDidInsert = this.get('element'); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-metal/tests/accessors/get_test.js | @@ -72,9 +72,9 @@ test('(regression) watched properties on unmodified inherited objects should sti
var MyMixin = Ember.Mixin.create({
someProperty: 'foo',
- propertyDidChange: Ember.observer(function() {
+ propertyDidChange: Ember.observer('someProperty', function() {
// NOTHING TO DO
- }, 'someProperty')
+ })
});
var baseObject = MyMixin.apply({});
@@ -151,9 +151,9 @@ test('(regression) watched properties on unmodified inherited objects should sti
var MyMixin = Ember.Mixin.create({
someProperty: 'foo',
- propertyDidChange: Ember.observer(function() {
+ propertyDidChange: Ember.observer('someProperty', function() {
// NOTHING TO DO
- }, 'someProperty')
+ })
});
var baseObject = MyMixin.apply({}); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-metal/tests/mixin/observer_test.js | @@ -10,9 +10,9 @@ testBoth('global observer helper', function(get, set) {
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar')
+ })
});
@@ -29,9 +29,9 @@ testBoth('global observer helper takes multiple params', function(get, set) {
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar', 'baz', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar', 'baz')
+ })
});
@@ -50,16 +50,16 @@ testBoth('replacing observer should remove old observer', function(get, set) {
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar')
+ })
});
var Mixin2 = Ember.Mixin.create({
- foo: Ember.observer(function() {
+ foo: Ember.observer('baz', function() {
set(this, 'count', get(this, 'count')+10);
- }, 'baz')
+ })
});
var obj = Ember.mixin({}, MyMixin, Mixin2);
@@ -79,9 +79,9 @@ testBoth('observing chain with property before', function(get, set) {
var MyMixin = Ember.Mixin.create({
count: 0,
bar: obj2,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar.baz', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar.baz')
+ })
});
var obj = Ember.mixin({}, MyMixin);
@@ -96,9 +96,9 @@ testBoth('observing chain with property after', function(get, set) {
var MyMixin = Ember.Mixin.create({
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar.baz', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar.baz'),
+ }),
bar: obj2
});
@@ -115,9 +115,9 @@ testBoth('observing chain with property in mixin applied later', function(get, s
var MyMixin = Ember.Mixin.create({
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar.baz', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar.baz')
+ })
});
var MyMixin2 = Ember.Mixin.create({bar: obj2});
@@ -137,9 +137,9 @@ testBoth('observing chain with existing property', function(get, set) {
var MyMixin = Ember.Mixin.create({
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar.baz', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar.baz')
+ })
});
var obj = Ember.mixin({bar: obj2}, MyMixin);
@@ -155,9 +155,9 @@ testBoth('observing chain with property in mixin before', function(get, set) {
var MyMixin = Ember.Mixin.create({
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar.baz', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar.baz')
+ })
});
var obj = Ember.mixin({}, MyMixin2, MyMixin);
@@ -173,9 +173,9 @@ testBoth('observing chain with property in mixin after', function(get, set) {
var MyMixin = Ember.Mixin.create({
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar.baz', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar.baz')
+ })
});
var obj = Ember.mixin({}, MyMixin, MyMixin2);
@@ -193,9 +193,9 @@ testBoth('observing chain with overriden property', function(get, set) {
var MyMixin = Ember.Mixin.create({
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar.baz', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar.baz')
+ })
});
var obj = Ember.mixin({bar: obj2}, MyMixin, MyMixin2); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-metal/tests/observer_test.js | @@ -527,13 +527,13 @@ testBoth('local observers can be removed', function(get, set) {
var barObserved = 0;
var MyMixin = Ember.Mixin.create({
- foo1: Ember.observer(function() {
+ foo1: Ember.observer('bar', function() {
barObserved++;
- }, 'bar'),
+ }),
- foo2: Ember.observer(function() {
+ foo2: Ember.observer('bar', function() {
barObserved++;
- }, 'bar')
+ })
});
var obj = {}; | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-metal/tests/watching/isWatching_test.js | @@ -14,7 +14,7 @@ var testObserver = function(setup, teardown, key) {
test("isWatching is true for regular local observers", function() {
testObserver(function(obj, key, fn) {
Ember.Mixin.create({
- didChange: Ember.observer(fn, key)
+ didChange: Ember.observer(key, fn)
}).apply(obj);
}, function(obj, key, fn) {
Ember.removeObserver(obj, key, obj, fn); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/lib/mixins/sortable.js | @@ -183,12 +183,12 @@ Ember.SortableMixin = Ember.Mixin.create(Ember.MutableEnumerable, {
this._lastSortAscending = get(this, 'sortAscending');
}, 'sortAscending'),
- sortAscendingDidChange: Ember.observer(function() {
+ sortAscendingDidChange: Ember.observer('sortAscending', function() {
if (get(this, 'sortAscending') !== this._lastSortAscending) {
var arrangedContent = get(this, 'arrangedContent');
arrangedContent.reverseObjects();
}
- }, 'sortAscending'),
+ }),
contentArrayWillChange: function(array, idx, removedCount, addedCount) {
var isSorted = get(this, 'isSorted'); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/lib/system/array_proxy.js | @@ -136,13 +136,13 @@ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,/** @scope Ember.Array
@method _contentDidChange
*/
- _contentDidChange: Ember.observer(function() {
+ _contentDidChange: Ember.observer('content', function() {
var content = get(this, 'content');
Ember.assert("Can't set ArrayProxy's content to itself", content !== this);
this._setupContent();
- }, 'content'),
+ }),
_setupContent: function() {
var content = get(this, 'content');
@@ -165,7 +165,7 @@ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,/** @scope Ember.Array
this._teardownArrangedContent(arrangedContent);
}, 'arrangedContent'),
- _arrangedContentDidChange: Ember.observer(function() {
+ _arrangedContentDidChange: Ember.observer('arrangedContent', function() {
var arrangedContent = get(this, 'arrangedContent'),
len = arrangedContent ? get(arrangedContent, 'length') : 0;
@@ -175,7 +175,7 @@ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,/** @scope Ember.Array
this.arrangedContentDidChange(this);
this.arrangedContentArrayDidChange(this, 0, undefined, len);
- }, 'arrangedContent'),
+ }),
_setupArrangedContent: function() {
var arrangedContent = get(this, 'arrangedContent'); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/lib/system/object_proxy.js | @@ -105,9 +105,9 @@ Ember.ObjectProxy = Ember.Object.extend(/** @scope Ember.ObjectProxy.prototype *
@default null
*/
content: null,
- _contentDidChange: Ember.observer(function() {
+ _contentDidChange: Ember.observer('content', function() {
Ember.assert("Can't set ObjectProxy's content to itself", this.get('content') !== this);
- }, 'content'),
+ }),
isTruthy: Ember.computed.bool('content'),
| true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/computed/reduce_computed_macros_test.js | @@ -1185,9 +1185,9 @@ module('Chaining array and reduced CPs', {
array: Ember.A([{ v: 1 }, { v: 3}, { v: 2 }, { v: 1 }]),
mapped: Ember.computed.mapBy('array', 'v'),
max: Ember.computed.max('mapped'),
- maxDidChange: Ember.observer(function(){
+ maxDidChange: Ember.observer('max', function(){
userFnCalls++;
- },'max')
+ })
});
});
}, | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js | @@ -660,13 +660,13 @@ module("Observable objects & object properties ", {
this.abnormal = 'changedValueObserved';
},
- testObserver: Ember.observer(function() {
+ testObserver: Ember.observer('normal', function() {
this.abnormal = 'removedObserver';
- }, 'normal'),
+ }),
- testArrayObserver: Ember.observer(function() {
+ testArrayObserver: Ember.observer('normalArray.[]', function() {
this.abnormal = 'notifiedObserver';
- }, 'normalArray.[]')
+ })
});
} | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/legacy_1x/mixins/observable/propertyChanges_test.js | @@ -28,20 +28,20 @@ module("object.propertyChanges", {
foo : 'fooValue',
prop : 'propValue',
- action: Ember.observer(function() {
+ action: Ember.observer('foo', function() {
this.set('prop', 'changedPropValue');
- }, 'foo'),
+ }),
newFoo : 'newFooValue',
newProp: 'newPropValue',
- notifyAction: Ember.observer(function() {
+ notifyAction: Ember.observer('newFoo', function() {
this.set('newProp', 'changedNewPropValue');
- }, 'newFoo'),
+ }),
- notifyAllAction: Ember.observer(function() {
+ notifyAllAction: Ember.observer('prop', function() {
this.set('newFoo', 'changedNewFooValue');
- }, 'prop'),
+ }),
starProp: null,
starObserver: function(target, key, value, rev) { | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/legacy_1x/system/binding_test.js | @@ -86,11 +86,11 @@ test("deferred observing during bindings", function() {
callCount: 0,
- observer: Ember.observer(function() {
+ observer: Ember.observer('value1', 'value2', function() {
equal(get(this, 'value1'), 'CHANGED', 'value1 when observer fires');
equal(get(this, 'value2'), 'CHANGED', 'value2 when observer fires');
this.callCount++;
- }, 'value1', 'value2')
+ })
});
var root = { fromObject: fromObject, toObject: toObject };
@@ -166,9 +166,9 @@ module("chained binding", {
input: 'second',
output: 'second',
- inputDidChange: Ember.observer(function() {
+ inputDidChange: Ember.observer("input", function() {
set(this, "output", get(this, "input")) ;
- }, "input")
+ })
}) ;
third = Ember.Object.create({ input: "third" }) ; | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/legacy_1x/system/object/base_test.js | @@ -76,17 +76,17 @@ module("Ember.Object observers", {
prop1: null,
// normal observer
- observer: Ember.observer(function() {
+ observer: Ember.observer("prop1", function() {
this._normal = true;
- }, "prop1"),
+ }),
- globalObserver: Ember.observer(function() {
+ globalObserver: Ember.observer("TestNamespace.obj.value", function() {
this._global = true;
- }, "TestNamespace.obj.value"),
+ }),
- bothObserver: Ember.observer(function() {
+ bothObserver: Ember.observer("prop1", "TestNamespace.obj.value", function() {
this._both = true;
- }, "prop1", "TestNamespace.obj.value")
+ })
});
} | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/legacy_1x/system/run_loop_test.js | @@ -25,9 +25,9 @@ module("System:run_loop() - chained binding", {
input: 'MyApp.second',
output: 'MyApp.second',
- inputDidChange: Ember.observer(function() {
+ inputDidChange: Ember.observer("input", function() {
this.set("output", this.get("input")) ;
- }, "input")
+ })
}) ;
| true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/mixins/array_test.js | @@ -110,9 +110,9 @@ test('should notify observers of []', function() {
obj = DummyArray.createWithMixins({
_count: 0,
- enumerablePropertyDidChange: Ember.observer(function() {
+ enumerablePropertyDidChange: Ember.observer('[]', function() {
this._count++;
- }, '[]')
+ })
});
equal(obj._count, 0, 'should not have invoked yet');
@@ -132,9 +132,9 @@ module('notify observers of length', {
setup: function() {
obj = DummyArray.createWithMixins({
_after: 0,
- lengthDidChange: Ember.observer(function() {
+ lengthDidChange: Ember.observer('length', function() {
this._after++;
- }, 'length')
+ })
});
@@ -443,9 +443,9 @@ testBoth("observers that contain @each in the path should fire only once the fir
set(this, 'resources', Ember.A());
},
- commonDidChange: Ember.observer(function() {
+ commonDidChange: Ember.observer('resources.@each.common', function() {
count++;
- }, 'resources.@each.common')
+ })
});
// Observer fires second time when new object is added | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/mixins/enumerable_test.js | @@ -120,9 +120,9 @@ test('should notify observers of []', function() {
nextObject: function() {}, // avoid exceptions
_count: 0,
- enumerablePropertyDidChange: Ember.observer(function() {
+ enumerablePropertyDidChange: Ember.observer('[]', function() {
this._count++;
- }, '[]')
+ })
});
equal(obj._count, 0, 'should not have invoked yet');
@@ -140,9 +140,9 @@ module('notify observers of length', {
setup: function() {
obj = DummyEnum.createWithMixins({
_after: 0,
- lengthDidChange: Ember.observer(function() {
+ lengthDidChange: Ember.observer('length', function() {
this._after++;
- }, 'length')
+ })
});
| true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/mixins/sortable_test.js | @@ -57,9 +57,9 @@ test("changing sort order triggers observers", function() {
var observer, changeCount = 0;
observer = Ember.Object.createWithMixins({
array: sortedArrayController,
- arrangedDidChange: Ember.observer(function() {
+ arrangedDidChange: Ember.observer('array.[]', function() {
changeCount++;
- }, 'array.[]')
+ })
});
equal(changeCount, 0, 'precond - changeCount starts at 0'); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/system/object/computed_test.js | @@ -159,9 +159,9 @@ testBoth("can iterate over a list of computed properties for a class", function(
}),
- fooDidChange: Ember.observer(function() {
+ fooDidChange: Ember.observer('foo', function() {
- }, 'foo'),
+ }),
bar: Ember.computed(function() {
| true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/system/object/create_test.js | @@ -23,7 +23,7 @@ test("sets up mandatory setters for watched simple properties", function() {
var MyClass = Ember.Object.extend({
foo: null,
bar: null,
- fooDidChange: Ember.observer(function() {}, 'foo')
+ fooDidChange: Ember.observer('foo', function() {})
});
var o = MyClass.create({foo: 'bar', bar: 'baz'});
@@ -213,9 +213,9 @@ test('create should not break observed values', function() {
return this;
},
- valueDidChange: Ember.observer(function() {
+ valueDidChange: Ember.observer('value', function() {
this._count++;
- }, 'value')
+ })
});
var obj = CountObject.createWithMixins({ value: 'foo' }); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/system/object/destroy_test.js | @@ -22,7 +22,7 @@ test("should raise an exception when modifying watched properties on a destroyed
if (Ember.platform.hasAccessors) {
var obj = Ember.Object.createWithMixins({
foo: "bar",
- fooDidChange: Ember.observer(function() { }, 'foo')
+ fooDidChange: Ember.observer('foo', function() { })
});
Ember.run(function() {
@@ -40,9 +40,9 @@ test("should raise an exception when modifying watched properties on a destroyed
test("observers should not fire after an object has been destroyed", function() {
var count = 0;
var obj = Ember.Object.createWithMixins({
- fooDidChange: Ember.observer(function() {
+ fooDidChange: Ember.observer('foo', function() {
count++;
- }, 'foo')
+ })
});
obj.set('foo', 'bar');
@@ -70,12 +70,12 @@ test("destroyed objects should not see each others changes during teardown but a
willDestroy: function () {
this.set('isAlive', false);
},
- bDidChange: Ember.observer(function () {
+ bDidChange: Ember.observer('objs.b.isAlive', function () {
shouldNotChange++;
- }, 'objs.b.isAlive'),
- cDidChange: Ember.observer(function () {
+ }),
+ cDidChange: Ember.observer('objs.c.isAlive', function () {
shouldNotChange++;
- }, 'objs.c.isAlive')
+ })
});
var B = Ember.Object.extend({
@@ -84,12 +84,12 @@ test("destroyed objects should not see each others changes during teardown but a
willDestroy: function () {
this.set('isAlive', false);
},
- aDidChange: Ember.observer(function () {
+ aDidChange: Ember.observer('objs.a.isAlive', function () {
shouldNotChange++;
- }, 'objs.a.isAlive'),
- cDidChange: Ember.observer(function () {
+ }),
+ cDidChange: Ember.observer('objs.c.isAlive', function () {
shouldNotChange++;
- }, 'objs.c.isAlive')
+ })
});
var C = Ember.Object.extend({
@@ -98,19 +98,19 @@ test("destroyed objects should not see each others changes during teardown but a
willDestroy: function () {
this.set('isAlive', false);
},
- aDidChange: Ember.observer(function () {
+ aDidChange: Ember.observer('objs.a.isAlive', function () {
shouldNotChange++;
- }, 'objs.a.isAlive'),
- bDidChange: Ember.observer(function () {
+ }),
+ bDidChange: Ember.observer('objs.b.isAlive', function () {
shouldNotChange++;
- }, 'objs.b.isAlive')
+ })
});
var LongLivedObject = Ember.Object.extend({
objs: objs,
- isAliveDidChange: Ember.observer(function () {
+ isAliveDidChange: Ember.observer('objs.a.isAlive', function () {
shouldChange++;
- }, 'objs.a.isAlive')
+ })
});
objs.a = new A(); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-runtime/tests/system/object/observer_test.js | @@ -10,9 +10,9 @@ testBoth('observer on class', function(get, set) {
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar')
+ })
});
@@ -30,16 +30,16 @@ testBoth('observer on subclass', function(get, set) {
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar')
+ })
});
var Subclass = MyClass.extend({
- foo: Ember.observer(function() {
+ foo: Ember.observer('baz', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'baz')
+ })
});
var obj = new Subclass();
@@ -59,9 +59,9 @@ testBoth('observer on instance', function(get, set) {
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar')
+ })
});
@@ -78,16 +78,16 @@ testBoth('observer on instance overridding class', function(get, set) {
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar')
+ })
});
var obj = MyClass.createWithMixins({
- foo: Ember.observer(function() {
+ foo: Ember.observer('baz', function() { // <-- change property we observe
set(this, 'count', get(this, 'count')+1);
- }, 'baz') // <-- change property we observe
+ })
});
equal(get(obj, 'count'), 0, 'should not invoke observer immediately');
@@ -104,9 +104,9 @@ testBoth('observer should not fire after being destroyed', function(get, set) {
var obj = Ember.Object.createWithMixins({
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar')
+ })
});
equal(get(obj, 'count'), 0, 'precond - should not invoke observer immediately');
@@ -133,9 +133,9 @@ testBoth('chain observer on class', function(get, set) {
var MyClass = Ember.Object.extend({
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar.baz', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar.baz')
+ })
});
var obj1 = MyClass.create({
@@ -164,9 +164,9 @@ testBoth('chain observer on class', function(get, set) {
var MyClass = Ember.Object.extend({
count: 0,
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar.baz', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar.baz')
+ })
});
var obj1 = MyClass.createWithMixins({
@@ -177,9 +177,9 @@ testBoth('chain observer on class', function(get, set) {
bar: { baz: 'biff2' },
bar2: { baz: 'biff3' },
- foo: Ember.observer(function() {
+ foo: Ember.observer('bar2.baz', function() {
set(this, 'count', get(this, 'count')+1);
- }, 'bar2.baz')
+ })
});
equal(get(obj1, 'count'), 0, 'should not invoke yet'); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-views/lib/system/controller.js | @@ -26,7 +26,7 @@ Ember.ControllerMixin.reopen({
set(this, '_childContainers', {});
},
- _modelDidChange: Ember.observer(function() {
+ _modelDidChange: Ember.observer('model', function() {
var containers = get(this, '_childContainers');
for (var prop in containers) {
@@ -35,5 +35,5 @@ Ember.ControllerMixin.reopen({
}
set(this, '_childContainers', {});
- }, 'model')
+ })
}); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-views/lib/views/collection_view.js | @@ -231,7 +231,7 @@ Ember.CollectionView = Ember.ContainerView.extend(/** @scope Ember.CollectionVie
@method _contentDidChange
*/
- _contentDidChange: Ember.observer(function() {
+ _contentDidChange: Ember.observer('content', function() {
var content = get(this, 'content');
if (content) {
@@ -241,7 +241,7 @@ Ember.CollectionView = Ember.ContainerView.extend(/** @scope Ember.CollectionVie
var len = content ? get(content, 'length') : 0;
this.arrayDidChange(content, 0, null, len);
- }, 'content'),
+ }),
/**
@private | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-views/lib/views/container_view.js | @@ -322,13 +322,13 @@ Ember.ContainerView = Ember.View.extend(Ember.MutableArray, {
}
}, 'currentView'),
- _currentViewDidChange: Ember.observer(function() {
+ _currentViewDidChange: Ember.observer('currentView', function() {
var currentView = get(this, 'currentView');
if (currentView) {
Ember.assert("You tried to set a current view that already has a parent. Make sure you don't have multiple outlets in the same view.", !get(currentView, '_parentView'));
this.pushObject(currentView);
}
- }, 'currentView'),
+ }),
_ensureChildrenAreInDOM: function () {
this.currentState.ensureChildrenAreInDOM(this); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember-views/lib/views/view.js | @@ -1023,9 +1023,9 @@ Ember.View = Ember.CoreView.extend(
@method _contextDidChange
*/
- _contextDidChange: Ember.observer(function() {
+ _contextDidChange: Ember.observer('context', function() {
this.rerender();
- }, 'context'),
+ }),
/**
If `false`, the view will appear hidden in DOM.
@@ -1061,12 +1061,12 @@ Ember.View = Ember.CoreView.extend(
// When it's a virtual view, we need to notify the parent that their
// childViews did change.
- _childViewsDidChange: Ember.observer(function() {
+ _childViewsDidChange: Ember.observer('childViews', function() {
if (this.isVirtual) {
var parentView = get(this, 'parentView');
if (parentView) { Ember.propertyDidChange(parentView, 'childViews'); }
}
- }, 'childViews'),
+ }),
/**
Return the nearest ancestor that is an instance of the provided
@@ -1148,25 +1148,25 @@ Ember.View = Ember.CoreView.extend(
@method _parentViewDidChange
*/
- _parentViewDidChange: Ember.observer(function() {
+ _parentViewDidChange: Ember.observer('_parentView', function() {
if (this.isDestroying) { return; }
this.trigger('parentViewDidChange');
if (get(this, 'parentView.controller') && !get(this, 'controller')) {
this.notifyPropertyChange('controller');
}
- }, '_parentView'),
+ }),
- _controllerDidChange: Ember.observer(function() {
+ _controllerDidChange: Ember.observer('controller', function() {
if (this.isDestroying) { return; }
this.rerender();
this.forEachChildView(function(view) {
view.propertyDidChange('controller');
});
- }, 'controller'),
+ }),
cloneKeywords: function() {
var templateData = get(this, 'templateData');
@@ -1769,11 +1769,11 @@ Ember.View = Ember.CoreView.extend(
@method _elementDidChange
*/
- _elementDidChange: Ember.observer(function() {
+ _elementDidChange: Ember.observer('element', function() {
this.forEachChildView(function(view) {
delete meta(view).cache.element;
});
- }, 'element'),
+ }),
/**
Called when the parentView property has changed.
@@ -2154,7 +2154,7 @@ Ember.View = Ember.CoreView.extend(
@method _isVisibleDidChange
*/
- _isVisibleDidChange: Ember.observer(function() {
+ _isVisibleDidChange: Ember.observer('isVisible', function() {
var $el = this.$();
if (!$el) { return; }
@@ -2169,7 +2169,7 @@ Ember.View = Ember.CoreView.extend(
} else {
this._notifyBecameHidden();
}
- }, 'isVisible'),
+ }),
_notifyBecameVisible: function() {
this.trigger('becameVisible'); | true |
Other | emberjs | ember.js | 22f9d48b08a96a283da2e446195c56a76b8ba580.json | Update tests with the new style for Ember.observer. | packages/ember/tests/routing/basic_test.js | @@ -115,9 +115,9 @@ test("The Homepage", function() {
var currentPath;
App.ApplicationController = Ember.Controller.extend({
- currentPathDidChange: Ember.observer(function() {
+ currentPathDidChange: Ember.observer('currentPath', function() {
currentPath = get(this, 'currentPath');
- }, 'currentPath')
+ })
});
bootApplication();
@@ -144,15 +144,15 @@ test("The Home page and the Camelot page with multiple Router.map calls", functi
var currentPath;
App.ApplicationController = Ember.Controller.extend({
- currentPathDidChange: Ember.observer(function() {
+ currentPathDidChange: Ember.observer('currentPath', function() {
currentPath = get(this, 'currentPath');
- }, 'currentPath')
+ })
});
App.CamelotController = Ember.Controller.extend({
- currentPathDidChange: Ember.observer(function() {
+ currentPathDidChange: Ember.observer('currentPath', function() {
currentPath = get(this, 'currentPath');
- }, 'currentPath')
+ })
});
bootApplication();
@@ -855,9 +855,9 @@ asyncTest("Nested callbacks are not exited when moving to siblings", function()
var currentPath;
App.ApplicationController = Ember.Controller.extend({
- currentPathDidChange: Ember.observer(function() {
+ currentPathDidChange: Ember.observer('currentPath', function() {
currentPath = get(this, 'currentPath');
- }, 'currentPath')
+ })
});
var menuItem;
@@ -2174,9 +2174,9 @@ test("ApplicationRoute with model does not proxy the currentPath", function() {
});
App.ApplicationController = Ember.ObjectController.extend({
- currentPathDidChange: Ember.observer(function() {
+ currentPathDidChange: Ember.observer('currentPath', function() {
currentPath = get(this, 'currentPath');
- }, 'currentPath')
+ })
});
bootApplication(); | true |
Other | emberjs | ember.js | dbcd947a81aca13005300637ef27701c00435de9.json | Improve error message when action bubbles | packages/ember-routing/lib/system/router.js | @@ -329,7 +329,7 @@ function triggerEvent(handlerInfos, ignoreFailure, args) {
}
if (!eventWasHandled && !ignoreFailure) {
- throw new Ember.Error("Nothing handled the event '" + name + "'.");
+ throw new Ember.Error("Nothing handled the action '" + name + "'. If you did handle the action, this error can be caused by returning true from an action handler, causing the action to bubble.");
}
}
| false |
Other | emberjs | ember.js | f61439fb16d852e46916715ec75b535b92af2cd3.json | Add tests for Application#injectTestHelpers.
Adds tests to ensure that the `onInjectHelpers` callbacks are ran, and
ensures that the tests are run in a consistent state (prior to the
`cleanup` changes here we would leak `ajaxStart` and `ajaxStop` event
handlers). | packages/ember-testing/tests/helpers_test.js | @@ -1,12 +1,23 @@
var App;
-module("ember-testing Helpers", {
- teardown: function() {
+function cleanup(){
+ if (App) {
Ember.run(App, App.destroy);
App.removeTestHelpers();
App = null;
- Ember.TEMPLATES = {};
}
+
+ Ember.run(function(){
+ Ember.$(document).off('ajaxStart');
+ Ember.$(document).off('ajaxStop');
+ });
+
+ Ember.TEMPLATES = {};
+}
+
+module("ember-testing Helpers", {
+ setup: function(){ cleanup(); },
+ teardown: function() { cleanup(); }
});
test("Ember.Application#injectTestHelpers/#removeTestHelpers", function() {
@@ -197,6 +208,49 @@ test("`click` triggers appropriate events in order", function() {
});
});
+test("Ember.Application#injectTestHelpers", function() {
+ var documentEvents;
+
+ Ember.run(function() {
+ App = Ember.Application.create();
+ App.setupForTesting();
+ });
+
+ documentEvents = Ember.$._data(document, 'events');
+
+ if (!documentEvents) {
+ documentEvents = {};
+ }
+
+ ok(documentEvents['ajaxStart'] === undefined, 'there are no ajaxStart listers setup prior to calling injectTestHelpers');
+ ok(documentEvents['ajaxStop'] === undefined, 'there are no ajaxStop listers setup prior to calling injectTestHelpers');
+
+ App.injectTestHelpers();
+ documentEvents = Ember.$._data(document, 'events');
+
+ equal(documentEvents['ajaxStart'].length, 1, 'calling injectTestHelpers registers an ajaxStart handler');
+ equal(documentEvents['ajaxStop'].length, 1, 'calling injectTestHelpers registers an ajaxStop handler');
+});
+
+test("Ember.Application#injectTestHelpers calls callbacks registered with onInjectHelpers", function(){
+ var injected = 0;
+
+ Ember.Test.onInjectHelpers(function(){
+ injected++;
+ });
+
+ Ember.run(function() {
+ App = Ember.Application.create();
+ App.setupForTesting();
+ });
+
+ equal(injected, 0, 'onInjectHelpers are not called before injectTestHelpers');
+
+ App.injectTestHelpers();
+
+ equal(injected, 1, 'onInjectHelpers are called after injectTestHelpers');
+});
+
if (Ember.FEATURES.isEnabled("ember-testing-wait-hooks")) {
test("`wait` respects registerWaiters", function() {
expect(2);
@@ -255,10 +309,7 @@ if (Ember.FEATURES.isEnabled("ember-testing-wait-hooks")) {
module("ember-testing pendingAjaxRequests", {
setup: function(){
- Ember.run(function(){
- Ember.$(document).off('ajaxStart');
- Ember.$(document).off('ajaxStop');
- });
+ cleanup();
Ember.run(function() {
App = Ember.Application.create();
@@ -268,12 +319,7 @@ module("ember-testing pendingAjaxRequests", {
App.injectTestHelpers();
},
- teardown: function() {
- Ember.run(App, App.destroy);
- App.removeTestHelpers();
- App = null;
- Ember.TEMPLATES = {};
- }
+ teardown: function() { cleanup(); }
});
test("pendingAjaxRequests is incremented on each document ajaxStart event", function() { | false |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-application/lib/system/dag.js | @@ -54,7 +54,7 @@ DAG.prototype.addEdge = function(fromName, toName) {
}
function checkCycle(vertex, path) {
if (vertex.name === toName) {
- throw new Error("cycle detected: " + toName + " <- " + path.join(" <- "));
+ throw new Ember.Error("cycle detected: " + toName + " <- " + path.join(" <- "));
}
}
visit(from, checkCycle); | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-debug/lib/main.js | @@ -50,7 +50,7 @@ Ember.assert = function(desc, test) {
if (Ember.testing && !test) {
// when testing, ensure test failures when assertions fail
- throw new Error("Assertion Failed: " + desc);
+ throw new Ember.Error("Assertion Failed: " + desc);
}
};
@@ -102,7 +102,7 @@ Ember.deprecate = function(message, test) {
if (arguments.length === 1) { test = false; }
if (test) { return; }
- if (Ember.ENV.RAISE_ON_DEPRECATION) { throw new Error(message); }
+ if (Ember.ENV.RAISE_ON_DEPRECATION) { throw new Ember.Error(message); }
var error;
| true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-handlebars/lib/loader.js | @@ -44,7 +44,7 @@ Ember.Handlebars.bootstrap = function(ctx) {
// Check if template of same name already exists
if (Ember.TEMPLATES[templateName] !== undefined) {
- throw new Error('Template named "' + templateName + '" already exists.');
+ throw new Ember.Error('Template named "' + templateName + '" already exists.');
}
// For templates which have a name, we save them and then remove them from the DOM | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-handlebars/tests/helpers/yield_test.js | @@ -328,7 +328,7 @@ test("yield with nested components (#3220)", function(){
layout: Ember.Handlebars.compile("{{yield}}"),
_yield: function (context, options) {
count++;
- if (count > 1) throw new Error('is looping');
+ if (count > 1) throw new Ember.Error('is looping');
return this._super(context, options);
}
}); | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-routing/lib/system/router.js | @@ -303,7 +303,7 @@ function triggerEvent(handlerInfos, ignoreFailure, args) {
if (!handlerInfos) {
if (ignoreFailure) { return; }
- throw new Error("Could not trigger event '" + name + "'. There are no active handlers");
+ throw new Ember.Error("Could not trigger event '" + name + "'. There are no active handlers");
}
var eventWasHandled = false;
@@ -329,7 +329,7 @@ function triggerEvent(handlerInfos, ignoreFailure, args) {
}
if (!eventWasHandled && !ignoreFailure) {
- throw new Error("Nothing handled the event '" + name + "'.");
+ throw new Ember.Error("Nothing handled the event '" + name + "'.");
}
}
| true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-runtime/lib/computed/array_computed.js | @@ -164,7 +164,7 @@ Ember.arrayComputed = function (options) {
}
if (typeof options !== "object") {
- throw new Error("Array Computed Property declared without an options hash");
+ throw new Ember.Error("Array Computed Property declared without an options hash");
}
var cp = new ArrayComputedProperty(options); | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-runtime/lib/computed/reduce_computed.js | @@ -546,7 +546,7 @@ ReduceComputedProperty.prototype.property = function () {
forEach(a_slice.call(arguments), function (dependentKey) {
if (doubleEachPropertyPattern.test(dependentKey)) {
- throw new Error("Nested @each properties not supported: " + dependentKey);
+ throw new Ember.Error("Nested @each properties not supported: " + dependentKey);
} else if (match = eachPropertyPattern.exec(dependentKey)) {
dependentArrayKey = match[1];
itemPropertyKey = match[2];
@@ -722,11 +722,11 @@ Ember.reduceComputed = function (options) {
}
if (typeof options !== "object") {
- throw new Error("Reduce Computed Property declared without an options hash");
+ throw new Ember.Error("Reduce Computed Property declared without an options hash");
}
if (!('initialValue' in options)) {
- throw new Error("Reduce Computed Property declared without an initial value");
+ throw new Ember.Error("Reduce Computed Property declared without an initial value");
}
var cp = new ReduceComputedProperty(options); | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-runtime/lib/computed/reduce_computed_macros.js | @@ -471,7 +471,7 @@ Ember.computed.intersect = function () {
*/
Ember.computed.setDiff = function (setAProperty, setBProperty) {
if (arguments.length !== 2) {
- throw new Error("setDiff requires exactly two dependent arrays.");
+ throw new Ember.Error("setDiff requires exactly two dependent arrays.");
}
return Ember.arrayComputed.call(null, setAProperty, setBProperty, {
addedItem: function (array, item, changeMeta, instanceMeta) { | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-runtime/lib/controllers/array_controller.js | @@ -201,7 +201,7 @@ Ember.ArrayController = Ember.ArrayProxy.extend(Ember.ControllerMixin,
fullName = "controller:" + controllerClass;
if (!container.has(fullName)) {
- throw new Error('Could not resolve itemController: "' + controllerClass + '"');
+ throw new Ember.Error('Could not resolve itemController: "' + controllerClass + '"');
}
subController = container.lookupFactory(fullName).create({ | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-runtime/lib/mixins/copyable.js | @@ -54,7 +54,7 @@ Ember.Copyable = Ember.Mixin.create(/** @scope Ember.Copyable.prototype */ {
if (Ember.Freezable && Ember.Freezable.detect(this)) {
return get(this, 'isFrozen') ? this : this.copy().freeze();
} else {
- throw new Error(Ember.String.fmt("%@ does not support freezing", [this]));
+ throw new Ember.Error(Ember.String.fmt("%@ does not support freezing", [this]));
}
}
}); | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-runtime/lib/mixins/mutable_array.js | @@ -89,7 +89,7 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,/**
@return this
*/
insertAt: function(idx, object) {
- if (idx > get(this, 'length')) throw new Error(OUT_OF_RANGE_EXCEPTION) ;
+ if (idx > get(this, 'length')) throw new Ember.Error(OUT_OF_RANGE_EXCEPTION) ;
this.replace(idx, 0, [object]) ;
return this ;
},
@@ -117,7 +117,7 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,/**
if ('number' === typeof start) {
if ((start < 0) || (start >= get(this, 'length'))) {
- throw new Error(OUT_OF_RANGE_EXCEPTION);
+ throw new Ember.Error(OUT_OF_RANGE_EXCEPTION);
}
// fast case | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-runtime/lib/mixins/promise_proxy.js | @@ -99,7 +99,7 @@ Ember.PromiseProxyMixin = Ember.Mixin.create({
installPromise(this, promise);
return promise;
} else {
- throw new Error("PromiseProxy's promise must be set");
+ throw new Ember.Error("PromiseProxy's promise must be set");
}
}),
| true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-runtime/lib/system/array_proxy.js | @@ -228,7 +228,7 @@ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,/** @scope Ember.Array
},
_insertAt: function(idx, object) {
- if (idx > get(this, 'content.length')) throw new Error(OUT_OF_RANGE_EXCEPTION);
+ if (idx > get(this, 'content.length')) throw new Ember.Error(OUT_OF_RANGE_EXCEPTION);
this._replace(idx, 0, [object]);
return this;
},
@@ -248,7 +248,7 @@ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,/** @scope Ember.Array
indices = [], i;
if ((start < 0) || (start >= get(this, 'length'))) {
- throw new Error(OUT_OF_RANGE_EXCEPTION);
+ throw new Ember.Error(OUT_OF_RANGE_EXCEPTION);
}
if (len === undefined) len = 1; | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-runtime/lib/system/set.js | @@ -139,7 +139,7 @@ Ember.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Emb
@return {Ember.Set} An empty Set
*/
clear: function() {
- if (this.isFrozen) { throw new Error(Ember.FROZEN_ERROR); }
+ if (this.isFrozen) { throw new Ember.Error(Ember.FROZEN_ERROR); }
var len = get(this, 'length');
if (len === 0) { return this; }
@@ -249,7 +249,7 @@ Ember.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Emb
@return {Object} The removed object from the set or null.
*/
pop: function() {
- if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);
+ if (get(this, 'isFrozen')) throw new Ember.Error(Ember.FROZEN_ERROR);
var obj = this.length > 0 ? this[this.length-1] : null;
this.remove(obj);
return obj;
@@ -366,7 +366,7 @@ Ember.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Emb
// implements Ember.MutableEnumerable
addObject: function(obj) {
- if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);
+ if (get(this, 'isFrozen')) throw new Ember.Error(Ember.FROZEN_ERROR);
if (isNone(obj)) return this; // nothing to do
var guid = guidFor(obj),
@@ -394,7 +394,7 @@ Ember.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Emb
// implements Ember.MutableEnumerable
removeObject: function(obj) {
- if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);
+ if (get(this, 'isFrozen')) throw new Ember.Error(Ember.FROZEN_ERROR);
if (isNone(obj)) return this; // nothing to do
var guid = guidFor(obj), | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-testing/lib/helpers.js | @@ -86,7 +86,7 @@ function fillIn(app, selector, context, text) {
function findWithAssert(app, selector, context) {
var $el = find(app, selector, context);
if ($el.length === 0) {
- throw new Error("Element " + selector + " not found.");
+ throw new Ember.Error("Element " + selector + " not found.");
}
return $el;
} | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-views/lib/views/container_view.js | @@ -343,7 +343,7 @@ Ember.merge(states._default, {
Ember.merge(states.inBuffer, {
childViewsDidChange: function(parentView, views, start, added) {
- throw new Error('You cannot modify child views while in the inBuffer state');
+ throw new Ember.Error('You cannot modify child views while in the inBuffer state');
}
});
| true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-views/lib/views/states/in_dom.js | @@ -97,7 +97,7 @@ Ember.merge(inDOM, {
}
view.addBeforeObserver('elementId', function() {
- throw new Error("Changing a view's elementId after creation is not allowed");
+ throw new Ember.Error("Changing a view's elementId after creation is not allowed");
});
},
| true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember-views/lib/views/view.js | @@ -32,7 +32,7 @@ var childViewsProperty = Ember.computed(function() {
Ember.deprecate("Manipulating an Ember.ContainerView through its childViews property is deprecated. Please use the ContainerView instance itself as an Ember.MutableArray.");
return view.replace(idx, removedCount, addedViews);
}
- throw new Error("childViews is immutable");
+ throw new Ember.Error("childViews is immutable");
};
return ret; | true |
Other | emberjs | ember.js | 23729d6175a2d4692b0d709133f879b9d96797d9.json | Use Ember.Error consistently. | packages/ember/lib/main.js | @@ -8,7 +8,7 @@ Ember
function throwWithMessage(msg) {
return function() {
- throw new Error(msg);
+ throw new Ember.Error(msg);
};
}
| true |
Other | emberjs | ember.js | 5c548fc5b02c95e2fb4686eb6acf92e86b7625b2.json | Add assertion upon too many ajaxStop's.
This is should have helped in #3564. | packages/ember-testing/lib/helpers.js | @@ -18,6 +18,7 @@ Test.onInjectHelpers(function() {
});
Ember.$(document).ajaxStop(function() {
+ Ember.assert("An ajaxStop event which would cause the number of pending AJAX requests to be negative has been triggered. This is most likely caused by AJAX events that were started before calling `injectTestHelpers()`.", Test.pendingAjaxRequests !== 0);
Test.pendingAjaxRequests--;
});
}); | true |
Other | emberjs | ember.js | 5c548fc5b02c95e2fb4686eb6acf92e86b7625b2.json | Add assertion upon too many ajaxStop's.
This is should have helped in #3564. | packages/ember-testing/tests/helpers_test.js | @@ -252,3 +252,56 @@ if (Ember.FEATURES.isEnabled("ember-testing-wait-hooks")) {
});
}
+
+module("ember-testing pendingAjaxRequests", {
+ setup: function(){
+ Ember.run(function(){
+ Ember.$(document).off('ajaxStart');
+ Ember.$(document).off('ajaxStop');
+ });
+
+ Ember.run(function() {
+ App = Ember.Application.create();
+ App.setupForTesting();
+ });
+
+ App.injectTestHelpers();
+ },
+
+ teardown: function() {
+ Ember.run(App, App.destroy);
+ App.removeTestHelpers();
+ App = null;
+ Ember.TEMPLATES = {};
+ }
+});
+
+test("pendingAjaxRequests is incremented on each document ajaxStart event", function() {
+ Ember.Test.pendingAjaxRequests = 0;
+
+ Ember.run(function(){
+ Ember.$(document).trigger('ajaxStart');
+ });
+
+ equal(Ember.Test.pendingAjaxRequests, 1, 'Ember.Test.pendingAjaxRequests was incremented');
+});
+
+test("pendingAjaxRequests is decremented on each document ajaxStop event", function() {
+ Ember.Test.pendingAjaxRequests = 1;
+
+ Ember.run(function(){
+ Ember.$(document).trigger('ajaxStop');
+ });
+
+ equal(Ember.Test.pendingAjaxRequests, 0, 'Ember.Test.pendingAjaxRequests was decremented');
+});
+
+test("it should raise an assertion error if ajaxStop is called without pendingAjaxRequests", function() {
+ Ember.Test.pendingAjaxRequests = 0;
+
+ expectAssertion(function() {
+ Ember.run(function(){
+ Ember.$(document).trigger('ajaxStop');
+ });
+ });
+}); | true |
Other | emberjs | ember.js | d593ed12f3bd1fce7d47dee4c116f8d98fa5e185.json | Fix another IE test issue - Issue #3525 | packages/ember/tests/helpers/link_to_test.js | @@ -973,20 +973,27 @@ test("The {{link-to}} helper works in an #each'd array of string route names", f
bootApplication();
- var $links = Ember.$('a', '#qunit-fixture');
+ function linksEqual($links, expected) {
+ equal($links.length, expected.length, "Has correct number of links");
+
+ var idx;
+ for (idx = 0; idx < $links.length; idx++) {
+ var href = Ember.$($links[idx]).attr('href');
+ // Old IE includes the whole hostname as well
+ equal(href.slice(-expected[idx].length), expected[idx], "Expected link to be '"+expected[idx]+"', but was '"+href+"'");
+ }
+ }
- deepEqual(map.call($links,function(el) { return Ember.$(el).attr('href'); }), ["/foo", "/bar", "/rar", "/foo", "/bar", "/rar", "/bar", "/foo"]);
+ linksEqual(Ember.$('a', '#qunit-fixture'), ["/foo", "/bar", "/rar", "/foo", "/bar", "/rar", "/bar", "/foo"]);
var indexController = container.lookup('controller:index');
Ember.run(indexController, 'set', 'route1', 'rar');
- $links = Ember.$('a', '#qunit-fixture');
- deepEqual(map.call($links, function(el) { return Ember.$(el).attr('href'); }), ["/foo", "/bar", "/rar", "/foo", "/bar", "/rar", "/rar", "/foo"]);
+ linksEqual(Ember.$('a', '#qunit-fixture'), ["/foo", "/bar", "/rar", "/foo", "/bar", "/rar", "/rar", "/foo"]);
Ember.run(indexController.routeNames, 'shiftObject');
- $links = Ember.$('a', '#qunit-fixture');
- deepEqual(map.call($links, function(el) { return Ember.$(el).attr('href'); }), ["/bar", "/rar", "/bar", "/rar", "/rar", "/foo"]);
+ linksEqual(Ember.$('a', '#qunit-fixture'), ["/bar", "/rar", "/bar", "/rar", "/rar", "/foo"]);
});
if (Ember.FEATURES.isEnabled('link-to-non-block')) { | false |
Other | emberjs | ember.js | 28c38ea5b7003b7e287a3e1ef54d6698410170da.json | Fix one failing IE 6/7 test - Issue #3525 | packages/ember-handlebars/tests/handlebars_test.js | @@ -2215,7 +2215,10 @@ test("should not enter an infinite loop when binding an attribute in Handlebars"
Ember.run(function() {
parentView.appendTo('#qunit-fixture');
});
- equal(parentView.$('a').attr('href'), 'test');
+
+ // Use match, since old IE appends the whole URL
+ var href = parentView.$('a').attr('href');
+ ok(href.match(/(^|\/)test$/), "Expected href to be 'test' but got '"+href+"'");
Ember.run(function() {
parentView.destroy(); | false |
Other | emberjs | ember.js | 94f4c176ee76b6615a1efd1df4d9ecb308eac142.json | Use plain ASCII for License. | generators/license.js | @@ -1,8 +1,8 @@
// ==========================================================================
// Project: Ember - JavaScript Application Framework
-// Copyright: ©2011-2013 Tilde Inc. and contributors
-// Portions ©2006-2011 Strobe Inc.
-// Portions ©2008-2011 Apple Inc. All rights reserved.
+// Copyright: Copyright 2011-2013 Tilde Inc. and contributors
+// Portions Copyright 2006-2011 Strobe Inc.
+// Portions Copyright 2008-2011 Apple Inc. All rights reserved.
// License: Licensed under MIT license
// See https://raw.github.com/emberjs/ember.js/master/LICENSE
// ========================================================================== | false |
Other | emberjs | ember.js | e26da953400f698b0401ec47b6b90ee9f01d808b.json | build rubygem beta version string correctly | lib/ember/version.rb | @@ -6,8 +6,8 @@ module Ember
# we might want to unify this with the ember version string,
# but consistency?
def rubygems_version_string
- if VERSION =~ /rc/
- major, rc = VERSION.sub('-','.').scan(/(\d+\.\d+\.\d+\.rc)\.(\d+)/).first
+ if VERSION =~ /rc|beta/
+ major, rc = VERSION.sub('-','.').scan(/(\d+\.\d+\.\d+\.(rc|beta))\.(\d+)/).first
"#{major}#{rc}"
else | false |
Other | emberjs | ember.js | 28dfe9060cfe3af5e855d140903238e09ba264eb.json | fix typo and remove commented out assertion | packages/ember-handlebars/tests/helpers/each_test.js | @@ -333,7 +333,7 @@ test("it supports {{itemView=}}", function() {
});
-test("it defers all normaization of itemView names to the resolver", function() {
+test("it defers all normalization of itemView names to the resolver", function() {
var container = new Ember.Container();
var itemView = Ember.View.extend({
@@ -356,7 +356,6 @@ test("it defers all normaization of itemView names to the resolver", function()
};
append(view);
- // assertText(view, "itemView:Steve HoltitemView:Annabelle");
});
test("it supports {{itemViewClass=}}", function() { | false |
Other | emberjs | ember.js | 3890d3c4de3f5a8e97887b74377ff3f1b0fb3645.json | Remove Route#redirect soft deprecation | packages/ember-routing/lib/system/route.js | @@ -283,7 +283,7 @@ Ember.Route = Ember.Object.extend(Ember.ActionHandler, {
Transition into another route. Optionally supply model(s) for the
route in question. If multiple models are supplied they will be applied
last to first recursively up the resource tree (see Multiple Models Example
- below). The model(s) will be serialized into the URL using the appropriate
+ below). The model(s) will be serialized into the URL using the appropriate
route's `serialize` hook. See also 'replaceWith'.
Simple Transition Example
@@ -340,7 +340,7 @@ Ember.Route = Ember.Object.extend(Ember.ActionHandler, {
/**
Transition into another route while replacing the current URL, if possible.
- This will replace the current history entry instead of adding a new one.
+ This will replace the current history entry instead of adding a new one.
Beside that, it is identical to `transitionTo` in all other respects. See
'transitionTo' for additional information regarding multiple models.
@@ -449,15 +449,15 @@ Ember.Route = Ember.Object.extend(Ember.ActionHandler, {
},
/**
- @deprecated
-
A hook you can implement to optionally redirect to another route.
If you call `this.transitionTo` from inside of this hook, this route
will not be entered in favor of the other hook.
- This hook is deprecated in favor of using the `afterModel` hook
- for performing redirects after the model has resolved.
+ Note that this hook is called by the default implementation of
+ `afterModel`, so if you override `afterModel`, you must either
+ explicitly call `redirect` or just put your redirecting
+ `this.transitionTo()` call within `afterModel`.
@method redirect
@param {Object} model the model for this route | false |
Other | emberjs | ember.js | 2eccb0a87af11e4ebbded6d0aa41c20ebf8c1f85.json | Fix incorrect var usage in replaceWith | packages/ember-routing/lib/system/route.js | @@ -368,7 +368,7 @@ Ember.Route = Ember.Object.extend(Ember.ActionHandler, {
*/
replaceWith: function() {
var router = this.router;
- return this.router.replaceWith.apply(this.router, arguments);
+ return router.replaceWith.apply(router, arguments);
},
/** | false |
Other | emberjs | ember.js | 1e54c6491a4c900822854127ae9a4166ca8e37c1.json | Fix incorrect method name in code comment
```
insertNewLine
insertNewline
^
``` | packages/ember-handlebars/lib/controls/text_support.js | @@ -95,7 +95,7 @@ Ember.TextSupport = Ember.Mixin.create({
Called by the `Ember.TextSupport` mixin on keyUp if keycode matches 13.
Uses sendAction to send the `enter` action to the controller.
- @method insertNewLine
+ @method insertNewline
@param {Event} event
*/
insertNewline: function(event) { | false |
Other | emberjs | ember.js | 9a6c4adad35153110a4e5a031899c00d654770b6.json | Update documentation for "customEvents"
The "loadedmetadata" event is no longer considered a bubbling event, and subsequently it will never be triggered. | packages/ember-application/lib/system/application.js | @@ -81,16 +81,15 @@ DeprecatedContainer.prototype = {
example, the `keypress` event causes the `keyPress` method on the view to be
called, the `dblclick` event causes `doubleClick` to be called, and so on.
- If there is a browser event that Ember does not listen for by default, you
- can specify custom events and their corresponding view method names by
- setting the application's `customEvents` property:
+ If there is a bubbling browser event that Ember does not listen for by
+ default, you can specify custom events and their corresponding view method
+ names by setting the application's `customEvents` property:
```javascript
App = Ember.Application.create({
customEvents: {
- // add support for the loadedmetadata media
- // player event
- 'loadedmetadata': "loadedMetadata"
+ // add support for the paste event
+ 'paste: "paste"
}
});
```
@@ -203,17 +202,16 @@ var Application = Ember.Application = Ember.Namespace.extend(Ember.DeferredMixin
`keyup`, and delegates them to your application's `Ember.View`
instances.
- If you would like additional events to be delegated to your
+ If you would like additional bubbling events to be delegated to your
views, set your `Ember.Application`'s `customEvents` property
to a hash containing the DOM event name as the key and the
corresponding view method name as the value. For example:
```javascript
App = Ember.Application.create({
customEvents: {
- // add support for the loadedmetadata media
- // player event
- 'loadedmetadata': "loadedMetadata"
+ // add support for the paste event
+ 'paste: "paste"
}
});
``` | false |
Other | emberjs | ember.js | 7d1d6a0c8d876f8899250ec5c8f7f2c27c1f7a58.json | Fix examples in action helper docs.
As pointed out by @michaelBenin in
https://github.com/emberjs/website/issues/956. | packages/ember-routing/lib/helpers/action.js | @@ -117,7 +117,9 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
```javascript
AController = Ember.Controller.extend({
- anActionName: function() {}
+ actions: {
+ anActionName: function() {}
+ }
});
AView = Ember.View.extend({
@@ -139,8 +141,9 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
</div>
```
- Clicking "click me" will trigger the `anActionName` method of the
- `AController`. In this case, no additional parameters will be passed.
+ Clicking "click me" will trigger the `anActionName` method in the `actions
+ hash of the `AController`. In this case, no additional parameters will be
+ passed.
If you provide additional parameters to the helper:
| false |
Other | emberjs | ember.js | cdb81fab3e9697404666c98fdaf087f616d8113f.json | Fix HistoryLocation test for static site testing. | packages/ember/tests/routing/basic_test.js | @@ -1875,7 +1875,7 @@ test("Router accounts for rootURL on page load when using history location", fun
test("HistoryLocation has the correct rootURL on initState and webkit doesn't fire popstate on page load", function() {
expect(2);
- var rootURL = window.location.pathname + 'app',
+ var rootURL = window.location.pathname,
history,
HistoryTestLocation;
| false |
Other | emberjs | ember.js | c384ba00af6ea1d8ddf85b932564d2cf57ff0b7e.json | Use constant for global guid prefix | packages/ember-metal/lib/utils.js | @@ -6,6 +6,14 @@ require('ember-metal/array');
@module ember-metal
*/
+/**
+ @private
+
+ Prefix used for guids through out Ember.
+
+*/
+Ember.GUID_PREFIX = 'ember';
+
var o_defineProperty = Ember.platform.defineProperty,
o_create = Ember.create,
@@ -60,13 +68,13 @@ var GUID_DESC = {
@return {String} the guid
*/
Ember.generateGuid = function generateGuid(obj, prefix) {
- if (!prefix) prefix = 'ember';
+ if (!prefix) prefix = Ember.GUID_PREFIX;
var ret = (prefix + (uuid++));
if (obj) {
GUID_DESC.value = ret;
o_defineProperty(obj, GUID_KEY, GUID_DESC);
}
- return ret ;
+ return ret;
};
/** | true |
Other | emberjs | ember.js | c384ba00af6ea1d8ddf85b932564d2cf57ff0b7e.json | Use constant for global guid prefix | packages/ember-metal/lib/watching.js | @@ -86,7 +86,7 @@ Ember.rewatch = function(obj) {
// make sure the object has its own guid.
if (GUID_KEY in obj && !obj.hasOwnProperty(GUID_KEY)) {
- generateGuid(obj, 'ember');
+ generateGuid(obj);
}
// make sure any chained watchers update. | true |
Other | emberjs | ember.js | c384ba00af6ea1d8ddf85b932564d2cf57ff0b7e.json | Use constant for global guid prefix | packages/ember-metal/tests/utils/generate_guid_test.js | @@ -0,0 +1,7 @@
+module("Ember.generateGuid");
+
+test("Prefix", function() {
+ var a = {};
+
+ ok( Ember.generateGuid(a, 'tyrell').indexOf('tyrell') > -1, "guid can be prefixed" );
+}); | true |
Other | emberjs | ember.js | c384ba00af6ea1d8ddf85b932564d2cf57ff0b7e.json | Use constant for global guid prefix | packages/ember-runtime/lib/system/core_object.js | @@ -494,7 +494,7 @@ var ClassMixin = Mixin.create({
proto = Class.prototype = o_create(this.prototype);
proto.constructor = Class;
- generateGuid(proto, 'ember');
+ generateGuid(proto);
meta(proto).proto = proto; // this will disable observers on prototype
Class.ClassMixin.apply(Class); | true |
Other | emberjs | ember.js | afca9715fe8ef23c9183e0b0ccaa5dbbef18287b.json | Allow setting of Ember.FEATURES via ENV.FEATURES.
This is important for FEATURES that are only active if the flag is
on during Ember eval. | packages/ember-metal/lib/core.js | @@ -80,11 +80,13 @@ Ember.config = Ember.config || {};
/**
Hash of enabled Canary features. Add to before creating your application.
+ You can also define `ENV.FEATURES` if you need to enable features flagged at runtime.
+
@property FEATURES
@type Hash
*/
-Ember.FEATURES = {};
+Ember.FEATURES = Ember.ENV.FEATURES || {};
/**
Test that a feature is enabled. Parsed by Ember's build tools to leave | false |
Other | emberjs | ember.js | 42fcb478c6fb0e42678836df2eee2896eaebd382.json | remove redundant assignment of isDestroyed | packages/container/lib/main.js | @@ -703,7 +703,6 @@ define("container",
@method destroy
*/
destroy: function() {
- this.isDestroyed = true;
for (var i=0, l=this.children.length; i<l; i++) {
this.children[i].destroy(); | false |
Other | emberjs | ember.js | 4e6d37642ecc3eec83cdf0426820c6cc7693fe9b.json | Fix typo in link-to docs. | packages/ember-routing/lib/helpers/link_to.js | @@ -493,7 +493,7 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
To override this option for your entire application, see
"Overriding Application-wide Defaults".
- ### Disabling the `link-to` heper
+ ### Disabling the `link-to` helper
By default `{{link-to}}` is enabled.
any passed value to `disabled` helper property will disable the `link-to` helper.
| false |
Other | emberjs | ember.js | d034d11591eb68be88021004e5f3de5c4cc0f4ba.json | Fix the second half of the bug in suspendListeners
If the same listener was the action for two events, this would result in
only the second event becoming un-suspended, because the first event's
actions would be overridden. | packages/ember-metal/lib/events.js | @@ -239,6 +239,7 @@ function suspendListeners(obj, eventNames, target, method, callback) {
}
var suspendedActions = [],
+ actionsList = [],
eventName, actions, i, l;
for (i=0, l=eventNames.length; i<l; i++) {
@@ -249,6 +250,7 @@ function suspendListeners(obj, eventNames, target, method, callback) {
if (actionIndex !== -1) {
actions[actionIndex+2] |= SUSPENDED;
suspendedActions.push(actionIndex);
+ actionsList.push(actions);
}
}
@@ -257,7 +259,7 @@ function suspendListeners(obj, eventNames, target, method, callback) {
function finalizer() {
for (var i = 0, l = suspendedActions.length; i < l; i++) {
var actionIndex = suspendedActions[i];
- actions[actionIndex+2] &= ~SUSPENDED;
+ actionsList[i][actionIndex+2] &= ~SUSPENDED;
}
}
| false |
Other | emberjs | ember.js | e242301f8a7250bf60f72d940149f607bb72c862.json | fix a typo in container docs | packages/container/lib/main.js | @@ -364,7 +364,7 @@ define("container",
@method makeToString
@param {any} factory
- @param {string} fullNae
+ @param {string} fullName
@return {function} toString function
*/
makeToString: function(factory, fullName) { | false |
Other | emberjs | ember.js | 89c89dee842d8fa82f961038386751d5ff7c2513.json | Add instantiate example to App.register | packages/ember-application/lib/system/application.js | @@ -384,13 +384,15 @@ var Application = Ember.Application = Ember.Namespace.extend(Ember.DeferredMixin
```javascript
App = Ember.Application.create();
- App.Person = Ember.Object.extend({});
- App.Orange = Ember.Object.extend({});
- App.Email = Ember.Object.extend({});
+ App.Person = Ember.Object.extend({});
+ App.Orange = Ember.Object.extend({});
+ App.Email = Ember.Object.extend({});
+ App.Session = Ember.Object.create({});
App.register('model:user', App.Person, {singleton: false });
App.register('fruit:favorite', App.Orange);
App.register('communication:main', App.Email, {singleton: false});
+ App.register('session', App.Session, {instantiate: false});
```
@method register | false |
Other | emberjs | ember.js | d6b061a3fd303e665ab506e836691421ea1a3ead.json | [BUGFIX beta] Optimization: Clear the meta cache without using observers. | packages/ember-views/lib/views/view.js | @@ -11,6 +11,7 @@ var get = Ember.get, set = Ember.set;
var guidFor = Ember.guidFor;
var a_forEach = Ember.EnumerableUtils.forEach;
var a_addObject = Ember.EnumerableUtils.addObject;
+var meta = Ember.meta;
var childViewsProperty = Ember.computed(function() {
var childViews = this._childViews, ret = Ember.A(), view = this;
@@ -1759,12 +1760,6 @@ Ember.View = Ember.CoreView.extend(
return viewCollection;
},
- _elementWillChange: Ember.beforeObserver(function() {
- this.forEachChildView(function(view) {
- Ember.propertyWillChange(view, 'element');
- });
- }, 'element'),
-
/**
@private
@@ -1776,7 +1771,7 @@ Ember.View = Ember.CoreView.extend(
*/
_elementDidChange: Ember.observer(function() {
this.forEachChildView(function(view) {
- Ember.propertyDidChange(view, 'element');
+ delete meta(view).cache.element;
});
}, 'element'),
@@ -2224,6 +2219,7 @@ Ember.View = Ember.CoreView.extend(
if (priorState && priorState.exit) { priorState.exit(this); }
if (currentState.enter) { currentState.enter(this); }
+ if (state === 'inDOM') { delete Ember.meta(this).cache.element; }
if (children !== false) {
this.forEachChildView(function(view) { | false |
Other | emberjs | ember.js | cb3fb8ea50ee0d2f3fbe0211547ba121b5203fb3.json | Update route recognizer | packages/ember-routing/lib/vendor/route-recognizer.js | @@ -402,7 +402,7 @@ define("route-recognizer",
}
for(var key in params) {
if (params.hasOwnProperty(key)) {
- if(!~allowedParams.indexOf(key)) {
+ if(allowedParams.indexOf(key) === -1) {
throw 'Query param "' + key + '" is not specified as a valid param for this route';
}
var value = params[key];
@@ -435,7 +435,7 @@ define("route-recognizer",
pathLen, i, l, queryStart, queryParams = {};
queryStart = path.indexOf('?');
- if (~queryStart) {
+ if (queryStart !== -1) {
var queryString = path.substr(queryStart + 1, path.length);
path = path.substr(0, queryStart);
queryParams = this.parseQueryString(queryString); | false |
Other | emberjs | ember.js | a0542eb5d24234013434b020fc62d1bf842e7d47.json | Replace crossLink with a markdown link | packages/ember-routing/lib/helpers/link_to.js | @@ -629,7 +629,7 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
{{/link-to}}
```
- See {{#crossLink "Ember.LinkView"}}{{/crossLink}} for a
+ See [Ember.LinkView](/api/classes/Ember.LinkView.html) for a
complete list of overrideable properties. Be sure to also
check out inherited properties of `LinkView`.
@@ -680,7 +680,7 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
});
/**
- See `link-to`
+ See [link-to](/api/classes/Ember.Handlebars.helpers.html#method_link-to)
@method linkTo
@for Ember.Handlebars.helpers | false |
Other | emberjs | ember.js | 91d8cdcb8e8967eeee2a60039d383a12cc67d575.json | fix small typo | packages/ember-routing/lib/ext/controller.js | @@ -46,7 +46,7 @@ Ember.ControllerMixin.reopen({
},
/**
- Alernative to `transitionToRoute`. Transition the application into another route. The route may
+ Alternative to `transitionToRoute`. Transition the application into another route. The route may
be either a single route or route path:
```javascript | false |
Other | emberjs | ember.js | f4897d73bb65c789a08d73cabd9d882e48a68332.json | Remove the .VERSION from library version logging. | packages/ember-application/lib/system/application.js | @@ -249,7 +249,7 @@ var Application = Ember.Application = Ember.Namespace.extend(Ember.DeferredMixin
Ember.debug('-------------------------------');
Ember.libraries.each(function(name, version) {
var spaces = new Array(maxNameLength - name.length + 1).join(" ");
- Ember.debug([name, '.VERSION', spaces, ' : ', version].join(""));
+ Ember.debug([name, spaces, ' : ', version].join(""));
});
Ember.debug('-------------------------------');
} | true |
Other | emberjs | ember.js | f4897d73bb65c789a08d73cabd9d882e48a68332.json | Remove the .VERSION from library version logging. | packages/ember-application/tests/system/application_test.js | @@ -209,10 +209,10 @@ test('enable log of libraries with an ENV var', function() {
});
});
- equal(messages[1], "Ember.VERSION : " + Ember.VERSION);
- equal(messages[2], "Handlebars.VERSION : " + Handlebars.VERSION);
- equal(messages[3], "jQuery.VERSION : " + Ember.$().jquery);
- equal(messages[4], "my-lib.VERSION : " + "2.0.0a");
+ equal(messages[1], "Ember : " + Ember.VERSION);
+ equal(messages[2], "Handlebars : " + Handlebars.VERSION);
+ equal(messages[3], "jQuery : " + Ember.$().jquery);
+ equal(messages[4], "my-lib : " + "2.0.0a");
Ember.libraries.deRegister("my-lib");
Ember.LOG_VERSION = false; | true |
Other | emberjs | ember.js | d74fb5479b8b0a0a9dc2c6f78d728b6bc8bc048f.json | Improve docs for CoreObject#concatenatedProperties | packages/ember-runtime/lib/system/core_object.js | @@ -256,7 +256,10 @@ CoreObject.PrototypeMixin = Mixin.create({
are also concatenated, in addition to `classNames`.
This feature is available for you to use throughout the Ember object model,
- although typical app developers are likely to use it infrequently.
+ although typical app developers are likely to use it infrequently. Since
+ it changes expectations about behavior of properties, you should properly
+ document its usage in each individual concatenated property (to not
+ mislead your users to think they can override the property in a subclass).
@property concatenatedProperties
@type Array | false |
Other | emberjs | ember.js | ad36a4e396e0ae943b79349d5631544e9faa35a9.json | Add defeatureify to Travis config. | .travis.yml | @@ -1,6 +1,11 @@
---
rvm:
- 1.9.3
+node_js:
+- "0.10"
+install:
+- "npm install -g defeatureify"
+- "bundle install --deployment"
after_success: bundle exec rake publish_build
script: rake test\[standard]
notifications: | false |
Other | emberjs | ember.js | 94751275ee54c713fceae58a34af3dcce25ea154.json | Fix route name in code comment | packages/ember-routing/lib/system/route.js | @@ -518,7 +518,7 @@ Ember.Route = Ember.Object.extend(Ember.ActionHandler, {
resolved.
```js
- App.PostRoute = Ember.Route.extend({
+ App.PostsRoute = Ember.Route.extend({
afterModel: function(posts, transition) {
if (posts.length === 1) {
this.transitionTo('post.show', posts[0]); | false |
Other | emberjs | ember.js | e18762197cd829e383251e8b2565316e3dc69aeb.json | Use the declared variable | packages/ember-views/lib/views/component.js | @@ -113,7 +113,7 @@ Ember.Component = Ember.View.extend(Ember.TargetActionSupport, {
isVirtual: true,
tagName: '',
_contextView: parentView,
- template: get(this, 'template'),
+ template: template,
context: get(parentView, 'context'),
controller: get(parentView, 'controller'),
templateData: { keywords: parentView.cloneKeywords() } | false |
Other | emberjs | ember.js | e8a9ad9adeaeda88c7afea2bb15562dac2f72b43.json | Fix typo in docstring | packages/ember-routing/lib/helpers/render.js | @@ -23,7 +23,7 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
Example:
```javascript
- App.NavigationController = Ember.Controller.extned({
+ App.NavigationController = Ember.Controller.extend({
who: "world"
});
``` | false |
Other | emberjs | ember.js | 1a160f1a64a3537c2565746d0d2aed3d17fc7205.json | Fix size calculations on website | Rakefile | @@ -116,7 +116,7 @@ namespace :release do
min_gz = Zlib::Deflate.deflate(File.read("dist/ember.min.js")).bytes.count / 1024
about.gsub!(/(\d+\.\d+\.\d+-rc(?:\.?\d+)?)/, Ember::VERSION)
- about.gsub!(/minified \d+kb/, "minified #{min_gz}kb")
+ about.gsub!(/min \+ gzip \d+kb/, "min + gzip #{min_gz}kb")
open("tmp/website/source/about.html.erb", "w") { |f| f.write about }
end | false |
Other | emberjs | ember.js | b0ca8033ac69e2c4e6dcdc08f036dc317079b705.json | Fix ember-source to handle non-RCs | lib/ember/version.rb | @@ -6,8 +6,12 @@ module Ember
# we might want to unify this with the ember version string,
# but consistency?
def rubygems_version_string
- major, rc = VERSION.sub('-','.').scan(/(\d+\.\d+\.\d+\.rc)\.(\d+)/).first
+ if VERSION =~ /rc/
+ major, rc = VERSION.sub('-','.').scan(/(\d+\.\d+\.\d+\.rc)\.(\d+)/).first
- "#{major}#{rc}"
+ "#{major}#{rc}"
+ else
+ VERSION
+ end
end
end | false |
Other | emberjs | ember.js | 7f2fa488945b3dfb8ebc91560ca6137cee22def0.json | fix nested yield | packages/ember-handlebars/lib/helpers/yield.js | @@ -16,20 +16,20 @@ var get = Ember.get, set = Ember.set;
inserting the view's own rendered output at the `{{yield}}` location.
An empty `<body>` and the following application code:
-
+
```javascript
AView = Ember.View.extend({
classNames: ['a-view-with-layout'],
layout: Ember.Handlebars.compile('<div class="wrapper">{{yield}}</div>'),
template: Ember.Handlebars.compile('<span>I am wrapped</span>')
});
-
+
aView = AView.create();
aView.appendTo('body');
```
-
+
Will result in the following HTML output:
-
+
```html
<body>
<div class='ember-view a-view-with-layout'>
@@ -39,50 +39,50 @@ var get = Ember.get, set = Ember.set;
</div>
</body>
```
-
+
The `yield` helper cannot be used outside of a template assigned to an
`Ember.View`'s `layout` property and will throw an error if attempted.
-
+
```javascript
BView = Ember.View.extend({
classNames: ['a-view-with-layout'],
template: Ember.Handlebars.compile('{{yield}}')
});
-
+
bView = BView.create();
bView.appendTo('body');
-
+
// throws
- // Uncaught Error: assertion failed:
+ // Uncaught Error: assertion failed:
// You called yield in a template that was not a layout
```
### Use with Ember.Component
When designing components `{{yield}}` is used to denote where, inside the component's
template, an optional block passed to the component should render:
-
+
```handlebars
<!-- application.hbs -->
{{#labeled-textfield value=someProperty}}
First name:
{{/my-component}}
```
-
+
```handlebars
<!-- components/my-component.hbs -->
<label>
{{yield}} {{input value=value}}
</label>
```
-
+
Result:
-
+
```html
<label>
First name: <input type="text" />
<label>
```
-
+
@method yield
@for Ember.Handlebars.helpers
@param {Hash} options
@@ -92,7 +92,11 @@ Ember.Handlebars.registerHelper('yield', function(options) {
var view = options.data.view;
while (view && !get(view, 'layout')) {
- view = get(view, 'parentView');
+ if (view._contextView) {
+ view = view._contextView;
+ } else {
+ view = get(view, 'parentView');
+ }
}
Ember.assert("You called yield in a template that was not a layout", !!view); | true |
Other | emberjs | ember.js | 7f2fa488945b3dfb8ebc91560ca6137cee22def0.json | fix nested yield | packages/ember-handlebars/tests/helpers/yield_test.js | @@ -14,10 +14,11 @@ module("Support for {{yield}} helper (#307)", {
},
teardown: function() {
Ember.run(function() {
+ Ember.TEMPLATES = {};
if (view) {
view.destroy();
- }}
- );
+ }
+ });
Ember.lookup = originalLookup;
}
@@ -307,3 +308,48 @@ test("yield should work for views even if _parentView is null", function() {
equal(view.$().text(), "Layout: View Content");
});
+
+module("Component {{yield}}", {
+ setup: function() {},
+ teardown: function() {
+ Ember.run(function() {
+ if (view) {
+ view.destroy();
+ }
+ delete Ember.Handlebars.helpers['inner-component'];
+ delete Ember.Handlebars.helpers['outer-component'];
+ });
+ }
+});
+
+test("yield with nested components (#3220)", function(){
+ var count = 0;
+ var InnerComponent = Ember.Component.extend({
+ layout: Ember.Handlebars.compile("{{yield}}"),
+ _yield: function (context, options) {
+ count++;
+ if (count > 1) throw new Error('is looping');
+ return this._super(context, options);
+ }
+ });
+
+ Ember.Handlebars.helper('inner-component', InnerComponent);
+
+ var OuterComponent = Ember.Component.extend({
+ layout: Ember.Handlebars.compile("{{#inner-component}}<span>{{yield}}</span>{{/inner-component}}")
+ });
+
+ Ember.Handlebars.helper('outer-component', OuterComponent);
+
+ view = Ember.View.create({
+ template: Ember.Handlebars.compile(
+ "{{#outer-component}}Hello world{{/outer-component}}"
+ )
+ });
+
+ Ember.run(function() {
+ view.appendTo('#qunit-fixture');
+ });
+
+ equal(view.$('div > span').text(), "Hello world");
+}); | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.