Sha256: 370c1a5ebdec6672e6b3657a08510bf40c025089cb63e909d83259d0e84038c7

Contents?: true

Size: 1.12 KB

Versions: 99

Compression:

Stored size: 1.12 KB

Contents

import React from 'react';
import { render } from 'react-testing-lib-wrapper';

import SelectableDropdown from '../SelectableDropdown';

const type = 'Breakfast';

test('Can dynamically load options', async () => {
  const { rerender, queryByText, queryByLabelText } = render(<SelectableDropdown
    items={[]}
    title={type}
    selected=""
    setSelected={jest.fn}
    placeholderText={type}
    loading
    error={false}
  />);
  expect(queryByLabelText(`${type} spinner`)).toBeInTheDocument();

  rerender(<SelectableDropdown
    items={['donut', 'croissant', 'bear claw']}
    title={type}
    selected=""
    setSelected={jest.fn}
    placeholderText={type}
    loading={false}
    error={false}
  />);
  expect(queryByLabelText(`${type} spinner`)).not.toBeInTheDocument();
  expect(queryByText('donut')).toBeInTheDocument();
});


test('Can handle error', async () => {
  const { queryByLabelText } = render(<SelectableDropdown
    items={[]}
    title={type}
    selected=""
    setSelected={jest.fn}
    placeholderText={type}
    loading={false}
    error
  />);
  expect(queryByLabelText(`${type} error`)).toBeInTheDocument();
});

Version data entries

99 entries across 99 versions & 1 rubygems

Version Path
katello-4.3.1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.4.0 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.4.0.rc2 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.4.0.rc1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.2.2 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.3.0 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.3.0.rc4 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.3.0.rc3 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.3.0.rc2.1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.3.0.rc2 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.3.0.rc1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.2.1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.2.0.1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.1.4 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.0.3 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.2.0.1.rc3 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.2.0.1.rc2 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.2.0.rc2 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.1.3 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.2.0.rc1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js