<commit_before>import { get } from "ember-metal/property_get";
import { set } from "ember-metal/property_set";
import { watch } from "ember-metal/watching";

QUnit.module('mandatory-setters');

if (Ember.FEATURES.isEnabled('mandatory-setter')) {
  test('does not assert if property is not being watched', function() {
    var obj = {
      someProp: null,
      toString: function() {
        return 'custom-object';
      }
    };

    obj.someProp = 'blastix';
    equal(get(obj, 'someProp'), 'blastix');
  });

  test('should assert if set without Ember.set when property is being watched', function() {
    var obj = {
      someProp: null,
      toString: function() {
        return 'custom-object';
      }
    };

    watch(obj, 'someProp');

    expectAssertion(function() {
      obj.someProp = 'foo-bar';
    }, 'You must use Ember.set() to set the `someProp` property (of custom-object) to `foo-bar`.');
  });

  test('should not assert if set with Ember.set when property is being watched', function() {
    var obj = {
      someProp: null,
      toString: function() {
        return 'custom-object';
      }
    };

    watch(obj, 'someProp');
    set(obj, 'someProp', 'foo-bar');

    equal(get(obj, 'someProp'), 'foo-bar');
  });
} else {
  test('does not assert', function() {<commit_msg>[BUGFIX beta] Only tests mandatory-setter in ES5 browers.<commit_after>import { get } from "ember-metal/property_get";
import { set } from "ember-metal/property_set";
import { watch } from "ember-metal/watching";
import { hasPropertyAccessors } from "ember-metal/platform";

QUnit.module('mandatory-setters');

if (Ember.FEATURES.isEnabled('mandatory-setter')) {
  if (hasPropertyAccessors) {
    test('does not assert if property is not being watched', function() {
      var obj = {
        someProp: null,
        toString: function() {
          return 'custom-object';
        }
      };

      obj.someProp = 'blastix';
      equal(get(obj, 'someProp'), 'blastix');
    });

    test('should assert if set without Ember.set when property is being watched', function() {
      var obj = {
        someProp: null,
        toString: function() {
          return 'custom-object';
        }
      };

      watch(obj, 'someProp');

      expectAssertion(function() {
        obj.someProp = 'foo-bar';
      }, 'You must use Ember.set() to set the `someProp` property (of custom-object) to `foo-bar`.');
    });

    test('should not assert if set with Ember.set when property is being watched', function() {
      var obj = {
        someProp: null,
        toString: function() {
          return 'custom-object';
        }
      };

      watch(obj, 'someProp');
      set(obj, 'someProp', 'foo-bar');

      equal(get(obj, 'someProp'), 'foo-bar');
    });
  }
} else {
  test('does not assert', function() {
{'fraction_non_alphanumeric': 0.15076268180205746, 'fraction_numerical': 0.000354735721887194, 'mean_word_length': 2.7301587301587302, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7149546', 'n_tokens_mistral': 880, 'n_tokens_neox': 858, 'n_words': 233}