sadpandajoe opened a new pull request, #44678:
URL: https://github.com/apache/superset/pull/44678

   ### SUMMARY
   Adds unit tests for the dashboard edit-mode drag-and-drop rules:
   
   - `handleDrop` rejects forbidden and null drop positions and unmounted 
components without calling `onDrop` or clearing the drop cache, while still 
clearing the drop indicator.
   - When moving an item later within the same parent, the destination index is 
shifted down by one; it is not shifted for same-type items, items from a 
different parent, or items moving to an earlier index.
   - `dropToChild` (boolean or function) appends the item to the target's 
children, including an empty container; a function returning false drops the 
item next to the target in its parent instead.
   - Without a parent component, the item drops at the component's index; the 
drop cache is cleared after a successful drop.
   - The DragDroppable drag/drop config gates `canDrag`/`canDrop` on 
`disableDragDrop`, captures parent fields in `beginDrag`, guards `hover` and 
`drop` against unmounted targets and already-handled nested drops, and maps 
monitor state to props (including the idle state where nothing is being 
dragged).
   
   `getDropPosition` and `handleHover` are mocked here to isolate these layers; 
`getDropPosition` has its own existing tests.
   
   Test-only change; no production code is modified. Each new assertion was 
verified to fail when the guarded production line is temporarily broken.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A (tests only)
   
   ### TESTING INSTRUCTIONS
   ```bash
   cd superset-frontend
   npm run test -- src/dashboard/components/dnd/handleDrop.test.ts 
src/dashboard/components/dnd/dragDroppableConfig.test.ts
   ```
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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