Skip to content

[fix] pass strings to color palette inputs #2873

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

Merged
merged 1 commit into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/components/src/side-panel/layer-panel/custom-palette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,22 +299,20 @@ export const EditableColorRange: React.FC<EditableColorRangeProps> = ({
const onChangeLeft = useCallback(
val => {
if (editable && editColorMap) editColorMap(parseFloat(val), index - 1);
return;
},
[editColorMap, index, editable]
);
const onChangeRight = useCallback(
val => {
if (editable && editColorMap) editColorMap(parseFloat(val), index);
return;
},
[editColorMap, index, editable]
);

return (
<StyledRangeInput>
<ColorPaletteInput
value={noMinBound ? 'Less' : item.inputs[0]}
value={noMinBound ? 'Less' : item.inputs[0].toString()}
id={`color-palette-input-${index}-left`}
width="50px"
textAlign="end"
Expand All @@ -323,7 +321,7 @@ export const EditableColorRange: React.FC<EditableColorRangeProps> = ({
/>
<Dash />
<ColorPaletteInput
value={noMaxBound ? 'More' : item.inputs[1]}
value={noMaxBound ? 'More' : item.inputs[1].toString()}
id={`color-palette-input-${index}-right`}
width="50px"
textAlign="end"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,22 +327,15 @@ test('Components -> ChannelByValueSelector -> ColorScaleSelector -> ColorBreakDi
t.equal(inputs.length, 1, 'should render 1 input');
t.equal(
inputs.at(0).props().value,
Number(expectedText[i][i === 0 ? 2 : 1]),
'should display correct range'
expectedText[i][i === 0 ? 2 : 1],
`should display correct range i: ${i}`
);
} else {
t.equal(inputs.length, 2, 'should render 2 inputs');

t.equal(
inputs.at(0).props().value,
Number(expectedText[i][1]),
'should display correct range'
);
t.equal(
inputs.at(1).props().value,
Number(expectedText[i][2]),
'should display correct range'
);
t.equal(inputs.at(0).props().value, expectedText[i][1], `should display correct range ${i}`);

t.equal(inputs.at(1).props().value, expectedText[i][2], `should display correct range ${i}`);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ test('Components -> LayerConfigurator.mount -> LayerColumnConfig', t => {
</IntlWrapper>
);
}, 'LayerConfigurator should not fail without props');

const baseConfigGroup = wrapper.find(LayerConfigGroup).at(0);

t.equal(
baseConfigGroup.find(LayerColumnModeConfig).length,
1,
Expand Down Expand Up @@ -240,7 +242,6 @@ test('Components -> LayerConfigurator.mount -> LayerColumnConfig', t => {

// TODO: still need to fix this one
// for some reason the update config callback is only called once

// click single column
// clickItemSelectList(fieldSelector2, 2);

Expand Down
Loading