Skip to content

Commit

Permalink
delete incompatible props
Browse files Browse the repository at this point in the history
add unit test for legend rendering

more tests
  • Loading branch information
thomasneirynck committed Jan 13, 2020
1 parent ea9ea14 commit 599b1a4
Show file tree
Hide file tree
Showing 4 changed files with 414 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,23 @@ export class DynamicColorForm extends React.Component {
let colorSelect;
if (styleOptions.field && styleOptions.field.name) {
const onColorChange = colorOptions => {
const oldStyleOptions = { ...styleOptions };

if (oldStyleOptions.type === !colorOptions.type) {
delete oldStyleOptions.type;
if (colorOptions.type === COLOR_MAP_TYPE.ORDINAL) {
delete oldStyleOptions.useCustomColorPalette;
delete oldStyleOptions.customColorPalette;
} else {
delete oldStyleOptions.useCustomColorRamp;
delete oldStyleOptions.customColorRamp;
}
}

const newOptions = {
...styleOptions,
...oldStyleOptions,
...colorOptions,
};

onDynamicStyleChange(styleProperty.getStyleName(), newOptions);
};
if (this.state.colorMapType === COLOR_MAP_TYPE.ORDINAL) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 599b1a4

Please sign in to comment.