Skip to content

Commit

Permalink
Merge pull request #11804 from martndemus/remove-create-with-mixins
Browse files Browse the repository at this point in the history
[CLEANUP beta] Remove EmberObject.createWithMixins
  • Loading branch information
rwjblue committed Jul 18, 2015
2 parents 408047d + 3be62c0 commit f247f6e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 89 deletions.
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');
});

0 comments on commit f247f6e

Please sign in to comment.