fix modalProps.onDismiss error

refs LS-3017
flag=none

test plan:
  - tests pass

qa risk: low

Change-Id: I7643eef56da11a29579b5ff579b2d4beeb2710de
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286051
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com>
QA-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
This commit is contained in:
Davis Hyer 2022-02-28 11:17:31 -07:00
parent 1b1b632b30
commit 5ecc77e664
2 changed files with 8 additions and 27 deletions

View File

@ -67,7 +67,6 @@ const ignoredErrors = [
/Invalid prop `value` of type `object` supplied to `CanvasSelect`/,
/Invariant Violation/,
/It looks like you're using the wrong act/,
/modalProps.onDismiss is not a function/,
/Prop `children` should be supplied unless/,
/props.setRCEOpen is not a function/,
/React does not recognize the `%s` prop on a DOM element/,

View File

@ -63,11 +63,7 @@ describe('DirectShareUserModal', () => {
it('disables the send button immediately', () => {
const {getByText} = render(<DirectShareUserModal open courseId="1" />)
expect(
getByText('Send')
.closest('button')
.getAttribute('disabled')
).toBe('')
expect(getByText('Send').closest('button').getAttribute('disabled')).toBe('')
})
it('enables the send button only when a user is selected', () => {
@ -75,29 +71,19 @@ describe('DirectShareUserModal', () => {
<DirectShareUserModal open courseId="1" />
)
selectUser(getByText, getByLabelText)
expect(
getByText('Send')
.closest('button')
.getAttribute('disabled')
).toBe(null)
expect(getByText('Send').closest('button').getAttribute('disabled')).toBe(null)
// remove the selected user from the list
fireEvent.click(getAllByText('abc')[1]) // first one is SR alert
expect(
getByText('Send')
.closest('button')
.getAttribute('disabled')
).toBe('')
expect(getByText('Send').closest('button').getAttribute('disabled')).toBe('')
})
it('disables the send button when a search has started', () => {
const {getByText, getByLabelText} = render(<DirectShareUserModal open courseId="1" />)
const {getByText, getByLabelText} = render(
<DirectShareUserModal open courseId="1" onDismiss={Function.prototype} />
)
selectUser(getByText, getByLabelText)
fireEvent.click(getByText('Send'))
expect(
getByText('Send')
.closest('button')
.getAttribute('disabled')
).toBe('')
expect(getByText('Send').closest('button').getAttribute('disabled')).toBe('')
})
it('starts a share operation and reports status', async () => {
@ -159,11 +145,7 @@ describe('DirectShareUserModal', () => {
fireEvent.click(getByText('Send'))
await act(() => fetchMock.flush(true))
expect(getByText(/error/i)).toBeInTheDocument()
expect(
getByText('Send')
.closest('button')
.getAttribute('disabled')
).toBeNull()
expect(getByText('Send').closest('button').getAttribute('disabled')).toBeNull()
})
})
})