<commit_before>//= require extensions/array
//= require filtered_search/dropdown_utils
//= require filtered_search/filtered_search_tokenizer
//= require filtered_search/filtered_search_dropdown_manager

(() => {
  describe('Dropdown Utils', () => {
    describe('getEscapedText', () => {
      it('should return same word when it has no space', () => {
        const escaped = gl.DropdownUtils.getEscapedText('textWithoutSpace');
        expect(escaped).toBe('textWithoutSpace');
      });

      it('should escape with double quotes', () => {
        let escaped = gl.DropdownUtils.getEscapedText('text with space');
        expect(escaped).toBe('"text with space"');

        escaped = gl.DropdownUtils.getEscapedText('won\'t fix');
        expect(escaped).toBe('"won\'t fix"');
      });

      it('should escape with single quotes', () => {
        const escaped = gl.DropdownUtils.getEscapedText('won"t fix');
        expect(escaped).toBe('\'won"t fix\'');
      });

      it('should escape with single quotes by default', () => {
        const escaped = gl.DropdownUtils.getEscapedText('won"t\' fix');
        expect(escaped).toBe('\'won"t\' fix\'');
      });
    });

    describe('filterWithSymbol', () => {
      const item = {
        title: '@root',
      };

      it('should filter without symbol', () => {
        const updatedItem = gl.DropdownUtils.filterWithSymbol('@', item, ':roo');
        expect(updatedItem.droplab_hidden).toBe(false);
      });

      it('should filter with symbol', () => {
        const updatedItem = gl.DropdownUtils.filterWithSymbol('@', item, ':@roo');
        expect(updatedItem.droplab_hidden).toBe(false);
      });

      it('should filter with colon', () => {
        const updatedItem = gl.DropdownUtils.filterWithSymbol('@', item, ':');
        expect(updatedItem.droplab_hidden).toBe(false);
      });
    });

    describe('filterHint', () => {
      it('should filter', () => {
        let updatedItem = gl.DropdownUtils.filterHint({
          hint: 'label',
        }, 'l');
        expect(updatedItem.droplab_hidden).toBe(false);

        updatedItem = gl.DropdownUtils.filterHint({<commit_msg>Teaspoon test fix<commit_after>//= require extensions/array
//= require filtered_search/dropdown_utils
//= require filtered_search/filtered_search_tokenizer
//= require filtered_search/filtered_search_dropdown_manager

(() => {
  describe('Dropdown Utils', () => {
    describe('getEscapedText', () => {
      it('should return same word when it has no space', () => {
        const escaped = gl.DropdownUtils.getEscapedText('textWithoutSpace');
        expect(escaped).toBe('textWithoutSpace');
      });

      it('should escape with double quotes', () => {
        let escaped = gl.DropdownUtils.getEscapedText('text with space');
        expect(escaped).toBe('"text with space"');

        escaped = gl.DropdownUtils.getEscapedText('won\'t fix');
        expect(escaped).toBe('"won\'t fix"');
      });

      it('should escape with single quotes', () => {
        const escaped = gl.DropdownUtils.getEscapedText('won"t fix');
        expect(escaped).toBe('\'won"t fix\'');
      });

      it('should escape with single quotes by default', () => {
        const escaped = gl.DropdownUtils.getEscapedText('won"t\' fix');
        expect(escaped).toBe('\'won"t\' fix\'');
      });
    });

    describe('filterWithSymbol', () => {
      let input;
      const item = {
        title: '@root',
      };

      beforeEach(() => {
        setFixtures(`
          <input type="text" id="test" />
        `);

        input = document.getElementById('test');
      });

      it('should filter without symbol', () => {
        input.value = ':roo';

        const updatedItem = gl.DropdownUtils.filterWithSymbol('@', input, item);
        expect(updatedItem.droplab_hidden).toBe(false);
      });

      it('should filter with symbol', () => {
        input.value = '@roo';

        const updatedItem = gl.DropdownUtils.filterWithSymbol('@', input, item);
        expect(updatedItem.droplab_hidden).toBe(false);
      });

      it('should filter with colon', () => {
        input.value = 'roo';

        const updatedItem = gl.DropdownUtils.filterWithSymbol('@', input, item);
        expect(updatedItem.droplab_hidden).toBe(false);
      });
    });

    describe('filterHint', () => {
      it('should filter', () => {
        let updatedItem = gl.DropdownUtils.filterHint({
          hint: 'label',
        }, 'l');
        expect(updatedItem.droplab_hidden).toBe(false);

        updatedItem = gl.DropdownUtils.filterHint({
{'fraction_non_alphanumeric': 0.16724890829694322, 'fraction_numerical': 0.0, 'mean_word_length': 2.8143213988343048, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 31, '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': '4738197', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1303, 'n_words': 243}