Skip to content

Commit 1db17fa

Browse files
committed
fix specs
1 parent 717bfc3 commit 1db17fa

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

packages/react-image-focal-point/src/image-focal-point.helpers.spec.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ const imageContainer = {
77

88
describe('focal-point/onMove specs', () => {
99
describe('base case', () => {
10-
const container = {
11-
getBoundingClientRect: jest.fn().mockReturnValue({
12-
top: 0,
13-
left: 0,
14-
}),
15-
} as unknown as HTMLDivElement;
10+
let container;
11+
12+
beforeEach(() => {
13+
container = {
14+
getBoundingClientRect: jest.fn().mockReturnValue({
15+
top: 0,
16+
left: 0,
17+
}),
18+
} as unknown as HTMLDivElement;
19+
});
1620

1721
it('should does not call to setX, setY nor onChange when it feeds canMove equals false', () => {
1822
// Arrange
@@ -252,12 +256,16 @@ describe('focal-point/onMove specs', () => {
252256
});
253257

254258
describe('image container inside some page an its location is not 0/0', () => {
255-
const container = {
256-
getBoundingClientRect: jest.fn().mockReturnValue({
257-
top: 400,
258-
left: 400,
259-
}),
260-
} as unknown as HTMLDivElement;
259+
let container;
260+
261+
beforeEach(() => {
262+
container = {
263+
getBoundingClientRect: jest.fn().mockReturnValue({
264+
top: 400,
265+
left: 400,
266+
}),
267+
} as unknown as HTMLDivElement;
268+
});
261269

262270
it('should does not call to setX, setY nor onChange when it feeds canMove equals false', () => {
263271
// Arrange

0 commit comments

Comments
 (0)