|
@@ -1,40 +1,37 @@
|
|
|
+/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
|
import React from 'react';
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
|
|
-import Button from './Button';
|
|
|
+import Link from './Link';
|
|
|
|
|
|
-describe('Button', () => {
|
|
|
+describe('Link', () => {
|
|
|
it('exists', () => {
|
|
|
- expect(Button).toBeDefined();
|
|
|
+ expect(Link).toBeDefined();
|
|
|
});
|
|
|
|
|
|
it('basic', () => {
|
|
|
- expect(shallow(<Button />)).toMatchSnapshot();
|
|
|
+ expect(shallow(<Link />)).toMatchSnapshot();
|
|
|
});
|
|
|
|
|
|
it('#children', () => {
|
|
|
- expect(shallow(<Button>To infinity and beyond!</Button>)).toMatchSnapshot();
|
|
|
+ expect(shallow(<Link>To infinity and beyond!</Link>)).toMatchSnapshot();
|
|
|
});
|
|
|
|
|
|
it('#accessibleLabel', () => {
|
|
|
expect(
|
|
|
- shallow(<Button accessibleLabel="I am here in the shadows" />),
|
|
|
+ shallow(<Link accessibleLabel="I am here in the shadows" />),
|
|
|
).toMatchSnapshot();
|
|
|
});
|
|
|
|
|
|
- it('#dialogTrigger', () => {
|
|
|
- expect(shallow(<Button dialogTrigger />)).toMatchSnapshot();
|
|
|
- });
|
|
|
-
|
|
|
it('#target', () => {
|
|
|
expect(
|
|
|
- shallow(<Button target="_blank" rel="noreferrer" />),
|
|
|
+ shallow(<Link target="_blank" rel="noreferrer" />),
|
|
|
).toMatchSnapshot();
|
|
|
});
|
|
|
|
|
|
it('is clickable', () => {
|
|
|
const onClick = jest.fn();
|
|
|
- shallow(<Button onClick={onClick} />).simulate('click', {
|
|
|
+ shallow(<Link onClick={onClick} />).simulate('click', {
|
|
|
preventDefault: jest.fn(),
|
|
|
stopPropagation: jest.fn(),
|
|
|
});
|
|
@@ -44,7 +41,7 @@ describe('Button', () => {
|
|
|
it('dismisses click with no href', () => {
|
|
|
// If no href is set, it should prevent default
|
|
|
const preventDefault = jest.fn();
|
|
|
- shallow(<Button />).simulate('click', {
|
|
|
+ shallow(<Link />).simulate('click', {
|
|
|
preventDefault,
|
|
|
stopPropagation: jest.fn(),
|
|
|
});
|
|
@@ -53,7 +50,7 @@ describe('Button', () => {
|
|
|
|
|
|
it('does not dismiss click if href is set', () => {
|
|
|
const preventDefault = jest.fn();
|
|
|
- shallow(<Button href="/admin/" />).simulate('click', {
|
|
|
+ shallow(<Link href="/admin/" />).simulate('click', {
|
|
|
preventDefault,
|
|
|
stopPropagation: jest.fn(),
|
|
|
});
|
|
@@ -65,7 +62,7 @@ describe('Button', () => {
|
|
|
const preventDefault = jest.fn();
|
|
|
const navigate = jest.fn();
|
|
|
|
|
|
- shallow(<Button href="/admin/" navigate={navigate} />).simulate('click', {
|
|
|
+ shallow(<Link href="/admin/" navigate={navigate} />).simulate('click', {
|
|
|
preventDefault,
|
|
|
stopPropagation: jest.fn(),
|
|
|
});
|