Skip to content

Commit

Permalink
Make color scheme optional (apache#17357)
Browse files Browse the repository at this point in the history
(cherry picked from commit ee7c34b)
  • Loading branch information
geido authored and sadpandajoe committed Nov 5, 2021
1 parent ffc5686 commit 66b6e4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down

0 comments on commit 66b6e4b

Please sign in to comment.