diff --git a/packages/ember-metal/lib/tags.js b/packages/ember-metal/lib/tags.js index 6fe427743f4..8579152f0eb 100644 --- a/packages/ember-metal/lib/tags.js +++ b/packages/ember-metal/lib/tags.js @@ -41,9 +41,12 @@ if (hasGlimmer) { makeTag = () => new DirtyableTag(); markObjectAsDirty = function(meta) { - ensureRunloop(); - let tag = (meta && meta.readableTag()) || CURRENT_TAG; - tag.dirty(); + let tag = meta && meta.readableTag(); + + if (tag) { + ensureRunloop(); + tag.dirty(); + } }; } else { markObjectAsDirty = function() {}; diff --git a/packages/ember-metal/tests/accessors/set_test.js b/packages/ember-metal/tests/accessors/set_test.js index 491ed79c862..4dbe3a94d29 100644 --- a/packages/ember-metal/tests/accessors/set_test.js +++ b/packages/ember-metal/tests/accessors/set_test.js @@ -1,7 +1,12 @@ import { get } from 'ember-metal/property_get'; import { set } from 'ember-metal/property_set'; +import { setHasViews } from 'ember-metal/tags'; -QUnit.module('set'); +QUnit.module('set', { + teardown() { + setHasViews(() => false); + } +}); QUnit.test('should set arbitrary properties on an object', function() { let obj = { @@ -69,3 +74,12 @@ QUnit.test('warn on attempts of calling set on a destroyed object', function() { expectAssertion(() => set(obj, 'favoriteFood', 'hot dogs'), 'calling set on destroyed object: [object Object].favoriteFood = hot dogs'); }); + +QUnit.test('does not trigger auto-run assertion for objects that have not been tagged', function(assert) { + setHasViews(() => true); + let obj = {}; + + set(obj, 'foo', 'bar'); + + assert.equal(obj.foo, 'bar'); +});