From 5625bbefd7dd9203047eafc5f113aeb465994ef8 Mon Sep 17 00:00:00 2001 From: Erik Bryn Date: Sat, 31 Jan 2015 15:25:51 -0800 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20run=20this=20mandatory=20setter?= =?UTF-8?q?=20test=20in=20prod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/system/object/destroy_test.js | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/ember-runtime/tests/system/object/destroy_test.js b/packages/ember-runtime/tests/system/object/destroy_test.js index d148e615f15..28cc35ecbbe 100644 --- a/packages/ember-runtime/tests/system/object/destroy_test.js +++ b/packages/ember-runtime/tests/system/object/destroy_test.js @@ -30,24 +30,26 @@ testBoth("should schedule objects to be destroyed at the end of the run loop", f ok(get(obj, 'isDestroyed'), "object is destroyed after run loop finishes"); }); -if (hasPropertyAccessors) { - // MANDATORY_SETTER moves value to meta.values - // a destroyed object removes meta but leaves the accessor - // that looks it up - test("should raise an exception when modifying watched properties on a destroyed object", function() { - var obj = EmberObject.createWithMixins({ - foo: "bar", - fooDidChange: observer('foo', function() { }) +if (Ember.FEATURES.isEnabled('mandatory-setter')) { + if (hasPropertyAccessors) { + // MANDATORY_SETTER moves value to meta.values + // a destroyed object removes meta but leaves the accessor + // that looks it up + test("should raise an exception when modifying watched properties on a destroyed object", function() { + var obj = EmberObject.createWithMixins({ + foo: "bar", + fooDidChange: observer('foo', function() { }) + }); + + run(function() { + obj.destroy(); + }); + + raises(function() { + set(obj, 'foo', 'baz'); + }, Error, "raises an exception"); }); - - run(function() { - obj.destroy(); - }); - - raises(function() { - set(obj, 'foo', 'baz'); - }, Error, "raises an exception"); - }); + } } test("observers should not fire after an object has been destroyed", function() {