bito-code-review[bot] commented on code in PR #40696:
URL: https://github.com/apache/superset/pull/40696#discussion_r3345682358
##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx:
##########
@@ -800,6 +800,73 @@ test('does not auto-create a filter when createNewOnOpen
is false', () => {
expect(screen.queryByText(DATASET_REGEX)).not.toBeInTheDocument();
});
+test('enables save button and includes updated title when editing an existing
divider', async () => {
+ jest.useFakeTimers();
+
+ const nativeFilterDividerConfig = [
+ {
+ id: 'NATIVE_FILTER_DIVIDER-1',
+ type: 'DIVIDER' as const,
+ title: 'First Edit',
+ description: '',
+ scope: { rootPath: ['ROOT'], excluded: [] },
+ },
+ ];
+
+ const state = {
+ ...defaultState(),
+ dashboardInfo: {
+ metadata: {
+ native_filter_configuration: nativeFilterDividerConfig,
+ },
+ },
+ dashboardLayout,
+ };
+
+ const onSave = jest.fn();
+
+ defaultRender(state, {
+ ...props,
+ createNewOnOpen: false,
+ initialFilterId: 'NATIVE_FILTER_DIVIDER-1',
+ onSave,
+ });
+
+ // Save button should be disabled when no changes have been made
+ expect(screen.getByRole('button', { name: SAVE_REGEX })).toBeDisabled();
+
+ // Editing the title field should mark the divider modified and enable save
+ const titleInput = screen.getByRole('textbox', { name: /^title$/i });
+ await userEvent.clear(titleInput);
+ await userEvent.type(titleInput, 'Second Edit');
+
+ jest.advanceTimersByTime(1000);
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incorrect timer advancement</b></div>
<div id="fix">
Timer advances by 1000ms but `Constants.SLOW_DEBOUNCE` is 500ms. Use 500ms
to match the actual debounce delay and avoid unnecessary waiting.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```
---
a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
+++
b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.test.tsx
@@ -840,7 +840,7 @@ test('enables save button and includes updated title
when editing an existing d
await userEvent.type(titleInput, 'Second Edit');
- jest.advanceTimersByTime(1000);
+ jest.advanceTimersByTime(500);
jest.useRealTimers();
await waitFor(() =>
```
</div>
</details>
</div>
<small><i>Code Review Run #d51bc7</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]