import { describe, it, expect } from 'vitest'; import { render, cleanup } from '@solidjs/testing-library' import { IconAccessible, IconAccessibleFilled } from "./src/tabler-icons-solidjs" describe("Solidjs Icon component", () => { afterEach(() => cleanup()) test("should render icon component", () => { const { container } = render(() => ) expect(container.getElementsByTagName("svg").length).toBeGreaterThan(0); }) test("should update svg attributes when there are props passed to the component", () => { const { container } = render(() => ) const svg = container.getElementsByTagName("svg")[0] expect(svg.getAttribute("width")).toBe("48") expect(svg.getAttribute("stroke")).toBe("red") expect(svg.getAttribute("stroke-width")).toBe("4") }) it("should update svg attributes when there are props passed to the filled version of component", () => { const { container } = render(() => ) const svg = container.getElementsByTagName("svg")[0] expect(svg.getAttribute("width")).toBe("48") expect(svg.getAttribute("fill")).toBe("red") expect(svg.getAttribute("stroke")).toBe("none") expect(svg.getAttribute("stroke-width")).toBe(null) }) it('should add a class to the element', () => { const { container } = render(() => ) const svg = container.getElementsByTagName("svg")[0] expect(svg).toHaveClass('test-class') expect(svg).toHaveClass('tabler-icon') expect(svg).toHaveClass('tabler-icon-accessible') }) it('should add a style attribute to the element', () => { const { container } = render(() => ) const svg = container.getElementsByTagName("svg")[0] expect(svg).toHaveStyle('color: rgb(255, 0, 0)') }) test("should match snapshot", () => { const { container } = render(() => ) expect(container.innerHTML).toMatchInlineSnapshot(` `) }) })