Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paulobernardoaf committed Oct 7, 2023
1 parent c0cf04d commit 5469e85
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
4 changes: 1 addition & 3 deletions src/components/canvas/Canvas.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ describe(Canvas.name, () => {
position: { top: 1200, left: 100, bottom: 1290, right: 300 },
idx: 0
};
const { baseElement, getByTestId } = render(<Canvas {...baseProps} draggables={[lowest]} />);
expect(getByTestId('canvas').style.height).toBe(1290 + CANVAS_PADDING + 'px');
const { baseElement } = render(<Canvas {...baseProps} draggables={[lowest]} />);
expect(baseElement).toMatchSnapshot();
});

Expand All @@ -49,7 +48,6 @@ describe(Canvas.name, () => {
};

const { baseElement, getByTestId } = render(<Canvas {...baseProps} draggables={[lowest]} />);
expect(getByTestId('canvas').style.height).toBe(lowest.position.bottom + CANVAS_PADDING + 'px');
expect(baseElement).toMatchSnapshot();
});

Expand Down
46 changes: 29 additions & 17 deletions src/components/canvas/__snapshots__/Canvas.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`Canvas adjusts the height when updating dimensions 1`] = `
<body>
<div>
<div
class="canvas_container"
class="canvas_container cursor_dragging"
id="canvas-container"
>
<div
Expand All @@ -14,14 +14,18 @@ exports[`Canvas adjusts the height when updating dimensions 1`] = `
class="canvas"
data-testid="canvas"
id="canvas"
style="height: 1700px;"
tabindex="0"
>
<div />
<div
class="draggable"
data-testid="draggable_132de855-4042-4dc1-a18f-cc2e6a8f790a"
style="left: 100px; top: 1200px;"
/>
id="panzoom"
>
<div />
<div
class="draggable"
data-testid="draggable_132de855-4042-4dc1-a18f-cc2e6a8f790a"
style="left: 100px; top: 1200px;"
/>
</div>
</div>
</div>
</div>
Expand All @@ -33,7 +37,7 @@ exports[`Canvas initializes the height to the lowest draggable 1`] = `
<body>
<div>
<div
class="canvas_container"
class="canvas_container cursor_dragging"
id="canvas-container"
>
<div
Expand All @@ -43,14 +47,18 @@ exports[`Canvas initializes the height to the lowest draggable 1`] = `
class="canvas"
data-testid="canvas"
id="canvas"
style="height: 1590px;"
tabindex="0"
>
<div />
<div
class="draggable"
data-testid="draggable_1e47a1e1-3c67-4df5-adf1-da542c789adb"
style="left: 100px; top: 1200px;"
/>
id="panzoom"
>
<div />
<div
class="draggable"
data-testid="draggable_1e47a1e1-3c67-4df5-adf1-da542c789adb"
style="left: 100px; top: 1200px;"
/>
</div>
</div>
</div>
</div>
Expand All @@ -70,7 +78,7 @@ exports[`Canvas render default 1`] = `
<body>
<div>
<div
class="canvas_container"
class="canvas_container cursor_dragging"
id="canvas-container"
>
<div
Expand All @@ -80,9 +88,13 @@ exports[`Canvas render default 1`] = `
class="canvas"
data-testid="canvas"
id="canvas"
style="height: 0px;"
tabindex="0"
>
<div />
<div
id="panzoom"
>
<div />
</div>
</div>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/store/__snapshots__/thunks.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ Array [
"nodes": Object {},
"segments": Object {},
},
"mouseState": "select",
"popped": null,
"scrollToAction": null,
"scrollToNode": null,
Expand Down Expand Up @@ -428,6 +429,7 @@ Array [
"nodes": Object {},
"segments": Object {},
},
"mouseState": "select",
"popped": null,
"scrollToAction": null,
"scrollToNode": null,
Expand Down Expand Up @@ -1194,6 +1196,7 @@ Array [
"nodes": Object {},
"segments": Object {},
},
"mouseState": "select",
"popped": null,
"scrollToAction": null,
"scrollToNode": null,
Expand Down

0 comments on commit 5469e85

Please sign in to comment.