░▒▓████████████████████████████████▓▒░ ░▒▓█ ▓▒░ ░▒▓█ ~ S W A M P ~ ▓▒░ ░▒▓█ ▓▒░ ░▒▓████████████████████████████████▓▒░
pplmvsvm
LOCATION:
/var/www/canvas/ui/features/release_notes_edit/react/__tests__
☗ ROOT
↻ REFRESH
✎ CARVE FLESH
EDITING: CreateEditModal.test.js
/* * Copyright (C) 2021 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react' import {render} from '@testing-library/react' import userEvent from '@testing-library/user-event' import CreateEditModal from '../CreateEditModal' describe('create modal', () => { it('It renders reasonable defaults', () => { const {getByText} = render( <CreateEditModal open={true} onClose={() => {}} onSubmit={() => {}} currentNote={undefined} envs={['test']} langs={['en', 'es']} /> ) expect(getByText('Everyone')).toBeInTheDocument() }) // TODO unskip and finish these tests after upgrading jest/jsdom it.skip('It blocks submission unless the basic english fields are completed', () => { const onSubmit = jest.fn() const {getByLabelText, getByText} = render( <CreateEditModal open={true} onClose={() => {}} onSubmit={onSubmit} currentNote={undefined} envs={['test']} langs={['en', 'es']} /> ) expect(getByText('Save').closest('button')).toBeDisabled() userEvent.type(getByLabelText('Title'), 'A great english title') expect(getByText('Save').closest('button')).toBeDisabled() userEvent.type(getByLabelText('Description'), 'A great english description') expect(getByText('Save').closest('button')).not.toBeDisabled() userEvent.type(getByLabelText('Link URL'), 'https://whatever.com') expect(getByText('Save').closest('button')).not.toBeDisabled() }) it.skip('It submits the expected object', () => { const onSubmit = jest.fn() const {getByLabelText, getByText} = render( <CreateEditModal open={true} onClose={() => {}} onSubmit={onSubmit} currentNote={undefined} envs={['test']} langs={['en', 'es']} /> ) userEvent.type(getByLabelText('Title'), 'A great english title') userEvent.type(getByLabelText('Description'), 'A great english description') userEvent.type(getByLabelText('Link URL'), 'https://whatever.com') userEvent.click(getByText('Save').closest('button')) expect(onSubmit).toHaveBeenCalledTimes(1) expect(onSubmit).toHaveBeenCalledWith({}) }) })
CANCEL
Name
Type
Size
Modified
Actions
↩ ..
DIR
—
—
📄 CreateEditModal.test.js
JS
2.8 KB
2023-09-24 03:39
EDIT
📄 index.test.js
JS
2.1 KB
2023-09-24 03:39
EDIT
📄 NotesTable.test.js
JS
1.7 KB
2023-09-24 03:39
EDIT
📄 NotesTableRow.test.js
JS
3.9 KB
2023-09-24 03:39
EDIT