Sha256: 398a22b44899e7b8fbb74b01946cd168e1b5ca283392ed891773aec1348bf674

Contents?: true

Size: 925 Bytes

Versions: 54

Compression:

Stored size: 925 Bytes

Contents

import React from 'react';
import { render, fireEvent, screen } from '@testing-library/react';
import { SearchSelect } from '../SearchSelect';

const apiKey = 'HOSTS_KEY';

describe('SearchSelect', () => {
  it('too many', () => {
    const onSearch = jest.fn();
    render(
      <SearchSelect
        selected={['hosts1,host2']}
        setSelected={jest.fn()}
        apiKey={apiKey}
        url="/hosts"
        placeholderText="Test hosts"
        useNameSearch={() => [
          onSearch,
          { results: ['host1', 'host2', 'host3'], subtotal: 101 },
          false,
        ]}
      />
    );
    const openSelectbutton = screen.getByRole('button', {
      name: 'typeahead select toggle',
    });
    fireEvent.click(openSelectbutton);
    const tooMany = screen.queryAllByText(
      'You have %s results to display. Showing first %s results + 101 + 100'
    );
    expect(tooMany).toHaveLength(1);
  });
});

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
foreman_remote_execution-12.0.7 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-10.1.3 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-12.0.5 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-12.0.4 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-12.0.1 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-12.0.2 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-11.1.3 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-10.1.2 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-12.0.0 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-10.1.1 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-11.1.1 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-11.1.0 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-10.1.0 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-8.3.3 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-8.3.2 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-11.0.0 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-10.0.7 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-8.3.1 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-10.0.6 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js
foreman_remote_execution-10.0.5 webpack/JobWizard/steps/form/__tests__/SelectSearch.test.js