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

Commit

Permalink
make all tests use promises
Browse files Browse the repository at this point in the history
  • Loading branch information
emplums committed Jun 29, 2017
1 parent cae50ab commit ac8e278
Show file tree
Hide file tree
Showing 22 changed files with 122 additions and 216 deletions.
5 changes: 5 additions & 0 deletions Button/test.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import React from 'react';
import { mount } from 'enzyme';
import ButtonStateless from '../ButtonStateless';
import { testComponentA11y } from '../lib/a11yTestHelper';
import Button from './index';

describe('Button', () => {
it('should pass accessibility audit', () => testComponentA11y(
<Button>A Button</Button>,
)
.then(results => expect(results.violations.length).toBe(0)));
it('should toggle hovered prop when mouseEnter and mouseLeave are triggered', () => {
const wrapper = mount(
<Button>A Button</Button>,
Expand Down
15 changes: 6 additions & 9 deletions Card/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import Card from './index';

describe('Card', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(
<Card>
What is a Product Designer? An awesome story by @jgadapee over on Medium!
</Card>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<Card>
What is a Product Designer? An awesome story by @jgadapee over on Medium!
</Card>,
)
.then(results => expect(results.violations.length).toBe(0)));
});
10 changes: 4 additions & 6 deletions Icon/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import ArrowLeftIcon from './Icons/ArrowLeftIcon';

describe('Icon', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(<ArrowLeftIcon />, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<ArrowLeftIcon />,
)
.then(results => expect(results.violations.length).toBe(0)));
});
11 changes: 5 additions & 6 deletions IdTag/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import IdTag from './index';

describe('IdTag', () => {
it('should pass accessibility audit', (done) => {
it('should pass accessibility audit', () => {
const children = 'GIF';
testComponentA11y(
return testComponentA11y(
<IdTag>
{children}
</IdTag>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
</IdTag>,
)
.then(results => expect(results.violations.length).toBe(0));
});
});
19 changes: 8 additions & 11 deletions Image/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import Image from './index';

describe('Image', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(
<Image
src={'http://lorempixel.com/400/400/cats/'}
height={'14em'}
maxWidth={'10em'}
/>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<Image
src={'http://lorempixel.com/400/400/cats/'}
height={'14em'}
maxWidth={'10em'}
/>,
)
.then(results => expect(results.violations.length).toBe(0)));
});
16 changes: 0 additions & 16 deletions Input/test.jsx

This file was deleted.

16 changes: 0 additions & 16 deletions InputDate/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import InputDate from './index';

describe('InputDate', () => {
it('should pass accessibility audit', (done) => {
const onChange = jest.fn();
testComponentA11y(<InputDate
input={{
value: '',
onChange,
}}
initialMonthYear={{
month: 21,
year: 7,
}}
/>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should trigger onChange when active day is clicked', () => {
const onChange = jest.fn();
const wrapper = mount(
Expand Down
18 changes: 0 additions & 18 deletions InputEmail/test.jsx

This file was deleted.

11 changes: 5 additions & 6 deletions InputTime/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import InputTime from './index';

describe('InputTime', () => {
it('should pass accessibility audit', (done) => {
it('should pass accessibility audit', () => {
const onChange = jest.fn();
testComponentA11y(<InputTime
return testComponentA11y(<InputTime
input={{
onChange,
}}
/>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
/>,
)
.then(results => expect(results.violations.length).toBe(0));
});
it('should trigger onChange when hour is selected', () => {
const onChange = jest.fn();
Expand Down
11 changes: 4 additions & 7 deletions Link/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ import Link from './index';
import { testComponentA11y } from '../lib/a11yTestHelper';

describe('Link', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(
<Link href={'localhost:8000'}>A Link</Link>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<Link href={'localhost:8000'}>A Link</Link>,
)
.then(results => expect(results.violations.length).toBe(0)));
it('should toggle hovered prop when mouseEnter and mouseLeave are triggered', () => {
const wrapper = mount(
<Link href={'localhost:8000'}>A Link</Link>,
Expand Down
11 changes: 4 additions & 7 deletions LinkStateless/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import LinkStateless from './index';

describe('LinkStateless', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(
<LinkStateless href={'https://buffer.com'}>Buffer</LinkStateless>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<LinkStateless href={'https://buffer.com'}>Buffer</LinkStateless>,
)
.then(results => expect(results.violations.length).toBe(0)));
});
29 changes: 13 additions & 16 deletions LinkifiedText/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import LinkifiedText from './index';

describe('LinkifiedText', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(
<LinkifiedText
links={[{
rawString: 'http://t.co/0JG5Mcq',
displayString: 'blog.twitter.com/2011/05/twitte…',
url: 'http://blog.twitter.com/2011/05/twitter-for-mac-update.html',
indices: [2, 21],
}]}
>
{'a http://t.co/0JG5Mcq b'}
</LinkifiedText>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<LinkifiedText
links={[{
rawString: 'http://t.co/0JG5Mcq',
displayString: 'blog.twitter.com/2011/05/twitte…',
url: 'http://blog.twitter.com/2011/05/twitter-for-mac-update.html',
indices: [2, 21],
}]}
>
{'a http://t.co/0JG5Mcq b'}
</LinkifiedText>,
)
.then(results => expect(results.violations.length).toBe(0)));
});
11 changes: 4 additions & 7 deletions List/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import List from './index';

describe('List', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(
<List items={['apples', 'bananas', 'oranges']} />, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<List items={['apples', 'bananas', 'oranges']} />,
)
.then(results => expect(results.violations.length).toBe(0)));
});
11 changes: 4 additions & 7 deletions Loader/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import Loader from './index';

describe('Loader', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(
<Loader>Some neat loading text!</Loader>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<Loader>Some neat loading text!</Loader>,
)
.then(results => expect(results.violations.length).toBe(0)));
});
27 changes: 12 additions & 15 deletions MultipleImages/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import MultipleImages from './index';

describe('MultipleImages', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(
<MultipleImages
width={'20rem'}
height={'20rem'}
urls={[
'http://lorempixel.com/400/400/cats/',
'http://lorempixel.com/400/400/cats/',
'http://lorempixel.com/400/400/cats/',
]}
/>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<MultipleImages
width={'20rem'}
height={'20rem'}
urls={[
'http://lorempixel.com/400/400/cats/',
'http://lorempixel.com/400/400/cats/',
'http://lorempixel.com/400/400/cats/',
]}
/>,
)
.then(results => expect(results.violations.length).toBe(0)));
});
11 changes: 4 additions & 7 deletions NavBar/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import NavBar from './index';

describe('NavBar', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(
<NavBar subtitle={'NavBar'} />, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<NavBar subtitle={'NavBar'} />,
)
.then(results => expect(results.violations.length).toBe(0)));
});
17 changes: 7 additions & 10 deletions Overlay/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ import Overlay from './index';
import Image from '../Image/index';

describe('Overlay', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(
<div style={{ textAlign: 'center' }}>
<Image src={'http://lorempixel.com/400/400/cats/'} />
<Overlay transparent />
</div>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<div style={{ textAlign: 'center' }}>
<Image src={'http://lorempixel.com/400/400/cats/'} />
<Overlay transparent />
</div>,
)
.then(results => expect(results.violations.length).toBe(0)));
});
15 changes: 6 additions & 9 deletions Popover/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ import Popover from './index';
import Card from '../Card/index';

describe('Popover', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(
<Popover>
<Card>Popover</Card>
</Popover>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<Popover>
<Card>Popover</Card>
</Popover>,
)
.then(results => expect(results.violations.length).toBe(0)));
});
15 changes: 6 additions & 9 deletions SectionHeader/test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ import { testComponentA11y } from '../lib/a11yTestHelper';
import SectionHeader from './index';

describe('SectionHeader', () => {
it('should pass accessibility audit', (done) => {
testComponentA11y(
<SectionHeader>
A section title
</SectionHeader>, [], (results) => {
expect(results.violations.length).toBe(0);
done();
});
});
it('should pass accessibility audit', () => testComponentA11y(
<SectionHeader>
A section title
</SectionHeader>,
)
.then(results => expect(results.violations.length).toBe(0)));
});
Loading

0 comments on commit ac8e278

Please sign in to comment.