[Lens] Fix state setting via mutation (#104420)
This commit is contained in:
parent
f9f5cf2249
commit
1f06898beb
|
@ -540,7 +540,10 @@ export function DimensionEditor(
|
|||
(yAxisConfig) => yAxisConfig.forAccessor === accessor
|
||||
);
|
||||
if (existingIndex !== -1) {
|
||||
newYAxisConfigs[existingIndex].axisMode = newMode;
|
||||
newYAxisConfigs[existingIndex] = {
|
||||
...newYAxisConfigs[existingIndex],
|
||||
axisMode: newMode,
|
||||
};
|
||||
} else {
|
||||
newYAxisConfigs.push({
|
||||
forAccessor: accessor,
|
||||
|
@ -625,9 +628,9 @@ const ColorPicker = ({
|
|||
const existingIndex = newYConfigs.findIndex((yConfig) => yConfig.forAccessor === accessor);
|
||||
if (existingIndex !== -1) {
|
||||
if (text === '') {
|
||||
delete newYConfigs[existingIndex].color;
|
||||
newYConfigs[existingIndex] = { ...newYConfigs[existingIndex], color: undefined };
|
||||
} else {
|
||||
newYConfigs[existingIndex].color = output.hex;
|
||||
newYConfigs[existingIndex] = { ...newYConfigs[existingIndex], color: output.hex };
|
||||
}
|
||||
} else {
|
||||
newYConfigs.push({
|
||||
|
|
|
@ -198,7 +198,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
await testSubjects.missingOrFail('lnsXY_yDimensionPanel > lns-dimensionTrigger');
|
||||
});
|
||||
|
||||
it('should allow creation of a multi-axis chart', async () => {
|
||||
it('should allow creation of a multi-axis chart and switching multiple times', async () => {
|
||||
await PageObjects.visualize.navigateToNewVisualization();
|
||||
await PageObjects.visualize.clickVisType('lens');
|
||||
await elasticChart.setNewChartUiDebugFlag(true);
|
||||
|
@ -225,14 +225,21 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
await PageObjects.lens.changeAxisSide('right');
|
||||
|
||||
await PageObjects.lens.closeDimensionEditor();
|
||||
|
||||
await PageObjects.lens.waitForVisualization();
|
||||
|
||||
const data = await PageObjects.lens.getCurrentChartDebugState();
|
||||
let data = await PageObjects.lens.getCurrentChartDebugState();
|
||||
expect(data?.axes?.y.length).to.eql(2);
|
||||
expect(data?.axes?.y.some(({ position }) => position === 'right')).to.eql(true);
|
||||
|
||||
await PageObjects.lens.changeAxisSide('left');
|
||||
await PageObjects.lens.waitForVisualization();
|
||||
data = await PageObjects.lens.getCurrentChartDebugState();
|
||||
expect(data?.axes?.y.length).to.eql(1);
|
||||
expect(data?.axes?.y.some(({ position }) => position === 'right')).to.eql(false);
|
||||
|
||||
await PageObjects.lens.changeAxisSide('right');
|
||||
await PageObjects.lens.waitForVisualization();
|
||||
|
||||
await PageObjects.lens.closeDimensionEditor();
|
||||
});
|
||||
|
||||
it('should show value labels on bar charts when enabled', async () => {
|
||||
|
|
Loading…
Reference in a new issue