Skip to content
This repository was archived by the owner on Sep 26, 2024. It is now read-only.

Commit ac8e278

Browse files
committed
make all tests use promises
1 parent cae50ab commit ac8e278

File tree

22 files changed

+122
-216
lines changed

22 files changed

+122
-216
lines changed

Button/test.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import React from 'react';
22
import { mount } from 'enzyme';
33
import ButtonStateless from '../ButtonStateless';
4+
import { testComponentA11y } from '../lib/a11yTestHelper';
45
import Button from './index';
56

67
describe('Button', () => {
8+
it('should pass accessibility audit', () => testComponentA11y(
9+
<Button>A Button</Button>,
10+
)
11+
.then(results => expect(results.violations.length).toBe(0)));
712
it('should toggle hovered prop when mouseEnter and mouseLeave are triggered', () => {
813
const wrapper = mount(
914
<Button>A Button</Button>,

Card/test.jsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
33
import Card from './index';
44

55
describe('Card', () => {
6-
it('should pass accessibility audit', (done) => {
7-
testComponentA11y(
8-
<Card>
9-
What is a Product Designer? An awesome story by @jgadapee over on Medium!
10-
</Card>, [], (results) => {
11-
expect(results.violations.length).toBe(0);
12-
done();
13-
});
14-
});
6+
it('should pass accessibility audit', () => testComponentA11y(
7+
<Card>
8+
What is a Product Designer? An awesome story by @jgadapee over on Medium!
9+
</Card>,
10+
)
11+
.then(results => expect(results.violations.length).toBe(0)));
1512
});

Icon/test.jsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
33
import ArrowLeftIcon from './Icons/ArrowLeftIcon';
44

55
describe('Icon', () => {
6-
it('should pass accessibility audit', (done) => {
7-
testComponentA11y(<ArrowLeftIcon />, [], (results) => {
8-
expect(results.violations.length).toBe(0);
9-
done();
10-
});
11-
});
6+
it('should pass accessibility audit', () => testComponentA11y(
7+
<ArrowLeftIcon />,
8+
)
9+
.then(results => expect(results.violations.length).toBe(0)));
1210
});

IdTag/test.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
33
import IdTag from './index';
44

55
describe('IdTag', () => {
6-
it('should pass accessibility audit', (done) => {
6+
it('should pass accessibility audit', () => {
77
const children = 'GIF';
8-
testComponentA11y(
8+
return testComponentA11y(
99
<IdTag>
1010
{children}
11-
</IdTag>, [], (results) => {
12-
expect(results.violations.length).toBe(0);
13-
done();
14-
});
11+
</IdTag>,
12+
)
13+
.then(results => expect(results.violations.length).toBe(0));
1514
});
1615
});

Image/test.jsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
33
import Image from './index';
44

55
describe('Image', () => {
6-
it('should pass accessibility audit', (done) => {
7-
testComponentA11y(
8-
<Image
9-
src={'http://lorempixel.com/400/400/cats/'}
10-
height={'14em'}
11-
maxWidth={'10em'}
12-
/>, [], (results) => {
13-
expect(results.violations.length).toBe(0);
14-
done();
15-
});
16-
});
6+
it('should pass accessibility audit', () => testComponentA11y(
7+
<Image
8+
src={'http://lorempixel.com/400/400/cats/'}
9+
height={'14em'}
10+
maxWidth={'10em'}
11+
/>,
12+
)
13+
.then(results => expect(results.violations.length).toBe(0)));
1714
});

Input/test.jsx

Lines changed: 0 additions & 16 deletions
This file was deleted.

InputDate/test.jsx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,6 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
44
import InputDate from './index';
55

66
describe('InputDate', () => {
7-
it('should pass accessibility audit', (done) => {
8-
const onChange = jest.fn();
9-
testComponentA11y(<InputDate
10-
input={{
11-
value: '',
12-
onChange,
13-
}}
14-
initialMonthYear={{
15-
month: 21,
16-
year: 7,
17-
}}
18-
/>, [], (results) => {
19-
expect(results.violations.length).toBe(0);
20-
done();
21-
});
22-
});
237
it('should trigger onChange when active day is clicked', () => {
248
const onChange = jest.fn();
259
const wrapper = mount(

InputEmail/test.jsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

InputTime/test.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
44
import InputTime from './index';
55

66
describe('InputTime', () => {
7-
it('should pass accessibility audit', (done) => {
7+
it('should pass accessibility audit', () => {
88
const onChange = jest.fn();
9-
testComponentA11y(<InputTime
9+
return testComponentA11y(<InputTime
1010
input={{
1111
onChange,
1212
}}
13-
/>, [], (results) => {
14-
expect(results.violations.length).toBe(0);
15-
done();
16-
});
13+
/>,
14+
)
15+
.then(results => expect(results.violations.length).toBe(0));
1716
});
1817
it('should trigger onChange when hour is selected', () => {
1918
const onChange = jest.fn();

Link/test.jsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ import Link from './index';
55
import { testComponentA11y } from '../lib/a11yTestHelper';
66

77
describe('Link', () => {
8-
it('should pass accessibility audit', (done) => {
9-
testComponentA11y(
10-
<Link href={'localhost:8000'}>A Link</Link>, [], (results) => {
11-
expect(results.violations.length).toBe(0);
12-
done();
13-
});
14-
});
8+
it('should pass accessibility audit', () => testComponentA11y(
9+
<Link href={'localhost:8000'}>A Link</Link>,
10+
)
11+
.then(results => expect(results.violations.length).toBe(0)));
1512
it('should toggle hovered prop when mouseEnter and mouseLeave are triggered', () => {
1613
const wrapper = mount(
1714
<Link href={'localhost:8000'}>A Link</Link>,

0 commit comments

Comments
 (0)