mirror of
https://gh.wpcy.net/https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2026-05-03 06:19:01 +08:00
Some checks failed
CI / PHP 7.4 (push) Has been cancelled
CI / PHP 8.0 (push) Has been cancelled
CI / PHP 8.1 (push) Has been cancelled
CI / PHP 8.2 (push) Has been cancelled
CI / PHP 8.3 (push) Has been cancelled
CI / PHP 8.4 (push) Has been cancelled
PR Playground Demo / prepare_version (push) Has been cancelled
PR Playground Demo / build_plugin (push) Has been cancelled
PR Playground Demo / create_archive (push) Has been cancelled
PR Playground Demo / Comment on PR with Playground details (push) Has been cancelled
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
import { render, screen } from '@testing-library/react';
|
|
import '@testing-library/jest-dom';
|
|
import Notice from './Notice';
|
|
|
|
describe( 'Notice Component', () => {
|
|
it('it renders with the default params', () => {
|
|
render(<Notice>Test</Notice>);
|
|
const element = screen.getByText('Test');
|
|
|
|
expect(element).toBeInTheDocument();
|
|
expect(element.tagName).toBe('SPAN');
|
|
expect(element).toHaveClass('ppcp--notice');
|
|
expect(element).toHaveClass('type--info');
|
|
});
|
|
|
|
it('it loads the type param in the class', () => {
|
|
render(<Notice type="syde">Test</Notice>);
|
|
const element = screen.getByText('Test');
|
|
|
|
expect(element).toBeInTheDocument();
|
|
expect(element).toHaveClass('type--syde');
|
|
expect(element).not.toHaveClass('type--info');
|
|
});
|
|
|
|
it('it loads ustom classnames', () => {
|
|
render(<Notice className="test">Test</Notice>);
|
|
const element = screen.getByText('Test');
|
|
|
|
expect(element).toBeInTheDocument();
|
|
expect(element).toHaveClass('test');
|
|
});
|
|
|
|
});
|