Sha256: 2fb937ce031f5660cb9e9654f722a465aa2e1880f032ef7fdec62e7ea59bb375
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
import React from 'react'; import { Provider } from 'react-redux'; import { fireEvent, screen, render, act } from '@testing-library/react'; import * as api from 'foremanReact/redux/API'; import { JobWizard } from '../../../JobWizard'; import * as selectors from '../../../JobWizardSelectors'; import { testSetup, mockApi } from '../../../__tests__/fixtures'; import { WIZARD_TITLES } from '../../../JobWizardConstants'; const store = testSetup(selectors, api); mockApi(api); describe('TemplateInputs', () => { it('should save data between steps for template input fields', async () => { render( <Provider store={store}> <JobWizard /> </Provider> ); await act(async () => { fireEvent.click(screen.getByText(WIZARD_TITLES.hostsAndInputs)); }); const textValue = 'I am a plain text'; const textField = screen.getByLabelText('plain hidden', { selector: 'textarea', }); await act(async () => { await fireEvent.change(textField, { target: { value: textValue }, }); }); expect( screen.getByLabelText('plain hidden', { selector: 'textarea', }).value ).toBe(textValue); await act(async () => { fireEvent.click(screen.getByText(WIZARD_TITLES.categoryAndTemplate)); }); expect(screen.getAllByText(WIZARD_TITLES.categoryAndTemplate)).toHaveLength( 3 ); await act(async () => { fireEvent.click(screen.getByText(WIZARD_TITLES.hostsAndInputs)); }); expect(textField.value).toBe(textValue); }); });
Version data entries
2 entries across 2 versions & 1 rubygems