mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-02-04 18:36:00 -05:00
74b9f36a75
This requires a bunch of package name changes. See [https://mui.com/blog/material-ui-is-now-mui/] for their rationale. [https://mui.com/guides/migration-v4/] lists the changes: ``` @material-ui/core -> @mui/material @material-ui/system -> @mui/system @material-ui/unstyled -> @mui/core @material-ui/styles -> @mui/styles @material-ui/icons -> @mui/icons-material @material-ui/lab -> @mui/lab @material-ui/types -> @mui/types @material-ui/styled-engine -> @mui/styled-engine @material-ui/styled-engine-sc ->@mui/styled-engine-sc @material-ui/private-theming -> @mui/private-theming @material-ui/codemod -> @mui/codemod @material-ui/docs -> @mui/docs @material-ui/envinfo -> @mui/envinfo ``` We only use a few of these.
24 lines
898 B
TypeScript
24 lines
898 B
TypeScript
// This file is part of Moonfire NVR, a security camera network video recorder.
|
|
// Copyright (C) 2021 The Moonfire NVR Authors; see AUTHORS and LICENSE.txt.
|
|
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception
|
|
|
|
import { createTheme, ThemeProvider } from "@mui/material/styles";
|
|
import { render } from "@testing-library/react";
|
|
import { SnackbarProvider } from "./snackbars";
|
|
|
|
export function renderWithCtx(
|
|
children: React.ReactElement
|
|
): Pick<ReturnType<typeof render>, "rerender"> {
|
|
function wrapped(children: React.ReactElement): React.ReactElement {
|
|
return (
|
|
<ThemeProvider theme={createTheme()}>
|
|
<SnackbarProvider autoHideDuration={5000}>{children}</SnackbarProvider>
|
|
</ThemeProvider>
|
|
);
|
|
}
|
|
const { rerender } = render(wrapped(children));
|
|
return {
|
|
rerender: (children: React.ReactElement) => rerender(wrapped(children)),
|
|
};
|
|
}
|