mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
import React from 'react';
|
|
import {mountWithIntl} from '../../helpers/intl-helpers.jsx';
|
|
import NextStepButton from '../../../src/components/join-flow/next-step-button';
|
|
import Spinner from '../../../src/components/spinner/spinner.jsx';
|
|
|
|
describe('NextStepButton', () => {
|
|
const defaultProps = () => ({
|
|
text: 'I am a button',
|
|
waiting: false
|
|
|
|
});
|
|
test('testing spinner does not show and button enabled', () => {
|
|
const component = mountWithIntl(
|
|
<NextStepButton
|
|
{...defaultProps()}
|
|
/>
|
|
);
|
|
expect(component.find(Spinner).exists()).toEqual(false);
|
|
expect(component.find('button[type="submit"]').prop('disabled')).toBe(false);
|
|
|
|
});
|
|
test('testing spinner does show and button disabled', () => {
|
|
const component = mountWithIntl(
|
|
<NextStepButton
|
|
{...defaultProps()}
|
|
/>
|
|
);
|
|
component.setProps({waiting: true});
|
|
expect(component.find(Spinner).exists()).toEqual(true);
|
|
expect(component.find('button[type="submit"]').prop('disabled')).toBe(true);
|
|
});
|
|
});
|