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.15.0.rc2 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.15.0.rc1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.14.1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.14.0 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.14.0.rc3 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.14.0.rc2 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.14.0.rc1.1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.14.0.rc1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.13.1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.13.0 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.12.1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.13.0.rc1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.12.0 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.12.0.rc3 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.12.0.rc2 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.12.0.rc1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.11.1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.11.0 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.11.0.rc2 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js
katello-4.11.0.rc1 webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js