Skip to content

Commit 2464ceb

Browse files
fix test and arbitrary props
1 parent 1c7c2b1 commit 2464ceb

3 files changed

Lines changed: 18 additions & 9 deletions

File tree

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,15 @@ describe("DescriptionDefinition", () => {
5151
expect(screen.getByText("Complex")).toBeInTheDocument()
5252
expect(screen.getByText("Content")).toBeInTheDocument()
5353
})
54+
55+
it("receives and applies arbitrary props", () => {
56+
render(
57+
<DescriptionDefinition data-testid={"custom-id"} data-arbitrary-prop={"data-madeup-content"}>
58+
<span>Complex Term</span> <strong>Content</strong>
59+
</DescriptionDefinition>
60+
)
61+
62+
const ddElement = screen.getByTestId("custom-id")
63+
expect(ddElement).toHaveAttribute("data-arbitrary-prop", "data-madeup-content")
64+
})
5465
})

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,14 @@ describe("DescriptionList", () => {
7575
})
7676

7777
it("receives and applies arbitrary props", () => {
78-
const dataId = "custom-id"
7978
render(
80-
<DescriptionList data-testid={dataId}>
79+
<DescriptionList data-testid={"custom-id"} data-arbitrary-prop={"data-madeup-content"}>
8180
<DescriptionTerm>Term 7</DescriptionTerm>
8281
<DescriptionDefinition>Definition 7</DescriptionDefinition>
8382
</DescriptionList>
8483
)
8584

86-
const dlElement = screen.getByTestId(dataId)
87-
expect(dlElement).toHaveAttribute("data-testid", dataId)
85+
const dlElement = screen.getByTestId("custom-id")
86+
expect(dlElement).toHaveAttribute("data-arbitrary-prop", "data-madeup-content")
8887
})
8988
})

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe("DescriptionTerm", () => {
2929

3030
it("can render complex children", () => {
3131
render(
32-
<DescriptionTerm>
32+
<DescriptionTerm data-arbitrary-prop={"data-madeup-content"}>
3333
<span>Complex Term</span> <strong>Content</strong>
3434
</DescriptionTerm>
3535
)
@@ -38,14 +38,13 @@ describe("DescriptionTerm", () => {
3838
})
3939

4040
it("receives and applies arbitrary props", () => {
41-
const dataId = "custom-id"
4241
render(
43-
<DescriptionTerm data-testid={dataId}>
42+
<DescriptionTerm data-testid={"custom-id"} data-arbitrary-prop={"data-madeup-content"}>
4443
<span>Complex Term</span> <strong>Content</strong>
4544
</DescriptionTerm>
4645
)
4746

48-
const dtElement = screen.getByTestId(dataId)
49-
expect(dtElement).toHaveAttribute("data-testid", dataId)
47+
const dtElement = screen.getByTestId("custom-id")
48+
expect(dtElement).toHaveAttribute("data-arbitrary-prop", "data-madeup-content")
5049
})
5150
})

0 commit comments

Comments
 (0)