<commit_before>'use strict';

/* global vl:true, vlSchema:true */

describe('Directive: functionSelect', function() {

  // load the directive's module
  beforeEach(module('vlui', function($provide) {
    $provide.constant('vl', vl);
    $provide.constant('vlSchema', vlSchema);
  }));

  var element, scope, $compile;

  beforeEach(inject(function($rootScope, _$compile_) {
    scope = $rootScope.$new();
    scope.schema = {
      properties: {
        aggregate: {
          supportedEnums: {
            quantitative: ['a', 'b'],
            undefined: []
          }
        },
        timeUnit: {
          supportedEnums: {
            temporal: ['f1','f2']
          }
        },
        bin: {
          supportedTypes: {
            quantitative: true
          }
        }
      }
    };
    scope.pills = {
      x: { type: 'quantitative', field: 'x'},
      y: { aggregate: 'count', field:'*'},
      color: { type: 'temporal', field: 'c'},
      update: function() {}
    };
    scope.encoding = {
      x: { type: 'quantitative', field: 'x'},
      y: { aggregate: 'count', field:'*'},
      color: { type: 'temporal', field: 'c'},
    };
    scope.channel = 'x';
    scope.channel2 = 'y';
    scope.channel3 = 'color';

    $compile = _$compile_;
  }));

  it('should have correct number of radio', function() {
    element = angular.element('<function-select field-def="encoding[channel]" channel="channel" pills="pills"></function-select>');
    element = $compile(element)(scope);
    scope.$digest();
    expect(element.find('input').length).to.eql(21);
  });

  it('should have correct number of radio', function() {
    element = angular.element('<function-select  field-def="encoding[channel3]" channel="channel3" pills="pills"></function-select>');
    element = $compile(element)(scope);
    scope.$digest();
    expect(element.find('input').length).to.eql(22);
  });

  it('should not show other options for count field', function() {<commit_msg>Fix broken test<commit_after>'use strict';

/* global vl:true, vlSchema:true */

describe('Directive: functionSelect', function() {

  // load the directive's module
  beforeEach(module('vlui', function($provide) {
    $provide.constant('vl', vl);
    $provide.constant('vlSchema', vlSchema);
  }));

  var element, scope, $compile;

  beforeEach(inject(function($rootScope, _$compile_) {
    scope = $rootScope.$new();
    scope.schema = {
      properties: {
        aggregate: {
          supportedEnums: {
            quantitative: ['a', 'b'],
            undefined: []
          }
        },
        timeUnit: {
          supportedEnums: {
            temporal: ['f1','f2']
          }
        },
        bin: {
          supportedTypes: {
            quantitative: true
          }
        }
      }
    };
    scope.pills = {
      x: { type: 'quantitative', field: 'x'},
      y: { aggregate: 'count', field:'*'},
      color: { type: 'temporal', field: 'c'},
      update: function() {}
    };
    scope.encoding = {
      x: { type: 'quantitative', field: 'x'},
      y: { aggregate: 'count', field:'*'},
      color: { type: 'temporal', field: 'c'},
    };
    scope.channel = 'x';
    scope.channel2 = 'y';
    scope.channel3 = 'color';

    $compile = _$compile_;
  }));

  it('should have correct number of radio', function() {
    element = angular.element('<function-select field-def="encoding[channel]" channel="channel" pills="pills"></function-select>');
    element = $compile(element)(scope);
    scope.$digest();
    expect(element.find('input').length).to.eql(21);
  });

  it('should have correct number of radio', function() {
    element = angular.element('<function-select  field-def="encoding[channel3]" channel="channel3" pills="pills"></function-select>');
    element = $compile(element)(scope);
    scope.$digest();
    expect(element.find('input').length).to.eql(25);
  });

  it('should not show other options for count field', function() {
{'fraction_non_alphanumeric': 0.1804358844399392, 'fraction_numerical': 0.00506842372022301, 'mean_word_length': 2.6853408029878616, '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': '5390835', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1174, 'n_words': 248}