amym-li commented on code in PR #36346:
URL: https://github.com/apache/superset/pull/36346#discussion_r2734627579
##########
superset-frontend/src/dashboard/components/gridComponents/Column/Column.test.tsx:
##########
@@ -16,59 +16,96 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { fireEvent, render } from 'spec/helpers/testing-library';
-
-import BackgroundStyleDropdown from
'src/dashboard/components/menu/BackgroundStyleDropdown';
-import IconButton from 'src/dashboard/components/IconButton';
+import React from 'react';
+import {
+ fireEvent,
+ render,
+ RenderResult,
+ screen,
+} from 'spec/helpers/testing-library';
import { getMockStore } from 'spec/fixtures/mockStore';
import { dashboardLayout as mockLayout } from
'spec/fixtures/mockDashboardLayout';
import { initialState } from 'src/SqlLab/fixtures';
import Column from './Column';
jest.mock('src/dashboard/components/dnd/DragDroppable', () => ({
- Draggable: ({ children }) => (
- <div data-test="mock-draggable">{children({})}</div>
- ),
- Droppable: ({ children, depth }) => (
- <div data-test="mock-droppable" depth={depth}>
+ Draggable: ({
+ children,
+ }: {
+ children: (args: object) => React.ReactNode;
+ }) => <div data-test="mock-draggable">{children({})}</div>,
+ Droppable: ({
+ children,
+ depth,
+ }: {
+ children: (args: object) => React.ReactNode;
+ depth: number;
+ }) => (
+ <div data-test="mock-droppable" data-depth={depth}>
{children({})}
</div>
),
}));
-jest.mock(
- 'src/dashboard/containers/DashboardComponent',
- () =>
- ({ availableColumnCount, depth }) => (
- <div data-test="mock-dashboard-component" depth={depth}>
- {availableColumnCount}
- </div>
- ),
-);
-jest.mock(
- 'src/dashboard/components/menu/WithPopoverMenu',
- () =>
- ({ children }) => <div data-test="mock-with-popover-menu">{children}</div>,
-);
-jest.mock(
- 'src/dashboard/components/DeleteComponentButton',
- () =>
- ({ onDelete }) => (
- <button
- type="button"
- data-test="mock-delete-component-button"
- onClick={onDelete}
- >
- Delete
- </button>
- ),
-);
+jest.mock('src/dashboard/containers/DashboardComponent', () => {
+ return ({
+ availableColumnCount,
+ depth,
+ }: {
+ availableColumnCount: number;
+ depth: number;
+ }) => (
+ <div data-test="mock-dashboard-component" data-depth={depth}>
+ {availableColumnCount}
+ </div>
+ );
+});
+jest.mock('src/dashboard/components/menu/WithPopoverMenu', () => {
+ return ({ children }: { children: React.ReactNode }) => (
+ <div data-test="mock-with-popover-menu">{children}</div>
+ );
+});
+
+jest.mock('src/dashboard/components/DeleteComponentButton', () => {
+ return ({ onDelete }: { onDelete: () => void }) => (
+ <button
+ type="button"
+ data-test="mock-delete-component-button"
+ onClick={onDelete}
+ >
+ Delete
+ </button>
+ );
+});
const columnWithoutChildren = {
...mockLayout.present.COLUMN_ID,
children: [],
};
-const props = {
+
+interface ColumnTestProps {
+ id: string;
+ parentId: string;
+ component: typeof mockLayout.present.COLUMN_ID;
+ parentComponent: typeof mockLayout.present.ROW_ID;
+ index: number;
+ depth: number;
+ editMode: boolean;
+ availableColumnCount: number;
+ minColumnWidth: number;
+ columnWidth: number;
+ occupiedColumnCount?: number;
+ onResizeStart: () => void;
+ onResize: () => void;
+ onResizeStop: () => void;
+ handleComponentDrop: () => void;
+ deleteComponent: () => void;
+ updateComponents: () => void;
+ isComponentVisible: boolean;
+ onChangeTab: () => void;
+}
Review Comment:
Yes, thank you for catching that! I've updated the PR
--
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]