Fixes regarding TextEntry id and _id

flag=none

test plan:
  - Specs pass

qa risk: low

Change-Id: Iadd2b9208119f8f580fb58c9351897109051dc78
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274124
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Davis Hyer <dhyer@instructure.com>
QA-Review: Davis Hyer <dhyer@instructure.com>
Product-Review: Davis Hyer <dhyer@instructure.com>
This commit is contained in:
Omar Gerardo Soto-Fortuño 2021-09-22 10:52:51 -04:00 committed by Omar Soto-Fortuño
parent 2a72b02803
commit 7ed05c9689
4 changed files with 16 additions and 3 deletions

View File

@ -164,7 +164,6 @@ const ignoredErrors = [
/The prop `screenReaderLabel` is marked as required in `IconButton`/,
/The prop `selectedRoles\[0\].value` is marked as required in `PermissionsIndex`/,
/The prop `students\[0\].name` is marked as required in `ScoresGrid`/,
/The prop `submission._id` is marked as required in `TextEntry`/,
/The prop `text` is marked as required in `(SVGWithTextPlaceholder|TextPlaceholder)`/,
/The prop `trayProps.canUploadFiles` is marked as required in `RCEWrapper`/,
/The prop `userId` is marked as required in `(CourseNotificationSettingsManager|GeneratePairingCode|NotificationPreferences)`/,

View File

@ -114,6 +114,8 @@ describe('TextEntry', () => {
it('uses the submission body if the submission is graded', async () => {
const props = await makeProps({
submission: {
id: '1',
_id: '1',
body: 'I am graded!',
state: 'graded'
}
@ -127,6 +129,8 @@ describe('TextEntry', () => {
it('uses the submission body if the submission is submitted', async () => {
const props = await makeProps({
submission: {
id: '1',
_id: '1',
body: 'I am not graded!',
state: 'submitted'
}
@ -140,6 +144,8 @@ describe('TextEntry', () => {
it('uses the contents of the draft if not graded or submitted and a draft is present', async () => {
const props = await makeProps({
submission: {
id: '1',
_id: '1',
submissionDraft: {body: 'just a draft'}
}
})
@ -152,6 +158,8 @@ describe('TextEntry', () => {
it('is empty if not graded or submitted and no draft is present', async () => {
const props = await makeProps({
submission: {
id: '1',
_id: '1',
body: 'this should be ignored',
state: 'unsubmitted'
}
@ -166,6 +174,8 @@ describe('TextEntry', () => {
describe('receiving updated props', () => {
const initialSubmission = {
id: '1',
_id: '1',
attempt: 1,
state: 'unsubmitted',
submissionDraft: {body: 'hello'}
@ -214,6 +224,8 @@ describe('TextEntry', () => {
const newProps = await makeProps({
submission: {
id: '1',
_id: '1',
attempt: 2,
state: 'unsubmitted',
submissionDraft: {body: 'hello, again'}
@ -359,6 +371,8 @@ describe('TextEntry', () => {
const newProps = await makeProps({
submission: {
id: '1',
_id: '1',
attempt: 2,
state: 'unsubmitted'
}

View File

@ -164,7 +164,7 @@ describe('ContentTabs', () => {
// This gets the lazy loaded components loaded before our specs.
// otherwise, the first one (at least) will fail.
const {unmount} = render(<TextEntry submission={{state: 'unsubmitted'}} />)
const {unmount} = render(<TextEntry submission={{id: '1', _id: '1', state: 'unsubmitted'}} />)
await waitFor(() => {
expect(tinymce.editors[0]).toBeDefined()
})

View File

@ -829,7 +829,7 @@ describe('SubmissionManager', () => {
beforeAll(async () => {
// This gets the lazy loaded components loaded before our specs.
// otherwise, the first one (at least) will fail.
const {unmount} = render(<TextEntry submission={{state: 'unsubmitted'}} />)
const {unmount} = render(<TextEntry submission={{id: '1', _id: '1', state: 'unsubmitted'}} />)
await waitFor(() => {
expect(tinymce.editors[0]).toBeDefined()
})