-
Notifications
You must be signed in to change notification settings - Fork 38
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
Account for localization.isrequired with field.isRequired #4721
base: production
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need a test as this is a critical file
otherwise, all good
@@ -131,19 +131,19 @@ export abstract class FieldBase { | |||
this.isReadOnly = | |||
globalFieldOverride === 'readOnly' || fieldDefinition.readOnly === true; | |||
|
|||
this.localization = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please add the test case that ensures schema config setting impacts the isRequired prop?
specify7/specifyweb/frontend/js_src/lib/components/DataModel/__tests__/specifyField.test.ts
Lines 48 to 61 in 0257f82
describe('isRequired', () => { | |
test('not-required field', () => | |
expect(tables.CollectionObject.getField('catalogNumber')?.isRequired).toBe( | |
false | |
)); | |
test('field required by schema', () => | |
expect(tables.Accession.getField('accessionNumber')?.isRequired).toBe( | |
true | |
)); | |
test('field required by front-end override', () => | |
expect(tables.Taxon.getField('parent')?.isRequired).toBe(true)); | |
test('field made optional by front-end override', () => | |
expect(tables.Attachment.getField('tableID')?.isRequired).toBe(false)); | |
}); |
Fixes #4720
#4703 (comment)
Checklist
and self-explanatory (or properly documented)
Testing instructions