fix(sensor-placement): refine drawing export and editor density
This commit is contained in:
@@ -31,7 +31,20 @@ jest.mock("@components/olmap/core/MapComponent", () => ({
|
||||
}));
|
||||
|
||||
jest.mock("@mui/x-data-grid", () => ({
|
||||
DataGrid: () => <div data-testid="scheme-grid" />,
|
||||
DataGrid: (props: {
|
||||
density?: string;
|
||||
initialState?: { density?: string };
|
||||
rowHeight?: number;
|
||||
columnHeaderHeight?: number;
|
||||
}) => (
|
||||
<div
|
||||
data-testid="scheme-grid"
|
||||
data-density={props.density ?? "uncontrolled"}
|
||||
data-initial-density={props.initialState?.density ?? ""}
|
||||
data-row-height={props.rowHeight ?? "automatic"}
|
||||
data-column-header-height={props.columnHeaderHeight ?? "automatic"}
|
||||
/>
|
||||
),
|
||||
GridToolbar: () => null,
|
||||
}));
|
||||
|
||||
@@ -173,4 +186,25 @@ describe("SchemeEditor notifications", () => {
|
||||
message: "请先点击要替换的监测点",
|
||||
});
|
||||
});
|
||||
|
||||
it("lets the Data Grid density selector control row sizing", () => {
|
||||
render(<SchemeEditor scheme={scheme} network="fengyang" />);
|
||||
|
||||
expect(screen.getByTestId("scheme-grid")).toHaveAttribute(
|
||||
"data-density",
|
||||
"uncontrolled",
|
||||
);
|
||||
expect(screen.getByTestId("scheme-grid")).toHaveAttribute(
|
||||
"data-initial-density",
|
||||
"compact",
|
||||
);
|
||||
expect(screen.getByTestId("scheme-grid")).toHaveAttribute(
|
||||
"data-row-height",
|
||||
"automatic",
|
||||
);
|
||||
expect(screen.getByTestId("scheme-grid")).toHaveAttribute(
|
||||
"data-column-header-height",
|
||||
"automatic",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user