Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLEANUP beta] Remove EmberObject.createWithMixins #11804

Merged
merged 1 commit into from Jul 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions packages/ember-runtime/lib/system/core_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,24 +572,6 @@ var ClassMixinProps = {
return Class;
},

/**
Equivalent to doing `extend(arguments).create()`.
If possible use the normal `create` method instead.

@method createWithMixins
@static
@param [arguments]*
@private
@deprecated
*/
createWithMixins: Ember.deprecateFunc('.createWithMixins is deprecated, please use .create or .extend accordingly', function(...args) {
var C = this;
if (args.length > 0) {
this._initMixins(args);
}
return new C();
}),

/**
Creates an instance of a class. Accepts either no arguments, or an object
containing values to initialize the newly instantiated object with.
Expand Down
71 changes: 0 additions & 71 deletions packages/ember-runtime/tests/system/object/create_test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import Ember from 'ember-metal/core';
import isEnabled from 'ember-metal/features';
import {get} from 'ember-metal/property_get';
import {computed} from 'ember-metal/computed';
import {Mixin, observer} from 'ember-metal/mixin';
import {on} from 'ember-metal/events';
import EmberObject from 'ember-runtime/system/object';

var moduleOptions, originalLookup;
Expand Down Expand Up @@ -153,72 +151,3 @@ QUnit.test('EmberObject.create can take null as a parameter', function() {
var o = EmberObject.create(null);
deepEqual(EmberObject.create(), o);
});

QUnit.module('EmberObject.createWithMixins', moduleOptions);

QUnit.test('Creates a new object that contains passed properties', function() {
var called = false;
var obj = EmberObject.extend({
method() { called = true; }
}).create({
prop: 'FOO'
});

equal(get(obj, 'prop'), 'FOO', 'obj.prop');
obj.method();
ok(called, 'method executed');
});

// ..........................................................
// WORKING WITH MIXINS
//

QUnit.test('Creates a new object that includes mixins and properties', function() {
var MixinA = Mixin.create({ mixinA: 'A' });

expectDeprecation(function() {
EmberObject.createWithMixins(MixinA, { prop: 'FOO' });
}, '.createWithMixins is deprecated, please use .create or .extend accordingly');
});

// ..........................................................
// LIFECYCLE
//

QUnit.test('Configures _super() on methods with override', function() {
var MixinA = Mixin.create({ method() {} });
expectDeprecation(function() {
EmberObject.createWithMixins(MixinA, {
method() {
this._super.apply(this, arguments);
}
});
}, '.createWithMixins is deprecated, please use .create or .extend accordingly');
});

QUnit.test('Calls all mixin inits if defined', function() {
var Mixin1 = Mixin.create({
init() {
this._super.apply(this, arguments);
}
});

var Mixin2 = Mixin.create({
init() {
this._super.apply(this, arguments);
}
});

expectDeprecation(function() {
EmberObject.createWithMixins(Mixin1, Mixin2);
}, '.createWithMixins is deprecated, please use .create or .extend accordingly');
});

QUnit.test('Triggers init', function() {
expectDeprecation(function() {
EmberObject.createWithMixins({
markAsCompleted: on('init', function() {
})
});
}, '.createWithMixins is deprecated, please use .create or .extend accordingly');
});