mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-12-02 06:07:51 -05:00
start a new React-based UI (#111)
This doesn't do much yet but should provide a better foundation for improvement than the jQuery UI, as described in the github issue.
This commit is contained in:
20
ui/src/testutil.tsx
Normal file
20
ui/src/testutil.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
// 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 { 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 (
|
||||
<SnackbarProvider autoHideDuration={5000}>{children}</SnackbarProvider>
|
||||
);
|
||||
}
|
||||
const { rerender } = render(wrapped(children));
|
||||
return {
|
||||
rerender: (children: React.ReactElement) => rerender(wrapped(children)),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user