Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 950484a

Browse files
fix: tests
1 parent e64f547 commit 950484a

File tree

3 files changed

+36
-27
lines changed

3 files changed

+36
-27
lines changed

‎src/components/Parallax/index.test.tsx‎

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ describe('given the <Parallax> component', () => {
108108
wrapper: Wrapper,
109109
});
110110
expect(asFragment()).toMatchSnapshot();
111-
expect(controller.createElement).toBeCalledWith({
111+
expect(controller.createElement).toHaveBeenCalledWith({
112112
el: expect.any(HTMLElement),
113113
props,
114114
});
@@ -126,7 +126,7 @@ describe('given the <Parallax> component', () => {
126126
<Parallax translateY={[-100, 100]} />
127127
</MockProvider>
128128
);
129-
expect(controller.createElement).toBeCalledWith({
129+
expect(controller.createElement).toHaveBeenCalledWith({
130130
el: expect.any(HTMLElement),
131131
props: { translateY: [-100, 100] },
132132
});
@@ -147,7 +147,7 @@ describe('given the <Parallax> component', () => {
147147
);
148148
const element = controller.getElements()[0];
149149
unmount();
150-
expect(controller.removeElementById).toBeCalledWith(element.id);
150+
expect(controller.removeElementById).toHaveBeenCalledWith(element.id);
151151
});
152152

153153
it('then it updates an element in the controller when receiving relevant new props', () => {
@@ -178,11 +178,14 @@ describe('given the <Parallax> component', () => {
178178

179179
const element = controller.getElements()[0];
180180

181-
expect(controller.updateElementPropsById).toBeCalledWith(element.id, {
182-
disabled: false,
183-
translateX: [100, -100],
184-
translateY: [-100, 100],
185-
});
181+
expect(controller.updateElementPropsById).toHaveBeenCalledWith(
182+
element.id,
183+
{
184+
disabled: false,
185+
translateX: [100, -100],
186+
translateY: [-100, 100],
187+
}
188+
);
186189

187190
const newProps = {
188191
disabled: false,
@@ -198,11 +201,14 @@ describe('given the <Parallax> component', () => {
198201
/>
199202
);
200203

201-
expect(controller.updateElementPropsById).toBeCalledWith(element.id, {
202-
disabled: false,
203-
translateX: [-40, -60],
204-
translateY: [10, 80],
205-
});
204+
expect(controller.updateElementPropsById).toHaveBeenCalledWith(
205+
element.id,
206+
{
207+
disabled: false,
208+
translateX: [-40, -60],
209+
translateY: [10, 80],
210+
}
211+
);
206212

207213
// only update with valid props
208214
rerender(
@@ -254,12 +260,15 @@ describe('given the <Parallax> component', () => {
254260

255261
const element = controller.getElements()[0];
256262

257-
expect(controller.resetElementStyles).toBeCalledWith(element);
258-
expect(controller.updateElementPropsById).toBeCalledWith(element.id, {
259-
disabled: true,
260-
translateX: [100, -100],
261-
translateY: [-100, 100],
262-
});
263+
expect(controller.resetElementStyles).toHaveBeenCalledWith(element);
264+
expect(controller.updateElementPropsById).toHaveBeenCalledWith(
265+
element.id,
266+
{
267+
disabled: true,
268+
translateX: [100, -100],
269+
translateY: [-100, 100],
270+
}
271+
);
263272
});
264273

265274
it('then it resets styles on an element if the disabled prop is true', () => {
@@ -290,7 +299,7 @@ describe('given the <Parallax> component', () => {
290299
<Parallax disabled={true} translateX={offX} translateY={offY} />
291300
);
292301

293-
expect(controller.resetElementStyles).toBeCalled();
302+
expect(controller.resetElementStyles).toHaveBeenCalled();
294303
});
295304
});
296305
});

‎src/components/ParallaxBanner/index.test.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('given a <ParallaxBanner> component', () => {
4747
}
4848
);
4949
expect(asFragment()).toMatchSnapshot();
50-
expect(controller.createElement).toBeCalledWith({
50+
expect(controller.createElement).toHaveBeenCalledWith({
5151
el: expect.any(HTMLElement),
5252
props: {
5353
...props,
@@ -74,7 +74,7 @@ describe('given a <ParallaxBanner> component', () => {
7474
render(<ParallaxBanner layers={[{ children: <div /> }]} />, {
7575
wrapper: Wrapper,
7676
});
77-
expect(controller.createElement).toBeCalledWith({
77+
expect(controller.createElement).toHaveBeenCalledWith({
7878
el: expect.any(HTMLElement),
7979
props: {
8080
shouldDisableScalingTranslations: true,

‎src/components/ParallaxProvider/index.test.tsx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('A <ParallaxProvider>', () => {
2929

3030
render();
3131

32-
expect(child).toBeCalled();
32+
expect(child).toHaveBeenCalled();
3333
});
3434

3535
it('to pass the controller context', () => {
@@ -90,7 +90,7 @@ describe('A <ParallaxProvider>', () => {
9090
expect(
9191
// @ts-expect-error
9292
parallaxController.enableParallaxController
93-
).toBeCalled();
93+
).toHaveBeenCalled();
9494
});
9595

9696
it('to destroy the controller when unmounting', () => {
@@ -112,8 +112,8 @@ describe('A <ParallaxProvider>', () => {
112112
screen.unmount();
113113

114114
expect(
115-
((parallaxController as unknown) as ParallaxController)?.destroy
116-
).toBeCalled();
115+
(parallaxController as unknown as ParallaxController)?.destroy
116+
).toHaveBeenCalled();
117117
});
118118

119119
it('to update the scroll container when receiving a new container el', () => {
@@ -142,7 +142,7 @@ describe('A <ParallaxProvider>', () => {
142142

143143
screen.unmount();
144144
// @ts-expect-error
145-
expect(parallaxController?.updateScrollContainer).toBeCalledWith(el);
145+
expect(parallaxController?.updateScrollContainer).toHaveBeenCalledWith(el);
146146
});
147147

148148
// NOTE: I think this test can be removed

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /