rusackas commented on code in PR #37880:
URL: https://github.com/apache/superset/pull/37880#discussion_r3370014041


##########
superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndFilterSelect.test.tsx:
##########
@@ -181,78 +174,8 @@ test('renders options with adhoc metric', async () => {
   ).toBeInTheDocument();
 });
 
-test('cannot drop a column that is not part of the simple column selection', 
() => {
-  const adhocMetric = new AdhocMetric({
-    expression: 'AVG(birth_names.num)',
-    metric_name: 'avg__num',
-  });
-  const { getByTestId, getAllByTestId } = render(
-    <>
-      <DatasourcePanelDragOption
-        value={{ column_name: 'order_date' }}
-        type={DndItemType.Column}
-      />
-      <DatasourcePanelDragOption
-        value={{ column_name: 'address_line1' }}
-        type={DndItemType.Column}
-      />
-      <DatasourcePanelDragOption
-        value={{
-          metric_name: 'metric_a',
-          expression: 'AGG(metric_a)',
-          uuid: '1',
-        }}
-        type={DndItemType.Metric}
-      />
-      {setup({
-        formData: {
-          ...baseFormData,
-          metrics: [adhocMetric as unknown as QueryFormMetric],
-        },
-        columns: [{ column_name: 'order_date' }],
-      })}
-    </>,
-    {
-      useDnd: true,
-      store,
-    },
-  );
-
-  const selections = getAllByTestId('DatasourcePanelDragOption');
-  const acceptableColumn = selections[0];
-  const unacceptableColumn = selections[1];
-  const metricType = selections[2];
-  const currentMetric = getByTestId('dnd-labels-container');
-
-  fireEvent.dragStart(unacceptableColumn);
-  fireEvent.dragOver(currentMetric);
-  fireEvent.drop(currentMetric);
-
-  expect(screen.queryByTestId('filter-edit-popover')).not.toBeInTheDocument();
-
-  fireEvent.dragStart(acceptableColumn);
-  fireEvent.dragOver(currentMetric);
-  fireEvent.drop(currentMetric);
-
-  const filterConfigPopup = screen.getByTestId('filter-edit-popover');
-  
expect(within(filterConfigPopup).getByText('order_date')).toBeInTheDocument();
-
-  fireEvent.keyDown(filterConfigPopup, {
-    key: 'Escape',
-    code: 'Escape',
-    keyCode: 27,
-    charCode: 27,
-  });
-  expect(screen.queryByTestId('filter-edit-popover')).not.toBeInTheDocument();
-
-  fireEvent.dragStart(metricType);
-  fireEvent.dragOver(currentMetric);
-  fireEvent.drop(currentMetric);
-
-  expect(
-    within(screen.getByTestId('filter-edit-popover')).getByTestId('react-ace'),
-  ).toHaveTextContent('AGG(metric_a)');
-});
+// Note: Drag-and-drop tests removed - @dnd-kit uses pointer events instead of

Review Comment:
   Good call — this coverage is in place as of `0df9742037`. 
`DndFilterSelect.test.tsx` now uses the `captureDroppableData` + `simulateDrop` 
harness from `dndTestUtils.ts` to restore all three type-gating scenarios: 
`cannot drop a column that is not part of the simple column selection` (line 
~202) and the two `disallow_adhoc_metrics` cases — `can drop a column from the 
simple column selection` (line ~268) and `cannot drop anything but a simple 
column selection` (line ~302). They exercise the filter control's 
`accept`/`canDrop` gating through the same `resolveDragEnd` dispatcher the live 
provider runs, so the gating is genuinely covered rather than just rendered.



##########
superset-frontend/src/explore/components/ExploreContainer/ExploreContainer.test.tsx:
##########
@@ -57,69 +53,29 @@ test('should render children', () => {
     <ExploreContainer>
       <MockChildren />
     </ExploreContainer>,
-    { useRedux: true, useDnd: true },
+    { useRedux: true },
   );
   expect(getByTestId('mock-children')).toBeInTheDocument();
   expect(getByText('not dragging')).toBeInTheDocument();
 });
 
-test('should only propagate dragging state when dragging the panel option', () 
=> {
-  const defaultProps = {
-    label: <span>Test label</span>,
-    tooltipTitle: 'This is a tooltip title',
-    onRemove: jest.fn(),
-    onMoveLabel: jest.fn(),
-    onDropLabel: jest.fn(),
-    type: 'test',
-    index: 0,
-  };
+test('should initially have dragging set to false', () => {

Review Comment:
   Covered — `0df9742037` restored this branch in `ExploreContainer.test.tsx`. 
Alongside `propagates dragging state when dragging a panel option` (which 
drives `onDragStart` with a DatasourcePanel item and asserts `DraggingContext` 
flips to dragging), there's now `does not propagate dragging state for an 
in-list reorder`, which fires `onDragStart` with an item carrying `dragIndex` 
and asserts the dragging class is never applied. That's exactly the 
`handleDragStart` gate on `!('dragIndex' in data)`, so the previously-untested 
branch is covered again.



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