Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions webpack/react_app/components/RegistrationExtension/RexInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,18 @@ import React from 'react';
import PropTypes from 'prop-types';

import { translate as __ } from 'foremanReact/common/I18n';
import LabelIcon from 'foremanReact/components/common/LabelIcon';

import { FormGroup, TextInput, Popover, Icon } from '@patternfly/react-core';

import { HelpIcon } from '@patternfly/react-icons';
import { FormGroup, TextInput } from '@patternfly/react-core';

const RexInterface = ({ isLoading, onChange }) => (
<FormGroup
label={__('Remote Execution Interface')}
fieldId="reg_rex_interface"
labelIcon={
<Popover
bodyContent={
<div>
{__('Identifier of the Host interface for Remote execution')}
</div>
}
>
<button
className="pf-v5-cform__group-label-help"
onClick={e => e.preventDefault()}
>
<Icon isInline>
<HelpIcon />
</Icon>
</button>
</Popover>
<LabelIcon
text={__('Identifier of the Host interface for Remote execution')}
/>
}
>
<TextInput
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import React from 'react';
import { screen, fireEvent, render, act } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import RexInterface from '../RexInterface';

const fixtures = {
renders: { isLoading: false, onChange: () => {} },
};

describe('RexInterface', () =>
testComponentSnapshotsWithFixtures(RexInterface, fixtures));
describe('RexInterface', () => {
it('should render label with help icon and popover instructions', async () => {
jest.useFakeTimers();
render(<RexInterface {...fixtures.renders} />);
await act(async () => {
await fireEvent.click(screen.getByRole('button'));

jest.advanceTimersByTime(500);
});

expect(screen.getByText('Remote Execution Interface')).toBeInTheDocument();
expect(
screen.getByText('Identifier of the Host interface for Remote execution')
).toBeInTheDocument();
});
});

This file was deleted.

Loading