Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ericfennis committed Mar 22, 2024
1 parent 40b30e0 commit 57e8edc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 287 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ exports[`Using lucide icon components > should duplicate properties to children
stroke-width="10"
stroke-linecap="round"
stroke-linejoin="round"
data-testid="multiple-children"
width="18"
height="18"
x="3"
Expand All @@ -87,6 +88,7 @@ exports[`Using lucide icon components > should duplicate properties to children
stroke-width="10"
stroke-linecap="round"
stroke-linejoin="round"
data-testid="multiple-children"
d="M3 9h18"
>
</path>
Expand All @@ -95,6 +97,7 @@ exports[`Using lucide icon components > should duplicate properties to children
stroke-width="10"
stroke-linecap="round"
stroke-linejoin="round"
data-testid="multiple-children"
d="M3 15h18"
>
</path>
Expand All @@ -103,6 +106,7 @@ exports[`Using lucide icon components > should duplicate properties to children
stroke-width="10"
stroke-linecap="round"
stroke-linejoin="round"
data-testid="multiple-children"
d="M9 3v18"
>
</path>
Expand All @@ -111,6 +115,7 @@ exports[`Using lucide icon components > should duplicate properties to children
stroke-width="10"
stroke-linecap="round"
stroke-linejoin="round"
data-testid="multiple-children"
d="M15 3v18"
>
</path>
Expand Down Expand Up @@ -232,289 +237,3 @@ exports[`Using lucide icon components > should render an component 1`] = `
</path>
</svg>
`;

exports[`Using lucide icon components > should work with a single child component 1`] = `
<svg xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewbox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
data-testid="single-child"
>
<rect fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
width="18"
height="18"
x="3"
y="3"
rx="2"
>
</rect>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M3 9h18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M3 15h18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M9 3v18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M15 3v18"
>
</path>
<svg xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewbox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
data-testid="child"
>
<rect fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
width="18"
height="18"
x="3"
y="3"
rx="2"
>
</rect>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M3 9h18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M3 15h18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M9 3v18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M15 3v18"
>
</path>
</svg>
</svg>
`;

exports[`Using lucide icon components > should work with several children components 1`] = `
<svg xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewbox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
data-testid="multiple-children"
>
<rect fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
width="18"
height="18"
x="3"
y="3"
rx="2"
>
</rect>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M3 9h18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M3 15h18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M9 3v18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M15 3v18"
>
</path>
<svg xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewbox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
data-testid="child1"
>
<rect fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
width="18"
height="18"
x="3"
y="3"
rx="2"
>
</rect>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M3 9h18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M3 15h18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M9 3v18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M15 3v18"
>
</path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewbox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
data-testid="child2"
>
<rect fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
width="18"
height="18"
x="3"
y="3"
rx="2"
>
</rect>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M3 9h18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M3 15h18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M9 3v18"
>
</path>
<path fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
d="M15 3v18"
>
</path>
</svg>
</svg>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ describe('Using lucide icon components', () => {
expect(child1).toEqual(getByTestId(childId1));
expect(child2).toEqual(getByTestId(childId2));
expect(container.innerHTML).toMatchSnapshot();

cleanup()
});

it('should duplicate properties to children components', () => {
Expand All @@ -129,7 +131,7 @@ describe('Using lucide icon components', () => {
strokeWidth={strokeWidth}
/>,
);
const { children = [] } = getByTestId(testId) as unknown as { children: HTMLCollection };
const { children = [] } = container.firstChild
for (let i = 0; i < children.length; i++) {
const child = children[i];
expect(child.getAttribute('fill')).toBe(fill);
Expand Down

0 comments on commit 57e8edc

Please sign in to comment.