Sha256: 379144ad16c0188caf63fd0886e6e5f182f34121f65b1e3fa2d19141bb934163

Contents?: true

Size: 1.02 KB

Versions: 25

Compression:

Stored size: 1.02 KB

Contents

import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import ConfirmDialog from '../ConfirmDialog';

describe('ConfirmDialog', () => {
  const props = {
    show: true,
    onConfirm: () => {},
    onCancel: () => {},
    title: 'Please Confirm',
  };
  const message = 'Proceed with this action?';

  it('renders a confirm dialog', async () => {
    const dialog = shallow(<ConfirmDialog
      {...props}
      {...{ message }}
    />);
    expect(toJson(dialog)).toMatchSnapshot();
  });

  it('enables to override button labels', async () => {
    const dialog = shallow(<ConfirmDialog
      {...props}
      {...{ message }}
      confirmLabel="Custom confirm"
      cancelLabel="Custom cancel"
    />);
    expect(toJson(dialog)).toMatchSnapshot();
  });

  it('enables to set inner html', async () => {
    const dialog = shallow(<ConfirmDialog
      {...props}
      dangerouslySetInnerHTML={{ _html: '<b>Custom</b> html content' }}
    />);
    expect(toJson(dialog)).toMatchSnapshot();
  });
});

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
katello-3.8.0.rc2 webpack/move_to_foreman/components/common/ConfirmDialog/__tests__/ConfirmDialog.test.js
katello-3.7.0 webpack/move_to_foreman/components/common/ConfirmDialog/__tests__/ConfirmDialog.test.js
katello-3.8.0.rc1 webpack/move_to_foreman/components/common/ConfirmDialog/__tests__/ConfirmDialog.test.js
katello-3.7.0.rc2 webpack/move_to_foreman/components/common/ConfirmDialog/__tests__/ConfirmDialog.test.js
katello-3.7.0.rc1 webpack/move_to_foreman/components/common/ConfirmDialog/__tests__/ConfirmDialog.test.js