codeant-ai-for-open-source[bot] commented on code in PR #36889:
URL: https://github.com/apache/superset/pull/36889#discussion_r3635459794


##########
superset-frontend/src/dashboard/components/gridComponents/TabsRenderer/TabsRenderer.test.tsx:
##########
@@ -199,4 +201,24 @@ describe('TabsRenderer', () => {
     expect(screen.getByText('Tab 1 Content')).toBeInTheDocument();
     expect(screen.queryByText('Tab 2 Content')).not.toBeInTheDocument(); // 
Not active
   });
+
+  test('activates dragging when the pointer starts on a tab title input', () 
=> {
+    // Tab titles render a textarea that covers most of the tab in edit mode
+    const textarea = document.createElement('textarea');
+    document.body.appendChild(textarea);
+    const nativeEvent = new MouseEvent('pointerdown', { button: 0 });
+    Object.defineProperty(nativeEvent, 'isPrimary', { value: true });
+    textarea.dispatchEvent(nativeEvent);
+
+    const [activator] = PointerSensor.activators;
+    const onActivation = jest.fn();
+    const activated = activator.handler(
+      { nativeEvent } as unknown as PointerEvent<HTMLElement>,
+      { onActivation },
+    );
+
+    expect(nativeEvent.target).toBe(textarea);
+    expect(activated).toBe(true);
+    expect(onActivation).toHaveBeenCalled();
+  });

Review Comment:
   **Suggestion:** This test validates the opposite of the stated fix: it 
expects drag activation when the pointer starts on the tab title input. If the 
intended behavior is to disable drag initiation from editable inputs, this 
assertion will lock in incorrect behavior and allow regressions in the real 
fix. Update the expectation to assert that activation is blocked for 
input/textarea targets. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Unit test enforces dragging from tab title inputs.
   - ⚠️ Behavior contradicts PR requirement to disable drag.
   - ⚠️ Future drag-disabling changes will fail this misaligned test.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Run the frontend Jest test suite so that
   
`superset-frontend/src/dashboard/components/gridComponents/TabsRenderer/TabsRenderer.test.tsx`
   is executed, and locate the test named `activates dragging when the pointer 
starts on a
   tab title input` at lines 205–223.
   
   2. Observe that this test manually creates a `textarea` element, appends it 
to
   `document.body` (lines 207–208), synthesizes a `MouseEvent('pointerdown', { 
button: 0 })`,
   and sets `nativeEvent.isPrimary = true` (lines 209–210) before dispatching 
it on the
   textarea (line 211).
   
   3. The test then retrieves the first pointer activator from 
`PointerSensor.activators`
   (line 213) and calls `activator.handler({ nativeEvent } as unknown as
   PointerEvent<HTMLElement>, { onActivation })` (lines 215–217), asserting 
that the handler
   returns `true` and that `onActivation` is called (lines 220–222), thereby 
explicitly
   encoding that drag activation should succeed when the pointer originates on 
a textarea tab
   title input.
   
   4. Compare this encoded behavior with the PR title and description, which 
state that
   drag/tab reordering should be disabled when interacting with tab title input 
fields; the
   mismatch demonstrates that the automated test suite currently enforces 
behavior opposite
   to the specified requirement, so any implementation that correctly disables 
drag from
   inputs will fail this test and be blocked until the expectation is updated.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=a54f1fa2d2614f73bed6b66726caa940&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=a54f1fa2d2614f73bed6b66726caa940&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/src/dashboard/components/gridComponents/TabsRenderer/TabsRenderer.test.tsx
   **Line:** 205:223
   **Comment:**
        *Logic Error: This test validates the opposite of the stated fix: it 
expects drag activation when the pointer starts on the tab title input. If the 
intended behavior is to disable drag initiation from editable inputs, this 
assertion will lock in incorrect behavior and allow regressions in the real 
fix. Update the expectation to assert that activation is blocked for 
input/textarea targets.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F36889&comment_hash=4a190b3f9f4bbc9ded019468423480231bbb7339ef2c16c11914241b0063b04b&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F36889&comment_hash=4a190b3f9f4bbc9ded019468423480231bbb7339ef2c16c11914241b0063b04b&reaction=dislike'>👎</a>



-- 
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