Make color scheme optional (#17357)

This commit is contained in:
Geido 2021-11-05 19:09:59 +02:00 committed by GitHub
parent fa51b3234e
commit ee7c34b5b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -148,6 +148,15 @@ describe('PropertiesModal', () => {
expect(spy).toHaveBeenCalled();
});
});
describe('with an empty color scheme as an arg', () => {
const wrapper = setup();
const modalInstance = wrapper.find('PropertiesModal').instance();
it('will not raise an error', () => {
const spy = jest.spyOn(Modal, 'error');
modalInstance.onColorSchemeChange('');
expect(spy).not.toHaveBeenCalled();
});
});
});
describe('onOwnersChange', () => {
it('should update the state with the value passed', () => {

View File

@ -147,7 +147,8 @@ class PropertiesModal extends React.PureComponent {
? JSON.parse(jsonMetadata)
: {};
if (!colorScheme || !colorChoices.includes(colorScheme)) {
// only fire if the color_scheme is present and invalid
if (colorScheme && !colorChoices.includes(colorScheme)) {
Modal.error({
title: 'Error',
content: t('A valid color scheme is required'),