message: test(focus-lock): add a11y test, streamline tests
diff: import * as React from "react"
  -import { render, fireEvent } from "@chakra-ui/test-utils"
  +import { render, fireEvent, screen, testA11y } from "@chakra-ui/test-utils"
  import { FocusLock } from "../src"
  +describe("<FocusLock />", () => {
  test("focuses an element on render", () => {
  const Component = () => {
  return (
  @@ -12,11 +13,31 @@ test("focuses an element on render", () => {
  </FocusLock>
  )
  }
  - const utils = render(<Component />)
  - const input = utils.getByTestId("input")
  + render(<Component />)
  + const input = screen.getByTestId("input")
  expect(input).toHaveFocus()
  })
  + // placeholder test until we figure out how to deal with react-focus-lock
  + // being
  + it("passes a11y test", async () => {
  + await testA11y(
  + <FocusLock>
  + <button type="button">button 1</button>
  + <button type="button">button 2</button>
  + <button type="button">button 3</button>
  + </FocusLock>,
  + {},
  + {
  + rules: {
  + // react-focus-lock is not compliant here or rather,
  + // it is a valid use case of tabindex
  + tabindex: { enabled: false },
  + },
  + },
  + )
  + })
  +
  test("focuses initialFocusRef on render", () => {
  const Component = () => {
  const ref = React.useRef<HTMLInputElement>(null)
  @@ -28,8 +49,8 @@ test("focuses initialFocusRef on render", () => {
  </FocusLock>
  )
  }
  - const utils = render(<Component />)
  - const input = utils.getByTestId("input")
  + render(<Component />)
  + const input = screen.getByTestId("input")
  expect(input).toHaveFocus()
  })
  @@ -50,8 +71,8 @@ test("focuses finalFocusRef on unmount", () => {
  </div>
  )
  }
  - const utils = render(<Component />)
  - const button = utils.getByTestId("button")
  + render(<Component />)
  + const button = screen.getByTestId("button")
  // not focused while focus lock is displayed
  expect(button).not.toHaveFocus()
  @@ -60,3 +81,4 @@ test("focuses finalFocusRef on unmount", () => {
  fireEvent.click(button)
  expect(button).toHaveFocus()
  })
  +})
  