fix some test errors

This commit is contained in:
Blake Blackshear 2021-06-13 14:49:13 -05:00
parent 3aa7f753b3
commit 175c85d69a
2 changed files with 25 additions and 17 deletions

View File

@ -83,26 +83,30 @@ export default function Camera({ camera }) {
let player;
if (viewMode === 'live') {
player = <>
<div>
<JSMpegPlayer camera={camera} />
</div>
</>;
player = (
<Fragment>
<div>
<JSMpegPlayer camera={camera} />
</div>
</Fragment>
);
}
else if (viewMode === 'debug') {
player = <>
<div>
<AutoUpdatingCameraImage camera={camera} searchParams={searchParams} />
</div>
player = (
<Fragment>
<div>
<AutoUpdatingCameraImage camera={camera} searchParams={searchParams} />
</div>
<Button onClick={handleToggleSettings} type="text">
<span className="w-5 h-5">
<SettingsIcon />
</span>{' '}
<span>{showSettings ? 'Hide' : 'Show'} Options</span>
</Button>
{showSettings ? <Card header="Options" elevated={false} content={optionContent} /> : null}
</>;
<Button onClick={handleToggleSettings} type="text">
<span className="w-5 h-5">
<SettingsIcon />
</span>{' '}
<span>{showSettings ? 'Hide' : 'Show'} Options</span>
</Button>
{showSettings ? <Card header="Options" elevated={false} content={optionContent} /> : null}
</Fragment>
);
}
return (

View File

@ -32,7 +32,10 @@ describe('Camera Route', () => {
},
mockSetOptions,
]);
render(<Camera camera="front" />);
fireEvent.click(screen.queryByText('Debug'));
fireEvent.click(screen.queryByText('Show Options'));
expect(screen.queryByTestId('mock-image')).toHaveTextContent(
'bbox=1&timestamp=0&zones=1&mask=0&motion=1&regions=0'
@ -47,6 +50,7 @@ describe('Camera Route', () => {
render(<Camera camera="front" />);
fireEvent.click(screen.queryByText('Debug'));
fireEvent.click(screen.queryByText('Show Options'));
fireEvent.change(screen.queryByTestId('bbox-input'), { target: { checked: true } });
fireEvent.change(screen.queryByTestId('timestamp-input'), { target: { checked: true } });