From 3be62c0542af2049269f134f7c622857600fa333 Mon Sep 17 00:00:00 2001 From: Marten Schilstra Date: Sat, 18 Jul 2015 18:41:23 +0200 Subject: [PATCH] [CLEANUP beta] Remove EmberObject.createWithMixins --- .../ember-runtime/lib/system/core_object.js | 18 ----- .../tests/system/object/create_test.js | 71 ------------------- 2 files changed, 89 deletions(-) diff --git a/packages/ember-runtime/lib/system/core_object.js b/packages/ember-runtime/lib/system/core_object.js index 57f2ef72a8c..63bfc980dea 100644 --- a/packages/ember-runtime/lib/system/core_object.js +++ b/packages/ember-runtime/lib/system/core_object.js @@ -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. diff --git a/packages/ember-runtime/tests/system/object/create_test.js b/packages/ember-runtime/tests/system/object/create_test.js index f6a494eb1ba..92862245a63 100644 --- a/packages/ember-runtime/tests/system/object/create_test.js +++ b/packages/ember-runtime/tests/system/object/create_test.js @@ -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; @@ -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'); -});