|
1
|
import React from "react" |
|
2
|
import { beforeEach, describe, expect, test, vi } from "vitest" |
|
3
|
import { cleanup, render } from "@testing-library/react" |
|
4
|
|
|
5
|
|
|
6
|
import Space from ".." |
|
7
|
|
|
8
|
beforeEach(() => { |
|
9
|
vi.clearAllMocks() |
|
10
|
cleanup() |
|
11
|
}) |
|
12
|
|
|
13
|
describe("rendering", () => { |
|
14
|
test("renders space with default styles", () => { |
|
15
|
const { getByTestId } = render(<Space />) |
|
16
|
const spaceElement = getByTestId("space") |
|
17
|
expect(spaceElement).toBeInTheDocument() |
|
18
|
expect(spaceElement).toHaveStyle({ |
|
19
|
height: "1px", |
|
20
|
marginTop: "0px", |
|
21
|
marginBottom: "0px", |
|
22
|
marginLeft: "0px", |
|
23
|
marginRight: "0px", |
|
24
|
}) |
|
25
|
}) |
|
26
|
|
|
27
|
test("renders space with correct styles", () => { |
|
28
|
const { getByTestId } = render(<Space top={10} bottom={10} left={10} right={10} />) |
|
29
|
const spaceElement = getByTestId("space") |
|
30
|
expect(spaceElement).toBeInTheDocument() |
|
31
|
expect(spaceElement).toHaveStyle({ |
|
32
|
height: "1px", |
|
33
|
marginTop: "9px", |
|
34
|
marginBottom: "9px", |
|
35
|
marginLeft: "10px", |
|
36
|
marginRight: "10px", |
|
37
|
}) |
|
38
|
}) |
|
39
|
}) |