Skip to content

Commit deaf351

Browse files
committed
[fix] pass strings to color palette inputs
Signed-off-by: Ihor Dykhta <[email protected]>
1 parent 2d1d8e5 commit deaf351

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
@@ -299,22 +299,20 @@ export const EditableColorRange: React.FC<EditableColorRangeProps> = ({
299299
const onChangeLeft = useCallback(
300300
val => {
301301
if (editable && editColorMap) editColorMap(parseFloat(val), index - 1);
302-
return;
303302
},
304303
[editColorMap, index, editable]
305304
);
306305
const onChangeRight = useCallback(
307306
val => {
308307
if (editable && editColorMap) editColorMap(parseFloat(val), index);
309-
return;
310308
},
311309
[editColorMap, index, editable]
312310
);
313311

314312
return (
315313
<StyledRangeInput>
316314
<ColorPaletteInput
317-
value={noMinBound ? 'Less' : item.inputs[0]}
315+
value={noMinBound ? 'Less' : item.inputs[0].toString()}
318316
id={`color-palette-input-${index}-left`}
319317
width="50px"
320318
textAlign="end"
@@ -323,7 +321,7 @@ export const EditableColorRange: React.FC<EditableColorRangeProps> = ({
323321
/>
324322
<Dash />
325323
<ColorPaletteInput
326-
value={noMaxBound ? 'More' : item.inputs[1]}
324+
value={noMaxBound ? 'More' : item.inputs[1].toString()}
327325
id={`color-palette-input-${index}-right`}
328326
width="50px"
329327
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)