Sha256: 39d5dbab7a9692cc564900683b29f233c55d973f6fe06576032fba56014a7a85

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

/* eslint-disable promise/prefer-await-to-then */
// Configure Enzyme
import { mount, shallow } from '@theforeman/test';
import React from 'react';
import SCCGenericExpander from './index';

describe('SCCGenericExpander', () => {
  it('renders default properties', () => {
    const wrapper = mount(
      <SCCGenericExpander
        setInParent={() => {}}
        selectOptionOpen="open"
        selectOptionClose="close"
        initLabel="open/close"
      />
    );

    expect(wrapper.find('SCCGenericExpander')).toHaveLength(1);
    expect(wrapper.find('Flex')).toHaveLength(1);
    expect(wrapper.find('FlexItem')).toHaveLength(1);
    expect(wrapper.find('Select')).toHaveLength(1);
  });

  it('passes properties', () => {
    const wrapper = shallow(
      <SCCGenericExpander
        setInParent={() => {}}
        selectOptionOpen="open"
        selectOptionClose="close"
        initLabel="open/close"
      />
    );

    // Select
    const select = wrapper.find('Select');
    expect(select.exists()).toBe(true);
    expect(select.props()).toHaveProperty('selections');
    expect(select.prop('selections')).toContain('open/close');

    // SelectOptions
    const selectOptions = wrapper.find('SelectOption');
    expect(selectOptions).toHaveLength(2);
    const optionValues = selectOptions.map((option) => option.prop('value'));
    expect(optionValues).toContain('open');
    expect(optionValues).toContain('close');
  });
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_scc_manager-4.0.0 webpack/components/SCCProductPage/components/common/SCCGenericExpander/SCCGenericExpander.test.js
foreman_scc_manager-3.1.1 webpack/components/SCCProductPage/components/common/SCCGenericExpander/SCCGenericExpander.test.js
foreman_scc_manager-3.1.0 webpack/components/SCCProductPage/components/common/SCCGenericExpander/SCCGenericExpander.test.js