Skip to content

rename some test files for easier reference to their components #217

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

Merged
merged 1 commit into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 0 additions & 14 deletions src/__tests__/user-event.js → src/__tests__/form-user-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import '@testing-library/jest-dom'
import {render, waitFor} from '@testing-library/vue'
import userEvent from '@testing-library/user-event'
import Form from './components/Form'
import Select from './components/Select'

beforeEach(() => {
jest.spyOn(console, 'warn').mockImplementation(() => {})
Expand Down Expand Up @@ -57,16 +56,3 @@ test('User events in a form', async () => {

expect(console.warn).not.toHaveBeenCalled()
})

test('selecting option with user events', () => {
const {getByDisplayValue} = render(Select)
const select = getByDisplayValue('Tyrannosaurus')
expect(select.value).toBe('dino1')

userEvent.selectOptions(select, 'dino2')
expect(select.value).toBe('dino2')

userEvent.selectOptions(select, 'dino3')
expect(select.value).not.toBe('dino2')
expect(select.value).toBe('dino3')
})
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions src/__tests__/select-user-event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import '@testing-library/jest-dom'
import {render} from '@testing-library/vue'
import userEvent from '@testing-library/user-event'
import Select from './components/Select'

beforeEach(() => {
jest.spyOn(console, 'warn').mockImplementation(() => {})
})

afterEach(() => {
console.warn.mockRestore()
})

test('selecting option with user events', () => {
const {getByDisplayValue} = render(Select)
const select = getByDisplayValue('Tyrannosaurus')
expect(select.value).toBe('dino1')

userEvent.selectOptions(select, 'dino2')
expect(select.value).toBe('dino2')

userEvent.selectOptions(select, 'dino3')
expect(select.value).not.toBe('dino2')
expect(select.value).toBe('dino3')
})
File renamed without changes.