Merge branch 'main' into release/0.10.0
This commit is contained in:
@@ -303,4 +303,4 @@ export const CarUpdatesProvider = ({ children }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useCarUpdatesContext = () => useContext(CarUpdatesContext);
|
export const useCarUpdatesContext = () => useContext(CarUpdatesContext);
|
||||||
@@ -23,7 +23,7 @@ const checkVehiclesResult = (error, busy, vehicles) => {
|
|||||||
const checkFleetsResult = (error, busy, fleets) => {
|
const checkFleetsResult = (error, busy, fleets) => {
|
||||||
checkBaseResults(error, busy);
|
checkBaseResults(error, busy);
|
||||||
expect(screen.getByTestId("fleets").innerHTML).toEqual(fleets);
|
expect(screen.getByTestId("fleets").innerHTML).toEqual(fleets);
|
||||||
}
|
};
|
||||||
|
|
||||||
const checkBaseResults = (error, busy) => {
|
const checkBaseResults = (error, busy) => {
|
||||||
expect(screen.getByTestId("error").innerHTML).toEqual(error);
|
expect(screen.getByTestId("error").innerHTML).toEqual(error);
|
||||||
@@ -69,7 +69,7 @@ describe("VehicleContext", () => {
|
|||||||
);
|
);
|
||||||
checkFleetsResult("", "false", JSON.stringify(["fleet1", "fleet2"]));
|
checkFleetsResult("", "false", JSON.stringify(["fleet1", "fleet2"]));
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
describe("getVehicles", () => {
|
describe("getVehicles", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@@ -214,4 +214,4 @@ IssueSelectionTable.propTypes = {
|
|||||||
onSelectAll: PropTypes.func,
|
onSelectAll: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default IssueSelectionTable;
|
export default IssueSelectionTable;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import {FormControl} from "@material-ui/core";
|
import { FormControl } from "@material-ui/core";
|
||||||
import useStyles from "../../useStyles";
|
import useStyles from "../../useStyles";
|
||||||
|
|
||||||
export const Parameters = (props) => {
|
export const Parameters = (props) => {
|
||||||
const {params} = props;
|
const { params } = props;
|
||||||
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
@@ -11,19 +11,19 @@ export const Parameters = (props) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {data, handleDataChange} = props;
|
const { data, handleDataChange } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormControl size="small" className={classes.formControl}>
|
<FormControl size="small" className={classes.formControl}>
|
||||||
<div style={{width: "300px", marginTop: "1em"}}>
|
<div style={{ width: "300px", marginTop: "1em" }}>
|
||||||
{params.dataFunc(data, handleDataChange)}
|
{params.dataFunc(data, handleDataChange)}
|
||||||
</div>
|
</div>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
Parameters.propTypes = {
|
Parameters.propTypes = {
|
||||||
params: PropTypes.any,
|
params: PropTypes.any,
|
||||||
data: PropTypes.any,
|
data: PropTypes.any,
|
||||||
handleDataChange: PropTypes.func,
|
handleDataChange: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,49 +1,52 @@
|
|||||||
import {render, waitFor} from "@testing-library/react";
|
import { render, waitFor } from "@testing-library/react";
|
||||||
import {Parameters} from "./Parameters";
|
import { Parameters } from "./Parameters";
|
||||||
import addSnapshotSerializer from "../../../utils/snapshot";
|
import addSnapshotSerializer from "../../../utils/snapshot";
|
||||||
|
|
||||||
const renderState = {
|
const renderState = {
|
||||||
EMPTY: 0,
|
EMPTY: 0,
|
||||||
JUST_DATA: 1,
|
JUST_DATA: 1,
|
||||||
}
|
};
|
||||||
|
|
||||||
const renderParameters = async (rs) => {
|
const renderParameters = async (rs) => {
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
/* render */
|
/* render */
|
||||||
});
|
});
|
||||||
|
|
||||||
if (rs===renderState.EMPTY) {
|
if (rs === renderState.EMPTY) {
|
||||||
const { container } = render(<Parameters/>)
|
const { container } = render(<Parameters />);
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
const params = {dataFunc:(val, handleValChange) => <div>val.toString()</div>}
|
const params = {
|
||||||
const [data, handleDataChange] = [true, (_)=>{}];
|
dataFunc: (val, handleValChange) => <div>val.toString()</div>,
|
||||||
|
};
|
||||||
|
const [data, handleDataChange] = [true, (_) => {}];
|
||||||
|
|
||||||
if (rs===renderState.JUST_DATA) {
|
if (rs === renderState.JUST_DATA) {
|
||||||
const { container } = render(<Parameters
|
const { container } = render(
|
||||||
params={params}
|
<Parameters
|
||||||
data={data}
|
params={params}
|
||||||
handleDataChange={handleDataChange}
|
data={data}
|
||||||
/>)
|
handleDataChange={handleDataChange}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
describe("Params", () => {
|
describe("Params", () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
addSnapshotSerializer(expect);
|
addSnapshotSerializer(expect);
|
||||||
})
|
});
|
||||||
|
|
||||||
it("Render empty", async () => {
|
it("Render empty", async () => {
|
||||||
const container = await renderParameters(renderState.EMPTY);
|
const container = await renderParameters(renderState.EMPTY);
|
||||||
expect(container).toMatchSnapshot();
|
expect(container).toMatchSnapshot();
|
||||||
})
|
});
|
||||||
|
|
||||||
it("Render just data", async () => {
|
it("Render just data", async () => {
|
||||||
const container = await renderParameters(renderState.JUST_DATA);
|
const container = await renderParameters(renderState.JUST_DATA);
|
||||||
expect(container).toMatchSnapshot();
|
expect(container).toMatchSnapshot();
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
TableFooter,
|
TableFooter,
|
||||||
TablePagination,
|
TablePagination,
|
||||||
TableRow,
|
TableRow,
|
||||||
Tooltip,
|
Tooltip
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import AddCircleIcon from "@material-ui/icons/AddCircle";
|
import AddCircleIcon from "@material-ui/icons/AddCircle";
|
||||||
import DeleteIcon from "@material-ui/icons/Delete";
|
import DeleteIcon from "@material-ui/icons/Delete";
|
||||||
@@ -18,7 +18,7 @@ import { logger } from "../../../../../services/monitoring";
|
|||||||
import { hasRole, Permissions } from "../../../../../utils/roles";
|
import { hasRole, Permissions } from "../../../../../utils/roles";
|
||||||
import {
|
import {
|
||||||
FleetProvider,
|
FleetProvider,
|
||||||
useFleetContext,
|
useFleetContext
|
||||||
} from "../../../../Contexts/FleetContext";
|
} from "../../../../Contexts/FleetContext";
|
||||||
import { useStatusContext } from "../../../../Contexts/StatusContext";
|
import { useStatusContext } from "../../../../Contexts/StatusContext";
|
||||||
import { useUserContext } from "../../../../Contexts/UserContext";
|
import { useUserContext } from "../../../../Contexts/UserContext";
|
||||||
|
|||||||
@@ -180,7 +180,11 @@ const MainForm = () => {
|
|||||||
<FormControlLabel value="trace" control={<Radio />} label="Trace" />
|
<FormControlLabel value="trace" control={<Radio />} label="Trace" />
|
||||||
<FormControlLabel value="debug" control={<Radio />} label="Debug" />
|
<FormControlLabel value="debug" control={<Radio />} label="Debug" />
|
||||||
<FormControlLabel value="info" control={<Radio />} label="Info" />
|
<FormControlLabel value="info" control={<Radio />} label="Info" />
|
||||||
<FormControlLabel value="warning" control={<Radio />} label="Warning" />
|
<FormControlLabel
|
||||||
|
value="warning"
|
||||||
|
control={<Radio />}
|
||||||
|
label="Warning"
|
||||||
|
/>
|
||||||
<FormControlLabel value="error" control={<Radio />} label="Error" />
|
<FormControlLabel value="error" control={<Radio />} label="Error" />
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
value="critical"
|
value="critical"
|
||||||
|
|||||||
@@ -228,4 +228,4 @@ const VehicleMap = () => (
|
|||||||
</VehicleProvider>
|
</VehicleProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default VehicleMap;
|
export default VehicleMap;
|
||||||
Reference in New Issue
Block a user