message: test(image): add a11y test, streamline tests
diff: -import { render, act } from "@chakra-ui/test-utils"
  +import { render, act, screen, testA11y } from "@chakra-ui/test-utils"
  import * as React from "react"
  import { Image, ImageProps } from "../src"
  @@ -23,40 +23,39 @@ function trackImageOnload() {
  })
  }
  -function renderComponent(props?: ImageProps) {
  - return render(
  - <Image data-testid="img" src={src} fallbackSrc={fallbackSrc} {...props} />,
  - )
  -}
  -
  +describe("<Image />", () => {
  test("creates an instance of Image when mounted", () => {
  - const tools = renderComponent()
  - const image = tools.getByTestId("img")
  - expect(image).toBeInstanceOf(HTMLImageElement)
  + render(<Image src={src} fallbackSrc={fallbackSrc} />)
  +
  + expect(screen.getByRole("img")).toBeInstanceOf(HTMLImageElement)
  })
  -test("should render placeholder first, before image load", async () => {
  - const tools = renderComponent()
  - const image = tools.getByTestId("img")
  - expect(image).toHaveAttribute("src", fallbackSrc)
  + it("passes a11y test", async () => {
  + await testA11y(<Image alt="img" src={src} fallbackSrc={fallbackSrc} />)
  + })
  +
  + test("renders placeholder first, before image load", async () => {
  + render(<Image src={src} fallbackSrc={fallbackSrc} />)
  +
  + expect(screen.getByRole("img")).toHaveAttribute("src", fallbackSrc)
  })
  /**
  * Not sure of the correctness of this test:
  * @see https://www.tfzx.net/article/4859040.html
  */
  -test("should fires onload", () => {
  + test("fires onload", () => {
  trackImageOnload()
  const onLoad = jest.fn()
  - const tools = renderComponent({ onLoad })
  - const image = tools.getByTestId("img")
  + render(<Image src={src} fallbackSrc={fallbackSrc} onLoad={onLoad} />)
  act(() => {
  imageOnload()
  })
  - expect(image).toHaveAttribute("src", src)
  + expect(screen.getByRole("img")).toHaveAttribute("src", src)
  expect(onLoad).toHaveBeenCalled()
  })
  +})
  