Skip to content

Commit a39fcf8

Browse files
authored
[fix] pass strings to color palette inputs (#2873)
Signed-off-by: Ihor Dykhta <[email protected]>
1 parent b89b19c commit a39fcf8

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

src/components/src/side-panel/layer-panel/custom-palette.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,22 +315,20 @@ export const EditableColorRange: React.FC<EditableColorRangeProps> = ({
315315
const onChangeLeft = useCallback(
316316
val => {
317317
if (editable && editColorMap) editColorMap(parseFloat(val), index - 1);
318-
return;
319318
},
320319
[editColorMap, index, editable]
321320
);
322321
const onChangeRight = useCallback(
323322
val => {
324323
if (editable && editColorMap) editColorMap(parseFloat(val), index);
325-
return;
326324
},
327325
[editColorMap, index, editable]
328326
);
329327

330328
return (
331329
<StyledRangeInput>
332330
<ColorPaletteInput
333-
value={noMinBound ? 'Less' : item.inputs[0]}
331+
value={noMinBound ? 'Less' : item.inputs[0].toString()}
334332
id={`color-palette-input-${index}-left`}
335333
width="50px"
336334
textAlign="end"
@@ -339,7 +337,7 @@ export const EditableColorRange: React.FC<EditableColorRangeProps> = ({
339337
/>
340338
<Dash />
341339
<ColorPaletteInput
342-
value={noMaxBound ? 'More' : item.inputs[1]}
340+
value={noMaxBound ? 'More' : item.inputs[1].toString()}
343341
id={`color-palette-input-${index}-right`}
344342
width="50px"
345343
textAlign="end"

test/browser/components/side-panel/channel-by-value-selctor-test.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -327,22 +327,15 @@ test('Components -> ChannelByValueSelector -> ColorScaleSelector -> ColorBreakDi
327327
t.equal(inputs.length, 1, 'should render 1 input');
328328
t.equal(
329329
inputs.at(0).props().value,
330-
Number(expectedText[i][i === 0 ? 2 : 1]),
331-
'should display correct range'
330+
expectedText[i][i === 0 ? 2 : 1],
331+
`should display correct range i: ${i}`
332332
);
333333
} else {
334334
t.equal(inputs.length, 2, 'should render 2 inputs');
335335

336-
t.equal(
337-
inputs.at(0).props().value,
338-
Number(expectedText[i][1]),
339-
'should display correct range'
340-
);
341-
t.equal(
342-
inputs.at(1).props().value,
343-
Number(expectedText[i][2]),
344-
'should display correct range'
345-
);
336+
t.equal(inputs.at(0).props().value, expectedText[i][1], `should display correct range ${i}`);
337+
338+
t.equal(inputs.at(1).props().value, expectedText[i][2], `should display correct range ${i}`);
346339
}
347340
}
348341

test/browser/components/side-panel/layer-configurator-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ test('Components -> LayerConfigurator.mount -> LayerColumnConfig', t => {
154154
</IntlWrapper>
155155
);
156156
}, 'LayerConfigurator should not fail without props');
157+
157158
const baseConfigGroup = wrapper.find(LayerConfigGroup).at(0);
159+
158160
t.equal(
159161
baseConfigGroup.find(LayerColumnModeConfig).length,
160162
1,
@@ -240,7 +242,6 @@ test('Components -> LayerConfigurator.mount -> LayerColumnConfig', t => {
240242

241243
// TODO: still need to fix this one
242244
// for some reason the update config callback is only called once
243-
244245
// click single column
245246
// clickItemSelectList(fieldSelector2, 2);
246247

0 commit comments

Comments
 (0)