Skip to content

Commit

Permalink
Merge pull request #12698 from davidpett/convert-super-apply-to-es6
Browse files Browse the repository at this point in the history
convert all this._super.apply(this, arguments) to this._super(...arguments)
  • Loading branch information
rwjblue committed Dec 9, 2015
2 parents cb980bc + 7847e8f commit b3ce376
Show file tree
Hide file tree
Showing 35 changed files with 95 additions and 95 deletions.
2 changes: 1 addition & 1 deletion packages/ember-application/tests/system/reset_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ QUnit.test('With ember-data like initializer and constant', function() {
set(DS, 'defaultStore', this);
}

this._super.apply(this, arguments);
this._super(...arguments);
},
willDestroy() {
if (get(DS, 'defaultStore') === this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ QUnit.test('dashed helper is torn down', function() {
var SomeHelper = Helper.extend({
destroy() {
destroyCalled++;
this._super.apply(this, arguments);
this._super(...arguments);
},
compute() {
return 'must define a compute';
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/tests/helpers/if_unless_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ QUnit.test('edge case: child conditional should not render children if parent co
cond2: false,
viewClass: EmberView.extend({
init() {
this._super.apply(this, arguments);
this._super(...arguments);
childCreated = true;
child = this;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-htmlbars/tests/helpers/view_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ QUnit.test('"Binding"-suffixed bindings are runloop-synchronized [DEPRECATED]',
var Subview = EmberView.extend({
init() {
subview = this;
return this._super.apply(this, arguments);
return this._super(...arguments);
},
template: compile('<div class="color">{{view.color}}</div>')
});
Expand Down Expand Up @@ -295,7 +295,7 @@ QUnit.test('Non-"Binding"-suffixed bindings are runloop-synchronized', function(
var Subview = EmberView.extend({
init() {
subview = this;
return this._super.apply(this, arguments);
return this._super(...arguments);
},
template: compile('<div class="color">{{view.attrs.color}}</div>')
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ styles.forEach(style => {
init() {
this.label = label;
components[label] = this;
this._super.apply(this, arguments);
this._super(...arguments);
pushHook(label, 'init');
},

Expand Down Expand Up @@ -238,7 +238,7 @@ styles.forEach(style => {
init() {
this.label = label;
components[label] = this;
this._super.apply(this, arguments);
this._super(...arguments);
pushHook(label, 'init');
},

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-htmlbars/tests/system/render_env_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function constructComponent(label) {
init() {
this.label = label;
components[label] = this;
this._super.apply(this, arguments);
this._super(...arguments);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-metal/lib/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ export function mixin(obj, ...args) {
//filters will be created as a separate array during the object's initialization
App.Filterable = Ember.Mixin.create({
init: function() {
this._super.apply(this, arguments);
this._super(...arguments);
this.set("filters", Ember.A());
}
});
Expand Down
10 changes: 5 additions & 5 deletions packages/ember-metal/tests/mixin/computed_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ QUnit.test('overriding computed properties', function() {

MixinB = Mixin.create(MixinA, {
aProp: computed(function() {
return this._super.apply(this, arguments) + 'B';
return this._super(...arguments) + 'B';
})
});

MixinC = Mixin.create(MixinA, {
aProp: computed(function() {
return this._super.apply(this, arguments) + 'C';
return this._super(...arguments) + 'C';
})
});

MixinD = Mixin.create({
aProp: computed(function() {
return this._super.apply(this, arguments) + 'D';
return this._super(...arguments) + 'D';
})
});

Expand Down Expand Up @@ -74,8 +74,8 @@ QUnit.test('calling set on overridden computed properties', function() {

SubMixin = Mixin.create(SuperMixin, {
aProp: computed({
get: function(key) { return this._super.apply(this, arguments); },
set: function(key, value) { return this._super.apply(this, arguments); }
get: function(key) { return this._super(...arguments); },
set: function(key, value) { return this._super(...arguments); }
})
});

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-metal/tests/mixin/merged_properties_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ QUnit.test('mergedProperties\' overwriting methods can call _super', function()
foo: {
meth(a) {
ok(true, 'MixinB\'s `foo.meth` method called');
return this._super.apply(this, arguments);
return this._super(...arguments);
}
}
});
Expand Down
24 changes: 12 additions & 12 deletions packages/ember-metal/tests/mixin/method_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ QUnit.test('overriding public methods', function() {
});

MixinB = Mixin.create(MixinA, {
publicMethod() { return this._super.apply(this, arguments) + 'B'; }
publicMethod() { return this._super(...arguments) + 'B'; }
});

MixinD = Mixin.create(MixinA, {
publicMethod() { return this._super.apply(this, arguments) + 'D'; }
publicMethod() { return this._super(...arguments) + 'D'; }
});

MixinF = Mixin.create({
publicMethod() { return this._super.apply(this, arguments) + 'F'; }
publicMethod() { return this._super(...arguments) + 'F'; }
});

obj = {};
Expand Down Expand Up @@ -68,7 +68,7 @@ QUnit.test('overriding inherited objects', function() {

var MixinB = Mixin.create({
foo() {
this._super.apply(this, arguments);
this._super(...arguments);
cnt++;
}
});
Expand All @@ -95,15 +95,15 @@ QUnit.test('Including the same mixin more than once will only run once', functio
});

var MixinB = Mixin.create(MixinA, {
foo() { this._super.apply(this, arguments); }
foo() { this._super(...arguments); }
});

var MixinC = Mixin.create(MixinA, {
foo() { this._super.apply(this, arguments); }
foo() { this._super(...arguments); }
});

var MixinD = Mixin.create(MixinB, MixinC, MixinA, {
foo() { this._super.apply(this, arguments); }
foo() { this._super(...arguments); }
});

var obj = {};
Expand All @@ -119,7 +119,7 @@ QUnit.test('Including the same mixin more than once will only run once', functio
QUnit.test('_super from a single mixin with no superclass does not error', function() {
var MixinA = Mixin.create({
foo() {
this._super.apply(this, arguments);
this._super(...arguments);
}
});

Expand All @@ -137,13 +137,13 @@ QUnit.test('_super from a first-of-two mixins with no superclass function does n
var MixinA = Mixin.create({
foo() {
if (remaining-- > 0) {
this._super.apply(this, arguments);
this._super(...arguments);
}
}
});

var MixinB = Mixin.create({
foo() { this._super.apply(this, arguments); }
foo() { this._super(...arguments); }
});

var obj = {};
Expand Down Expand Up @@ -189,14 +189,14 @@ QUnit.test('applying several mixins at once with sup already defined causes infi

var MixinB = Mixin.create({
foo() {
this._super.apply(this, arguments);
this._super(...arguments);
cnt++;
}
});

var MixinC = Mixin.create({
foo() {
this._super.apply(this, arguments);
this._super(...arguments);
cnt++;
}
});
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-metal/tests/mixin/reopen_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ QUnit.test('using reopen() and calling _super where there is not a super functio
// There is no original createBreakfast function.
// Calling the wrapped _super function here
// used to end in an infinite call loop
this._super.apply(this, arguments);
this._super(...arguments);
return 'Breakfast!';
}
});

Taco.reopen({
createBreakfast() {
return this._super.apply(this, arguments);
return this._super(...arguments);
}
});

Expand Down
14 changes: 7 additions & 7 deletions packages/ember-routing-htmlbars/tests/helpers/render_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ QUnit.test('{{render}} helper should render given template with a supplied model
var postController;
var PostController = EmberController.extend({
init() {
this._super.apply(this, arguments);
this._super(...arguments);
postController = this;
}
});
Expand Down Expand Up @@ -228,7 +228,7 @@ QUnit.test('{{render}} helper should render with given controller', function() {

appInstance.register('controller:posts', EmberController.extend({
init() {
this._super.apply(this, arguments);
this._super(...arguments);
this.uniqueId = id++;
}
}));
Expand Down Expand Up @@ -295,7 +295,7 @@ QUnit.test('{{render}} helper should render templates with models multiple times
var postController1, postController2;
var PostController = EmberController.extend({
init() {
this._super.apply(this, arguments);
this._super(...arguments);
if (!postController1) {
postController1 = this;
} else if (!postController2) {
Expand Down Expand Up @@ -342,7 +342,7 @@ QUnit.test('{{render}} helper should not leak controllers', function() {
var postController;
var PostController = EmberController.extend({
init() {
this._super.apply(this, arguments);
this._super(...arguments);
postController = this;
}
});
Expand Down Expand Up @@ -374,7 +374,7 @@ QUnit.test('{{render}} helper should not treat invocations with falsy contexts a
var postController1, postController2;
var PostController = EmberController.extend({
init() {
this._super.apply(this, arguments);
this._super(...arguments);
if (!postController1) {
postController1 = this;
} else if (!postController2) {
Expand Down Expand Up @@ -416,7 +416,7 @@ QUnit.test('{{render}} helper should render templates both with and without mode
var postController1, postController2;
var PostController = EmberController.extend({
init() {
this._super.apply(this, arguments);
this._super(...arguments);
if (!postController1) {
postController1 = this;
} else if (!postController2) {
Expand Down Expand Up @@ -537,7 +537,7 @@ QUnit.test('{{render}} works with dot notation', function() {
var id = 0;
var BlogPostController = EmberController.extend({
init() {
this._super.apply(this, arguments);
this._super(...arguments);
controller = this;
this.uniqueId = id++;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-routing-views/lib/components/link-to.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,14 +504,14 @@ let LinkComponent = EmberComponent.extend({
```javascript
App.MyLinkComponent = Ember.LinkComponent.extend({
init: function() {
this._super.apply(this, arguments);
this._super(...arguments);
Ember.Logger.log('Event is ' + this.get('eventName'));
}
});
```
NOTE: If you do override `init` for a framework class like `Ember.View`,
be sure to call `this._super.apply(this, arguments)` in your
be sure to call `this._super(...arguments)` in your
`init` declaration! If you don't, Ember may not have an opportunity to
do important setup work, and you'll see strange behavior in your
application.
Expand Down
18 changes: 9 additions & 9 deletions packages/ember-routing/tests/location/history_location_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ QUnit.test('HistoryLocation initState does not get fired on init', function() {
HistoryTestLocation.reopen({
init() {
ok(true, 'init was called');
this._super.apply(this, arguments);
this._super(...arguments);
},
initState() {
ok(false, 'initState() should not be called automatically');
Expand All @@ -78,7 +78,7 @@ QUnit.test('webkit doesn\'t fire popstate on page load', function() {

HistoryTestLocation.reopen({
initState() {
this._super.apply(this, arguments);
this._super(...arguments);
// these two should be equal to be able
// to successfully detect webkit initial popstate
equal(this._previousURL, this.getURL());
Expand All @@ -94,14 +94,14 @@ QUnit.test('base URL is removed when retrieving the current pathname', function(

HistoryTestLocation.reopen({
init() {
this._super.apply(this, arguments);
this._super(...arguments);

set(this, 'location', mockBrowserLocation('/base/foo/bar'));
set(this, 'baseURL', '/base/');
},

initState() {
this._super.apply(this, arguments);
this._super(...arguments);

equal(this.getURL(), '/foo/bar');
}
Expand All @@ -116,7 +116,7 @@ QUnit.test('base URL is preserved when moving around', function() {

HistoryTestLocation.reopen({
init() {
this._super.apply(this, arguments);
this._super(...arguments);

set(this, 'location', mockBrowserLocation('/base/foo/bar'));
set(this, 'baseURL', '/base/');
Expand Down Expand Up @@ -159,7 +159,7 @@ QUnit.test('HistoryLocation.getURL() returns the current url, excluding both roo

HistoryTestLocation.reopen({
init() {
this._super.apply(this, arguments);
this._super(...arguments);

set(this, 'location', mockBrowserLocation('/base/foo/bar'));
set(this, 'rootURL', '/app/');
Expand All @@ -177,7 +177,7 @@ QUnit.test('HistoryLocation.getURL() includes location.search', function() {

HistoryTestLocation.reopen({
init() {
this._super.apply(this, arguments);
this._super(...arguments);
set(this, 'location', mockBrowserLocation('/foo/bar?time=morphin'));
}
});
Expand All @@ -192,7 +192,7 @@ QUnit.test('HistoryLocation.getURL() includes location.hash', function() {

HistoryTestLocation.reopen({
init() {
this._super.apply(this, arguments);
this._super(...arguments);
set(this, 'location', mockBrowserLocation('/foo/bar#pink-power-ranger'));
}
});
Expand All @@ -207,7 +207,7 @@ QUnit.test('HistoryLocation.getURL() includes location.hash and location.search'

HistoryTestLocation.reopen({
init() {
this._super.apply(this, arguments);
this._super(...arguments);
set(this, 'location', mockBrowserLocation('/foo/bar?time=morphin#pink-power-ranger'));
}
});
Expand Down
Loading

0 comments on commit b3ce376

Please sign in to comment.