moxystudio / next-with-moxy

MOXY's boilerplate to accelerate the setup of new Next.js based web applications
https://next-with.moxy.tech
MIT License
101 stars 11 forks source link

chore: add user-event #115

Closed ubmit closed 3 years ago

ubmit commented 4 years ago

This PR will add user-event which is a companion library for Testing Library that provides more advanced simulation of browser interactions than the built-in fireEvent method.

Example:

import { screen } from '@testing-library/dom'
import userEvent from '@testing-library/user-event'

test('types inside textarea', async () => {
  document.body.innerHTML = `<textarea />`

  await userEvent.type(screen.getByRole('textbox'), 'Hello, World!')
  expect(screen.getByRole('textbox')).toHaveValue('Hello, World!')
})

Note that using fireEvent the syntax for changing an input value isn't as readable: fireEvent.change(input, { target: { value: 'foo' } })

github-actions[bot] commented 4 years ago

This pull-request can be previewed at https://next-with-moxy-pr-115.vercel.app. Please check the Vercel status below to see when it's ready.

codecov[bot] commented 4 years ago

Codecov Report

Merging #115 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #115   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines          115       115           
  Branches        11        11           
=========================================
  Hits           115       115           

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update 7fbd99e...6f3a305. Read the comment docs.

ubmit commented 4 years ago

This PR is not adding user-event but just updating the library's version. Anyhow, LGTM, I guess. πŸ˜‰

The project which I'm working on doesn't have it, so I thought the template didn't have it either πŸ˜‚

Should have checked, sorry. I guess we should close this PR.