Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to @testing-library/user-event 12.8.0 breaks the file upload test #980

Closed
ahobson opened this issue Mar 1, 2021 · 1 comment
Closed
Assignees

Comments

@ahobson
Copy link
Contributor

ahobson commented Mar 1, 2021

The test suite fails with 12.8.0. The failing test is:

 FAIL  src/components/forms/FileInput/FileInput.test.tsx
  ● FileInput component › uploading files › only shows previews for the most recently selected files if files are selected multiple times

    expect(element).not.toBeInTheDocument()

    expected document not to contain element, found <div aria-hidden="true" class="usa-file-input__preview" data-testid="file-input-preview"><img alt="" class="usa-file-input__preview-image is-loading" data-testid="file-input-preview-image" id="testimg_file__2exls" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" />testFile.xls</div> instead

      175 |       // Change to no files
      176 |       userEvent.upload(inputEl, [])
    > 177 |       expect(queryByTestId('file-input-preview')).not.toBeInTheDocument()
          |                                                       ^
      178 |       expect(previewHeading).not.toBeInTheDocument()
      179 |       expect(getByTestId('file-input-instructions')).not.toHaveClass(
      180 |         'display-none'

      at Object.<anonymous> (src/components/forms/FileInput/FileInput.test.tsx:177:55)

There are changes changes to userEvent.upload in 12.8.0

@suzubara
Copy link
Contributor

Closed by #1017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants