Skip to content

Commit 51438c9

Browse files
committed
run prettier on src
1 parent f98bcca commit 51438c9

File tree

4 files changed

+111
-54
lines changed

4 files changed

+111
-54
lines changed

__tests__/Parallax.test.js

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import ParallaxController from 'libs/ParallaxController';
77
const log = global.console.log;
88

99
describe('Expect the <Parallax> component', () => {
10-
1110
afterEach(() => {
1211
global.console.log = log;
1312
global.ParallaxController = undefined;
@@ -26,7 +25,7 @@ describe('Expect the <Parallax> component', () => {
2625
};
2726

2827
expect(render).toThrow(
29-
'Must wrap your application\'s <Parallax /> components in a <ParallaxProvider />.'
28+
"Must wrap your application's <Parallax /> components in a <ParallaxProvider />."
3029
);
3130
});
3231

@@ -62,7 +61,7 @@ describe('Expect the <Parallax> component', () => {
6261
const render = () => {
6362
ReactDOM.render(
6463
<ParallaxProvider>
65-
<Parallax offsetYMin={-100} offsetYMax={100}>
64+
<Parallax offsetYMin={-100} offsetYMax={100}>
6665
<div />
6766
</Parallax>
6867
</ParallaxProvider>,
@@ -97,7 +96,7 @@ describe('Expect the <Parallax> component', () => {
9796
const render = () => {
9897
ReactDOM.render(
9998
<ParallaxProvider>
100-
<Parallax ref={ref => instance = ref}>
99+
<Parallax ref={ref => (instance = ref)}>
101100
<div />
102101
</Parallax>
103102
</ParallaxProvider>,
@@ -117,7 +116,7 @@ describe('Expect the <Parallax> component', () => {
117116
global.ParallaxController = ParallaxController.init();
118117
global.ParallaxController.updateElement = jest.fn();
119118
global.ParallaxController.resetElementStyles = jest.fn();
120-
119+
121120
let instance;
122121

123122
class StateChanger extends React.Component {
@@ -129,7 +128,10 @@ describe('Expect the <Parallax> component', () => {
129128

130129
render() {
131130
return (
132-
<Parallax disabled={this.state.disabled} ref={ref => instance = ref} />
131+
<Parallax
132+
disabled={this.state.disabled}
133+
ref={ref => (instance = ref)}
134+
/>
133135
);
134136
}
135137
}
@@ -145,17 +147,22 @@ describe('Expect the <Parallax> component', () => {
145147

146148
render();
147149

148-
expect(global.ParallaxController.updateElement).toBeCalledWith(instance.element, {
149-
props: {
150-
disabled: instance.props.disabled,
151-
offsetXMax: instance.props.offsetXMax,
152-
offsetXMin: instance.props.offsetXMin,
153-
offsetYMax: instance.props.offsetYMax,
154-
offsetYMin: instance.props.offsetYMin,
155-
slowerScrollRate: instance.props.slowerScrollRate,
156-
},
157-
});
150+
expect(global.ParallaxController.updateElement).toBeCalledWith(
151+
instance.element,
152+
{
153+
props: {
154+
disabled: instance.props.disabled,
155+
offsetXMax: instance.props.offsetXMax,
156+
offsetXMin: instance.props.offsetXMin,
157+
offsetYMax: instance.props.offsetYMax,
158+
offsetYMin: instance.props.offsetYMin,
159+
slowerScrollRate: instance.props.slowerScrollRate,
160+
},
161+
}
162+
);
158163

159-
expect(global.ParallaxController.resetElementStyles).toBeCalledWith(instance.element);
164+
expect(global.ParallaxController.resetElementStyles).toBeCalledWith(
165+
instance.element
166+
);
160167
});
161-
});
168+
});

__tests__/ParallaxProvider.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ import ParallaxProvider from 'components/ParallaxProvider';
88
import ParallaxController from 'libs/ParallaxController';
99

1010
describe('A <ParallaxProvider>', () => {
11-
1211
// afterEach(() => )
1312
it('to render children', () => {
1413
const node = document.createElement('div');
1514
let child = jest.fn();
1615
const Child = () => {
1716
child();
18-
return <div />
17+
return <div />;
1918
};
2019

2120
const render = () => {

__tests__/propValidation.test.js

Lines changed: 84 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,109 @@
11
import { offsetMin, offsetMax } from 'utils/propValidation';
22

33
describe('offsetMin prop validation', () => {
4-
54
it('returns null when provided a valid value', () => {
65
expect(offsetMin({ offsetXMin: -100 }, 'offsetXMin', 'foo')).toBe(null);
7-
expect(offsetMin({ offsetXMin: '-10321px' }, 'offsetXMin', 'foo')).toBe(null);
8-
expect(offsetMin({ offsetXMin: '-10%' }, 'offsetXMin', 'foo')).toBe(null);
6+
expect(offsetMin({ offsetXMin: '-10321px' }, 'offsetXMin', 'foo')).toBe(
7+
null
8+
);
9+
expect(offsetMin({ offsetXMin: '-10%' }, 'offsetXMin', 'foo')).toBe(
10+
null
11+
);
912
});
1013

1114
it('throws when provided a invalid value type', () => {
12-
const error = new Error('[offsetXMin] in foo must be a string with with "%"" or "px" units or number.');
13-
expect(offsetMin({ offsetXMin: false }, 'offsetXMin', 'foo')).toEqual(error);
14-
expect(offsetMin({ offsetXMin: {} }, 'offsetXMin', 'foo')).toEqual(error);
15-
expect(offsetMin({ offsetXMin: null }, 'offsetXMin', 'foo')).toEqual(error);
16-
expect(offsetMin({ offsetXMin: undefined }, 'offsetXMin', 'foo')).toEqual(error);
17-
expect(offsetMin({ offsetXMin: [] }, 'offsetXMin', 'foo')).toEqual(error);
15+
const error = new Error(
16+
'[offsetXMin] in foo must be a string with with "%"" or "px" units or number.'
17+
);
18+
expect(offsetMin({ offsetXMin: false }, 'offsetXMin', 'foo')).toEqual(
19+
error
20+
);
21+
expect(offsetMin({ offsetXMin: {} }, 'offsetXMin', 'foo')).toEqual(
22+
error
23+
);
24+
expect(offsetMin({ offsetXMin: null }, 'offsetXMin', 'foo')).toEqual(
25+
error
26+
);
27+
expect(
28+
offsetMin({ offsetXMin: undefined }, 'offsetXMin', 'foo')
29+
).toEqual(error);
30+
expect(offsetMin({ offsetXMin: [] }, 'offsetXMin', 'foo')).toEqual(
31+
error
32+
);
1833
});
1934

2035
it('throws when provided a invalid value', () => {
21-
const error = new Error('[offsetXMin] in foo is greater than zero. [offsetXMin] must be less than or equal to zero.')
22-
expect(offsetMin({ offsetXMin: 100 }, 'offsetXMin', 'foo')).toEqual(error);
23-
expect(offsetMin({ offsetXMin: 1 }, 'offsetXMin', 'foo')).toEqual(error);
24-
expect(offsetMin({ offsetXMin: 0.0009 }, 'offsetXMin', 'foo')).toEqual(error);
25-
expect(offsetMin({ offsetXMin: '100px' }, 'offsetXMin', 'foo')).toEqual(error);
26-
expect(offsetMin({ offsetXMin: '99%' }, 'offsetXMin', 'foo')).toEqual(error);
36+
const error = new Error(
37+
'[offsetXMin] in foo is greater than zero. [offsetXMin] must be less than or equal to zero.'
38+
);
39+
expect(offsetMin({ offsetXMin: 100 }, 'offsetXMin', 'foo')).toEqual(
40+
error
41+
);
42+
expect(offsetMin({ offsetXMin: 1 }, 'offsetXMin', 'foo')).toEqual(
43+
error
44+
);
45+
expect(offsetMin({ offsetXMin: 0.0009 }, 'offsetXMin', 'foo')).toEqual(
46+
error
47+
);
48+
expect(offsetMin({ offsetXMin: '100px' }, 'offsetXMin', 'foo')).toEqual(
49+
error
50+
);
51+
expect(offsetMin({ offsetXMin: '99%' }, 'offsetXMin', 'foo')).toEqual(
52+
error
53+
);
2754
});
28-
2955
});
3056

3157
describe('offsetMax prop validation', () => {
32-
3358
it('returns null when provided a valid value', () => {
3459
expect(offsetMax({ offsetXMax: 100 }, 'offsetXMax', 'foo')).toBe(null);
35-
expect(offsetMax({ offsetXMax: '10321px' }, 'offsetXMax', 'foo')).toBe(null);
36-
expect(offsetMax({ offsetXMax: '10%' }, 'offsetXMax', 'foo')).toBe(null);
60+
expect(offsetMax({ offsetXMax: '10321px' }, 'offsetXMax', 'foo')).toBe(
61+
null
62+
);
63+
expect(offsetMax({ offsetXMax: '10%' }, 'offsetXMax', 'foo')).toBe(
64+
null
65+
);
3766
});
3867

3968
it('throws when provided a invalid value type', () => {
40-
const error = new Error('[offsetXMax] in foo must be a string with with "%"" or "px" units or number.');
41-
expect(offsetMax({ offsetXMax: false }, 'offsetXMax', 'foo')).toEqual(error);
42-
expect(offsetMax({ offsetXMax: {} }, 'offsetXMax', 'foo')).toEqual(error);
43-
expect(offsetMax({ offsetXMax: null }, 'offsetXMax', 'foo')).toEqual(error);
44-
expect(offsetMax({ offsetXMax: undefined }, 'offsetXMax', 'foo')).toEqual(error);
45-
expect(offsetMax({ offsetXMax: [] }, 'offsetXMax', 'foo')).toEqual(error);
69+
const error = new Error(
70+
'[offsetXMax] in foo must be a string with with "%"" or "px" units or number.'
71+
);
72+
expect(offsetMax({ offsetXMax: false }, 'offsetXMax', 'foo')).toEqual(
73+
error
74+
);
75+
expect(offsetMax({ offsetXMax: {} }, 'offsetXMax', 'foo')).toEqual(
76+
error
77+
);
78+
expect(offsetMax({ offsetXMax: null }, 'offsetXMax', 'foo')).toEqual(
79+
error
80+
);
81+
expect(
82+
offsetMax({ offsetXMax: undefined }, 'offsetXMax', 'foo')
83+
).toEqual(error);
84+
expect(offsetMax({ offsetXMax: [] }, 'offsetXMax', 'foo')).toEqual(
85+
error
86+
);
4687
});
4788

4889
it('throws when provided a invalid value', () => {
49-
const error = new Error('[offsetXMax] in foo is less than zero. [offsetXMax] must be greater than or equal to zero.')
50-
expect(offsetMax({ offsetXMax: -100 }, 'offsetXMax', 'foo')).toEqual(error);
51-
expect(offsetMax({ offsetXMax: -1 }, 'offsetXMax', 'foo')).toEqual(error);
52-
expect(offsetMax({ offsetXMax: -0.0009 }, 'offsetXMax', 'foo')).toEqual(error);
53-
expect(offsetMax({ offsetXMax: '-100px' }, 'offsetXMax', 'foo')).toEqual(error);
54-
expect(offsetMax({ offsetXMax: '-99%' }, 'offsetXMax', 'foo')).toEqual(error);
90+
const error = new Error(
91+
'[offsetXMax] in foo is less than zero. [offsetXMax] must be greater than or equal to zero.'
92+
);
93+
expect(offsetMax({ offsetXMax: -100 }, 'offsetXMax', 'foo')).toEqual(
94+
error
95+
);
96+
expect(offsetMax({ offsetXMax: -1 }, 'offsetXMax', 'foo')).toEqual(
97+
error
98+
);
99+
expect(offsetMax({ offsetXMax: -0.0009 }, 'offsetXMax', 'foo')).toEqual(
100+
error
101+
);
102+
expect(
103+
offsetMax({ offsetXMax: '-100px' }, 'offsetXMax', 'foo')
104+
).toEqual(error);
105+
expect(offsetMax({ offsetXMax: '-99%' }, 'offsetXMax', 'foo')).toEqual(
106+
error
107+
);
55108
});
56-
57109
});

__tests__/testForPassiveScroll.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ const addEventListener = window.addEventListener;
44
const removeEventListener = window.removeEventListener;
55

66
describe('Expect the testForPassiveScroll function', () => {
7-
87
afterEach(() => {
98
window.addEventListener = addEventListener;
109
window.removeEventListener = removeEventListener;
1110
});
1211

1312
it('to return a boolean', () => {
1413
const bool = testForPassiveScroll();
15-
expect(bool).toBe(false)
14+
expect(bool).toBe(false);
1615
});
1716

1817
it('to add and remove a test listener', () => {

0 commit comments

Comments
 (0)