Sha256: 9ac608c53b30292d760dadbb98ed2dca67d7d3dd41240cfa2f8faea816163030

Contents?: true

Size: 1.37 KB

Versions: 6

Compression:

Stored size: 1.37 KB

Contents

import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';

import TextButtonField from '../TextButtonField';

const textItem = {
  type: 'text',
};

const selectItem = {
  type: 'select',
  selection: [
    { label: 'A', value: 'a' },
    { label: 'B', value: 'b' },
    { label: 'C', value: 'c' },
  ],
};

const checkboxItem = {
  type: 'checkbox',
};

const blank = { label: 'Bare Metal', value: 'bareMetal' };

const fieldSelector = item => item.type;
const buttonAttrs = { buttonText: 'Button', buttonAction: () => {} };

const fixtures = {
  'should render text item': {
    name: 'Text field',
    item: textItem,
    fieldSelector,
    ...buttonAttrs,
    disabled: false,
    label: 'Text',
    blank: {},
  },
  'should render checkbox item': {
    name: 'Checkbox field',
    item: checkboxItem,
    fieldSelector,
    ...buttonAttrs,
    disabled: false,
    label: 'Checkbox',
    blank: {},
  },
  'should render select item with custom blank opt': {
    name: 'select field',
    item: selectItem,
    fieldSelector,
    ...buttonAttrs,
    label: 'Select',
    disabled: false,
    blank,
  },
  'should render text field without field selector': {
    name: 'no selector',
    label: 'Text field',
    ...buttonAttrs,
    disabled: false,
    blank: {},
  },
};

describe('TextButtonField', () =>
  testComponentSnapshotsWithFixtures(TextButtonField, fixtures));

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_templates-9.2.0 webpack/components/NewTemplateSync/components/__tests__/TextButtonField.test.js
foreman_templates-9.1.0 webpack/components/NewTemplateSync/components/__tests__/TextButtonField.test.js
foreman_templates-9.0.2 webpack/components/NewTemplateSync/components/__tests__/TextButtonField.test.js
foreman_templates-9.0.1 webpack/components/NewTemplateSync/components/__tests__/TextButtonField.test.js
foreman_templates-9.0.0 webpack/components/NewTemplateSync/components/__tests__/TextButtonField.test.js
foreman_templates-8.0.0 webpack/components/NewTemplateSync/components/__tests__/TextButtonField.test.js