<commit_before>describe('validationStatus initialization', function() {
  var $scope, $parentScope, form;
  beforeEach(module('ManageIQ'));
  beforeEach(inject(function($compile, $rootScope) {
    $scope = $rootScope.$new();
    $parentScope = $rootScope.$new();
    $scope.$parent = $parentScope;
    $parentScope.model = "emsCommonModel";
    var element = angular.element(
      '<form name="angularForm">' +
      '<input type="text" error-on-tab="default"/>' +
      '<input type="checkbox" main-scope="$parent" validation-status="" prefix="default" ng-model="emsCommonModel.default_auth_status" name="default_auth_status"/>' +
      '</form>'
    );
    $compile(element)($scope);
    $scope.$digest();
    elem = $compile(element)($rootScope);
    angularForm = $scope.angularForm;
  }));

  describe('validation-status', function() {
    it('builds post Validation Model when validation status is valid', function() {
      $parentScope.postValidationModelRegistry = function() {};
      spyOn($parentScope, 'postValidationModelRegistry');
      angularForm.default_auth_status.$setViewValue(true);
      expect($parentScope.postValidationModelRegistry).toHaveBeenCalled();
    });

    it('sets error icon on html element when validation status is invalid', inject(function($rootScope, $timeout) {
      angularForm.default_auth_status.$setViewValue(false);
      $timeout.flush();
      expect(elem[0][0].className).toEqual("fa fa-exclamation-circle");
    }));
  });
});
<commit_msg>update spec for validation status directive<commit_after>describe('validationStatus initialization', function() {
  var $scope;
  var elem;
  var angularForm;
  beforeEach(module('ManageIQ'));
  beforeEach(inject(function($compile, $rootScope) {
    $scope = $rootScope.$new();
    $scope.postValidationModelRegistry = jasmine.createSpy('postValidationModelRegistry');
    var element = angular.element(
      '<form name="angularForm">' +
      '<input type="text" error-on-tab="default"/>' +
      '<input type="checkbox" validation-status="" prefix="default"' +
        'ng-model="emsCommonModel.default_auth_status"' +
        'name="default_auth_status"' +
        'post-validation-model-registry="postValidationModelRegistry"/>' +
      '</form>'
    );
    elem = $compile(element)($scope);
    elem.scope().$digest();
    angularForm = $scope.angularForm;
  }));

  describe('validation-status', function() {
    it('builds post Validation Model when validation status is valid', function() {
      angularForm.default_auth_status.$setViewValue(true);
      expect($scope.postValidationModelRegistry).toHaveBeenCalled();
    });

    it('sets error icon on html element when validation status is invalid', inject(function($timeout) {
      angularForm.default_auth_status.$setViewValue(false);
      $timeout.flush();
      expect(elem[0][0].className).toEqual('fa fa-exclamation-circle');
    }));
  });
});

{'fraction_non_alphanumeric': 0.15802129852284438, 'fraction_numerical': 0.0013740982480247338, 'mean_word_length': 4.515151515151516, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '981036', 'n_tokens_mistral': 823, 'n_tokens_neox': 820, 'n_words': 147}