bito-code-review[bot] commented on code in PR #36993:
URL: https://github.com/apache/superset/pull/36993#discussion_r2684003565


##########
superset-frontend/src/explore/components/ExploreViewContainer/ExploreViewContainer.test.tsx:
##########
@@ -474,3 +474,210 @@ test('shows error indicator with function labels', async 
() => {
 
   expect(await screen.findByText(/Metric is required/)).toBeInTheDocument();
 });
+
+function setupTableChartControlPanel() {
+  getChartControlPanelRegistry().registerValue('table', {
+    controlPanelSections: [],
+  });
+}
+
+test('automatic axis title margin adjustment sets X axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: '' },
+          x_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    const { rerender } = renderWithRouter({ initialState: customState });
+
+    await waitFor(() => {
+      rerender(
+        <MemoryRouter initialEntries={[defaultPath]}>
+          <Route path={defaultPath}>
+            <ExploreViewContainer />
+          </Route>
+        </MemoryRouter>,
+      );
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment sets Y axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          y_axis_title: { value: '' },
+          y_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Verify initial state renders without errors
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment resets X axis margin to 0 when 
title is removed', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: 'X Axis Label' },
+          x_axis_title_margin: { value: 30 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should handle title removal and reset margin
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment resets Y axis margin to 0 when 
title is removed', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          y_axis_title: { value: 'Y Axis Label' },
+          y_axis_title_margin: { value: 30 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should handle title removal and reset margin
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment does not change X axis margin 
when title is added but margin is already non-zero', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: '' },
+          x_axis_title_margin: { value: 50 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should not override user-set margin values
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment does not change Y axis margin 
when title is added but margin is already non-zero', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          y_axis_title: { value: '' },
+          y_axis_title_margin: { value: 50 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should not override user-set margin values
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Y axis non-zero margin test inadequate</b></div>
   <div id="fix">
   
   Similar for Y axis.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #123592</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/explore/components/ExploreViewContainer/ExploreViewContainer.test.tsx:
##########
@@ -474,3 +474,210 @@ test('shows error indicator with function labels', async 
() => {
 
   expect(await screen.findByText(/Metric is required/)).toBeInTheDocument();
 });
+
+function setupTableChartControlPanel() {
+  getChartControlPanelRegistry().registerValue('table', {
+    controlPanelSections: [],
+  });
+}
+
+test('automatic axis title margin adjustment sets X axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: '' },
+          x_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    const { rerender } = renderWithRouter({ initialState: customState });
+
+    await waitFor(() => {
+      rerender(
+        <MemoryRouter initialEntries={[defaultPath]}>
+          <Route path={defaultPath}>
+            <ExploreViewContainer />
+          </Route>
+        </MemoryRouter>,
+      );
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment sets Y axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          y_axis_title: { value: '' },
+          y_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Verify initial state renders without errors
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment resets X axis margin to 0 when 
title is removed', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: 'X Axis Label' },
+          x_axis_title_margin: { value: 30 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should handle title removal and reset margin
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment resets Y axis margin to 0 when 
title is removed', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          y_axis_title: { value: 'Y Axis Label' },
+          y_axis_title_margin: { value: 30 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should handle title removal and reset margin
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment does not change X axis margin 
when title is added but margin is already non-zero', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: '' },
+          x_axis_title_margin: { value: 50 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should not override user-set margin values
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Non-zero margin test inadequate</b></div>
   <div id="fix">
   
   Test sets empty title initially, doesn't simulate adding title.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #123592</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/explore/components/ExploreViewContainer/ExploreViewContainer.test.tsx:
##########
@@ -474,3 +474,210 @@ test('shows error indicator with function labels', async 
() => {
 
   expect(await screen.findByText(/Metric is required/)).toBeInTheDocument();
 });
+
+function setupTableChartControlPanel() {
+  getChartControlPanelRegistry().registerValue('table', {
+    controlPanelSections: [],
+  });
+}
+
+test('automatic axis title margin adjustment sets X axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: '' },
+          x_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    const { rerender } = renderWithRouter({ initialState: customState });
+
+    await waitFor(() => {
+      rerender(
+        <MemoryRouter initialEntries={[defaultPath]}>
+          <Route path={defaultPath}>
+            <ExploreViewContainer />
+          </Route>
+        </MemoryRouter>,
+      );
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Inadequate test coverage for margin adjustment</b></div>
   <div id="fix">
   
   The test claims to verify automatic X axis margin adjustment when title is 
added, but it sets an empty title and doesn't simulate a control change, so the 
adjustment logic isn't exercised. This means bugs in the margin logic could go 
undetected.
   </div>
   
   
   </div>
   
   <details>
   <summary><b>Citations</b></summary>
   <ul>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/d858cbc/AGENTS.md#L22";>AGENTS.md:22</a>
   </li>
   
   </ul>
   </details>
   
   
   
   
   <small><i>Code Review Run #123592</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/explore/components/ExploreViewContainer/ExploreViewContainer.test.tsx:
##########
@@ -474,3 +474,210 @@ test('shows error indicator with function labels', async 
() => {
 
   expect(await screen.findByText(/Metric is required/)).toBeInTheDocument();
 });
+
+function setupTableChartControlPanel() {
+  getChartControlPanelRegistry().registerValue('table', {
+    controlPanelSections: [],
+  });
+}
+
+test('automatic axis title margin adjustment sets X axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: '' },
+          x_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    const { rerender } = renderWithRouter({ initialState: customState });
+
+    await waitFor(() => {
+      rerender(
+        <MemoryRouter initialEntries={[defaultPath]}>
+          <Route path={defaultPath}>
+            <ExploreViewContainer />
+          </Route>
+        </MemoryRouter>,
+      );
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment sets Y axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          y_axis_title: { value: '' },
+          y_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Verify initial state renders without errors
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Inadequate test coverage for Y axis margin</b></div>
   <div id="fix">
   
   Similar to the X axis test, this doesn't simulate a control change to add a 
title, so the adjustment isn't tested.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #123592</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/explore/components/ExploreViewContainer/ExploreViewContainer.test.tsx:
##########
@@ -474,3 +474,210 @@ test('shows error indicator with function labels', async 
() => {
 
   expect(await screen.findByText(/Metric is required/)).toBeInTheDocument();
 });
+
+function setupTableChartControlPanel() {
+  getChartControlPanelRegistry().registerValue('table', {
+    controlPanelSections: [],
+  });
+}
+
+test('automatic axis title margin adjustment sets X axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: '' },
+          x_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    const { rerender } = renderWithRouter({ initialState: customState });
+
+    await waitFor(() => {
+      rerender(
+        <MemoryRouter initialEntries={[defaultPath]}>
+          <Route path={defaultPath}>
+            <ExploreViewContainer />
+          </Route>
+        </MemoryRouter>,
+      );
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment sets Y axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          y_axis_title: { value: '' },
+          y_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Verify initial state renders without errors
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment resets X axis margin to 0 when 
title is removed', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: 'X Axis Label' },
+          x_axis_title_margin: { value: 30 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should handle title removal and reset margin
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Reset test doesn't simulate title removal</b></div>
   <div id="fix">
   
   Test sets a title but doesn't simulate removal, so reset logic isn't tested.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #123592</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/explore/components/ExploreViewContainer/ExploreViewContainer.test.tsx:
##########
@@ -474,3 +474,210 @@ test('shows error indicator with function labels', async 
() => {
 
   expect(await screen.findByText(/Metric is required/)).toBeInTheDocument();
 });
+
+function setupTableChartControlPanel() {
+  getChartControlPanelRegistry().registerValue('table', {
+    controlPanelSections: [],
+  });
+}
+
+test('automatic axis title margin adjustment sets X axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: '' },
+          x_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    const { rerender } = renderWithRouter({ initialState: customState });
+
+    await waitFor(() => {
+      rerender(
+        <MemoryRouter initialEntries={[defaultPath]}>
+          <Route path={defaultPath}>
+            <ExploreViewContainer />
+          </Route>
+        </MemoryRouter>,
+      );
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment sets Y axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          y_axis_title: { value: '' },
+          y_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Verify initial state renders without errors
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment resets X axis margin to 0 when 
title is removed', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: 'X Axis Label' },
+          x_axis_title_margin: { value: 30 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should handle title removal and reset margin
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment resets Y axis margin to 0 when 
title is removed', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          y_axis_title: { value: 'Y Axis Label' },
+          y_axis_title_margin: { value: 30 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should handle title removal and reset margin
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Y axis reset test inadequate</b></div>
   <div id="fix">
   
   Similar issue for Y axis reset.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #123592</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset-frontend/src/explore/components/ExploreViewContainer/ExploreViewContainer.test.tsx:
##########
@@ -474,3 +474,210 @@ test('shows error indicator with function labels', async 
() => {
 
   expect(await screen.findByText(/Metric is required/)).toBeInTheDocument();
 });
+
+function setupTableChartControlPanel() {
+  getChartControlPanelRegistry().registerValue('table', {
+    controlPanelSections: [],
+  });
+}
+
+test('automatic axis title margin adjustment sets X axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: '' },
+          x_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    const { rerender } = renderWithRouter({ initialState: customState });
+
+    await waitFor(() => {
+      rerender(
+        <MemoryRouter initialEntries={[defaultPath]}>
+          <Route path={defaultPath}>
+            <ExploreViewContainer />
+          </Route>
+        </MemoryRouter>,
+      );
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment sets Y axis margin to 30 when 
title is added and margin is 0', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          y_axis_title: { value: '' },
+          y_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Verify initial state renders without errors
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment resets X axis margin to 0 when 
title is removed', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: 'X Axis Label' },
+          x_axis_title_margin: { value: 30 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should handle title removal and reset margin
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment resets Y axis margin to 0 when 
title is removed', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          y_axis_title: { value: 'Y Axis Label' },
+          y_axis_title_margin: { value: 30 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should handle title removal and reset margin
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment does not change X axis margin 
when title is added but margin is already non-zero', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: '' },
+          x_axis_title_margin: { value: 50 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should not override user-set margin values
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment does not change Y axis margin 
when title is added but margin is already non-zero', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          y_axis_title: { value: '' },
+          y_axis_title_margin: { value: 50 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should not override user-set margin values
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});
+
+test('automatic axis title margin adjustment handles both X and Y axis titles 
being set simultaneously', async () => {
+  setupTableChartControlPanel();
+  try {
+    const customState = {
+      ...reduxState,
+      explore: {
+        ...reduxState.explore,
+        controls: {
+          ...reduxState.explore.controls,
+          x_axis_title: { value: '' },
+          x_axis_title_margin: { value: 0 },
+          y_axis_title: { value: '' },
+          y_axis_title_margin: { value: 0 },
+        },
+      },
+    };
+
+    renderWithRouter({ initialState: customState });
+
+    // Component should handle both axes independently
+    await waitFor(() => {
+      expect(
+        screen.queryByTestId('query-error-tooltip-trigger'),
+      ).not.toBeInTheDocument();
+    });
+  } finally {
+    getChartControlPanelRegistry().remove('table');
+  }
+});

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Simultaneous titles test inadequate</b></div>
   <div id="fix">
   
   Test sets empty titles, doesn't simulate setting them.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #123592</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to