<commit_before>import React from 'react';
import {mountWithIntl} from '../../helpers/intl-helpers.jsx';
import JoinFlowStep from '../../../src/components/join-flow/join-flow-step';

describe('JoinFlowStep', () => {

    test('components exist when props present', () => {
        const props = {
            children: null,
            className: 'join-flow-step-class',
            description: 'description text',
            headerImgSrc: '/image.png',
            onSubmit: jest.fn(),
            nextButton: 'some stuff',
            title: 'join flow step title',
            waiting: true
        };
        const component = mountWithIntl(
            <JoinFlowStep
                {...props}
            />
        );
        expect(component.find('div.join-flow-header-image').exists()).toEqual(true);
        expect(component.find({src: props.headerImgSrc}).exists()).toEqual(true);

        expect(component.find('.join-flow-inner-content').exists()).toEqual(true);
        expect(component.find('.join-flow-title').exists()).toEqual(true);

        expect(component.find('.join-flow-title').first()
            .prop('title')).toEqual(props.title);

        expect(component.find('div.join-flow-description').exists()).toEqual(true);
        expect(component.find('div.join-flow-description').text()).toEqual(props.description);


        expect(component.find('NextStepButton').prop('waiting')).toEqual(true);
        expect(component.find('NextStepButton').prop('content')).toEqual(props.nextButton);

        component.unmount();
    });

    test('components do not exist when props not present', () => {
        const component = mountWithIntl(
            <JoinFlowStep />
        );

        expect(component.find('div.join-flow-header-image').exists()).toEqual(false);
        expect(component.find('.join-flow-inner-content').exists()).toEqual(true);
        expect(component.find('.join-flow-title').exists()).toEqual(false);
        expect(component.find('div.join-flow-description').exists()).toEqual(false);
        expect(component.find('NextStepButton').prop('waiting')).toEqual(false);

        component.unmount();
    });

    test('clicking submit calls passed in function', () => {
        const props = {
            onSubmit: jest.fn()
        };
        const component = mountWithIntl(
            <JoinFlowStep
                {...props}
            />
        );
        component.find('button[type="submit"]').simulate('submit');
        expect(props.onSubmit).toHaveBeenCalled();
        component.unmount();
    });
});
<commit_msg>Remove some whitespace.<commit_after>import React from 'react';
import {mountWithIntl} from '../../helpers/intl-helpers.jsx';
import JoinFlowStep from '../../../src/components/join-flow/join-flow-step';

describe('JoinFlowStep', () => {

    test('components exist when props present', () => {
        const props = {
            children: null,
            className: 'join-flow-step-class',
            description: 'description text',
            headerImgSrc: '/image.png',
            onSubmit: jest.fn(),
            nextButton: 'some stuff',
            title: 'join flow step title',
            waiting: true
        };
        const component = mountWithIntl(
            <JoinFlowStep
                {...props}
            />
        );
        expect(component.find('div.join-flow-header-image').exists()).toEqual(true);
        expect(component.find({src: props.headerImgSrc}).exists()).toEqual(true);
        expect(component.find('.join-flow-inner-content').exists()).toEqual(true);
        expect(component.find('.join-flow-title').exists()).toEqual(true);
        expect(component.find('.join-flow-title').first()
            .prop('title')).toEqual(props.title);
        expect(component.find('div.join-flow-description').exists()).toEqual(true);
        expect(component.find('div.join-flow-description').text()).toEqual(props.description);
        expect(component.find('NextStepButton').prop('waiting')).toEqual(true);
        expect(component.find('NextStepButton').prop('content')).toEqual(props.nextButton);

        component.unmount();
    });

    test('components do not exist when props not present', () => {
        const component = mountWithIntl(
            <JoinFlowStep />
        );

        expect(component.find('div.join-flow-header-image').exists()).toEqual(false);
        expect(component.find('.join-flow-inner-content').exists()).toEqual(true);
        expect(component.find('.join-flow-title').exists()).toEqual(false);
        expect(component.find('div.join-flow-description').exists()).toEqual(false);
        expect(component.find('NextStepButton').prop('waiting')).toEqual(false);

        component.unmount();
    });

    test('clicking submit calls passed in function', () => {
        const props = {
            onSubmit: jest.fn()
        };
        const component = mountWithIntl(
            <JoinFlowStep
                {...props}
            />
        );
        component.find('button[type="submit"]').simulate('submit');
        expect(props.onSubmit).toHaveBeenCalled();
        component.unmount();
    });
});

{'fraction_non_alphanumeric': 0.172132738210751, 'fraction_numerical': 0.0, 'mean_word_length': 2.5180887372013654, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2484680', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1383, 'n_words': 190}