<commit_before>/*global module, expect, inject, describe, it, before, beforeEach, after, afterEach */

describe("Unit tests for drop-down-combo-text directive", function(myApi) {
  beforeEach(module(PKG.name + ".directives"));

  var scope, element, compile;
  beforeEach(inject(function($rootScope, $compile){
    compile = $compile;
    scope = $rootScope.$new();
    element = angular.element(
      "<drop-down-text-combo " +
            "ng-model=\"model\"" +
            "drop-down-list=\"dropDownList\"" +
            "text-fields = \"textFields\"" +
            "> "+
        "</drop-down-text-combo>");
    scope = $rootScope.$new();
    scope.model = {
      "something": {
        "flavor": "value"
      },
      "somethingelse": {
        "flavor": "value"
      }
    };
    scope.textFields = ["text1"];
    scope.dropDownList = [
      {
        name: "something",
        value: "asadsa"
      },
      {
        name: "somethingelse",
        value: "asadsa"
      },
      {
        name: "field3",
        value: "asadsa"
      }];


    $compile(element)(scope);
    scope.$digest();
  }));

  it("Idealistic case where all data is perfect", function() {
    var localScope = element.isolateScope();
    expect(localScope.dropDownValues.length).toBe(1);
  });
  it("should work with change in model", function() {
    scope.model.field3 = {
      flavor: "field3"
    };
    compile(element)(scope);
    scope.$digest();
    expect(element.isolateScope().dropDownValues.length).toBe(0);
  });

  it("should work with deletion in model", function() {
    delete scope.model.field3;
    delete scope.model.something;
    compile(element)(scope);
    scope.$digest();
    expect(element.isolateScope().dropDownValues.length).toBe(2);
  });
});
<commit_msg>Fixes unit tests for travis<commit_after>/*global module, expect, inject, describe, it, before, beforeEach, after, afterEach */

describe("Unit tests for drop-down-combo-text directive", function(myApi) {
  beforeEach(module(PKG.name + ".directives"));

  var scope, element, compile;
  beforeEach(inject(function($rootScope, $compile){
    compile = $compile;
    scope = $rootScope.$new();
    element = angular.element(
      "<drop-down-text-combo " +
            "ng-model=\"model\"" +
            "drop-down-list=\"dropDownList\"" +
            "text-fields = \"textFields\"" +
            "> "+
        "</drop-down-text-combo>");
    scope = $rootScope.$new();
    scope.model = {
      "something": {
        "flavor": "value"
      },
      "somethingelse": {
        "flavor": "value"
      }
    };
    scope.textFields = ["text1"];
    scope.dropDownList = [
      {
        name: "something",
        value: "asadsa"
      },
      {
        name: "somethingelse",
        value: "asadsa"
      },
      {
        name: "field3",
        value: "asadsa"
      }];


    $compile(element)(scope);
    scope.$digest();
  }));

  it("Idealistic case where all data is perfect", function() {
    var localScope = element.isolateScope();
    expect(localScope.dropDownValues.length).toBe(1);
  });
  it("should work with change in model", function() {
    scope.model.field3 = {
      flavor: "field3"
    };
    scope.$digest();
    expect(element.isolateScope().dropDownValues.length).toBe(0);
  });

  it("should work with deletion in model", function() {
    delete scope.model.field3;
    delete scope.model.something;
    scope.$digest();
    expect(element.isolateScope().dropDownValues.length).toBe(2);
  });
});

{'fraction_non_alphanumeric': 0.16837899543378995, 'fraction_numerical': 0.0045662100456621, 'mean_word_length': 2.5155466399197595, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 7, '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': '3112631', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1086, 'n_words': 204}