2018-04-13 15:33:03 +01:00
|
|
|
/* global expect */
|
|
|
|
|
2019-11-08 13:20:25 +02:00
|
|
|
import '@testing-library/jest-dom/extend-expect';
|
2018-04-13 15:33:03 +01:00
|
|
|
import React from 'react';
|
2019-11-08 13:20:25 +02:00
|
|
|
import { render } from '@testing-library/react';
|
2018-04-13 15:33:03 +01:00
|
|
|
|
|
|
|
import BlockSaveButton from './BlockSaveButton';
|
|
|
|
|
|
|
|
test('<BlockSaveButton /> snapshot', () => {
|
2019-11-08 13:20:25 +02:00
|
|
|
const { container } = render(<BlockSaveButton />);
|
|
|
|
|
|
|
|
expect(container).toMatchSnapshot();
|
2018-04-13 15:33:03 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Button text should default to "Save"', () => {
|
2019-11-08 13:20:25 +02:00
|
|
|
const { getByRole } = render(<BlockSaveButton />);
|
2018-04-13 15:33:03 +01:00
|
|
|
|
2019-11-08 13:20:25 +02:00
|
|
|
expect(getByRole('button')).toHaveTextContent('Save');
|
2018-04-13 15:33:03 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Button text should match "children"', () => {
|
2019-11-08 13:20:25 +02:00
|
|
|
const testText = 'My Text Here';
|
|
|
|
const { getByRole } = render(<BlockSaveButton>{testText}</BlockSaveButton>);
|
2018-04-13 15:33:03 +01:00
|
|
|
|
2019-11-08 13:20:25 +02:00
|
|
|
expect(getByRole('button')).toHaveTextContent(testText);
|
2018-04-13 15:33:03 +01:00
|
|
|
});
|