Skip to content

Commit 94cc83f

Browse files
fix test and arbitrary props
1 parent 91911e5 commit 94cc83f

1 file changed

Lines changed: 37 additions & 36 deletions

File tree

packages/ui-components/src/components/DescriptionDefinition/DescriptionDefinition.test.tsx

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,49 +17,50 @@ describe("DescriptionDefinition", () => {
1717
<DescriptionTerm data-testid={"term-1"}>Term 1</DescriptionTerm>
1818
<DescriptionDefinition data-testid={"def-1"}>Definition 1</DescriptionDefinition>
1919
</DescriptionList>
20-
);
20+
)
2121

22-
const termElement = screen.getByTestId("term-1");
23-
const definitionElement = screen.getByTestId("def-1");
22+
const termElement = screen.getByTestId("term-1")
23+
const definitionElement = screen.getByTestId("def-1")
2424

25-
expect(termElement).toBeInTheDocument();
26-
expect(termElement).toHaveTextContent("Term 1");
25+
expect(termElement).toBeInTheDocument()
26+
expect(termElement).toHaveTextContent("Term 1")
2727

28-
expect(definitionElement).toBeInTheDocument();
29-
expect(definitionElement).toHaveTextContent("Definition 1");
28+
expect(definitionElement).toBeInTheDocument()
29+
expect(definitionElement).toHaveTextContent("Definition 1")
3030

31-
it("applies custom className", () => {
32-
const customClass = "custom-class"
33-
render(<DescriptionDefinition className={customClass}>Test Description</DescriptionDefinition>)
34-
const ddElement = screen.getByText("Test Description")
35-
expect(ddElement).toHaveClass(customClass)
36-
})
31+
it("applies custom className", () => {
32+
const customClass = "custom-class"
33+
render(<DescriptionDefinition className={customClass}>Test Description</DescriptionDefinition>)
34+
const ddElement = screen.getByText("Test Description")
35+
expect(ddElement).toHaveClass(customClass)
36+
})
3737

38-
it("renders within a <dd> element", () => {
39-
render(<DescriptionDefinition>Test Description</DescriptionDefinition>)
40-
const ddElement = screen.getByText("Test Description")
41-
expect(ddElement.tagName).toBe("DD")
42-
})
38+
it("renders within a <dd> element", () => {
39+
render(<DescriptionDefinition>Test Description</DescriptionDefinition>)
40+
const ddElement = screen.getByText("Test Description")
41+
expect(ddElement.tagName).toBe("DD")
42+
})
4343

44-
it("can render complex children", () => {
45-
render(
46-
<DescriptionDefinition>
47-
<span>Complex</span> <strong>Content</strong>
48-
</DescriptionDefinition>
49-
)
50-
expect(screen.getByText("Complex")).toBeInTheDocument()
51-
expect(screen.getByText("Content")).toBeInTheDocument()
52-
})
44+
it("can render complex children", () => {
45+
render(
46+
<DescriptionDefinition>
47+
<span>Complex</span> <strong>Content</strong>
48+
</DescriptionDefinition>
49+
)
50+
expect(screen.getByText("Complex")).toBeInTheDocument()
51+
expect(screen.getByText("Content")).toBeInTheDocument()
52+
})
5353

54-
it("receives and applies arbitrary props", () => {
55-
const dataId = "custom-id"
56-
render(
57-
<DescriptionDefinition data-testid={dataId}>
58-
<span>Complex Term</span> <strong>Content</strong>
59-
</DescriptionDefinition>
60-
)
54+
it("receives and applies arbitrary props", () => {
55+
const dataId = "custom-id"
56+
render(
57+
<DescriptionDefinition data-testid={dataId}>
58+
<span>Complex Term</span> <strong>Content</strong>
59+
</DescriptionDefinition>
60+
)
6161

62-
const ddElement = screen.getByTestId(dataId)
63-
expect(ddElement).toHaveAttribute("data-testid", dataId)
62+
const ddElement = screen.getByTestId(dataId)
63+
expect(ddElement).toHaveAttribute("data-testid", dataId)
64+
})
6465
})
6566
})

0 commit comments

Comments
 (0)