mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Mocking HotbarToggleMenuItem
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
62b45875c4
commit
07cda6d4ea
@ -46,6 +46,12 @@ jest.mock("@electron/remote", () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jest.mock("./hotbar-toggle-menu-item", () => {
|
||||||
|
return {
|
||||||
|
HotbarToggleMenuItem: () => <div>menu item</div>
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
describe("<Catalog />", () => {
|
describe("<Catalog />", () => {
|
||||||
const history = createMemoryHistory();
|
const history = createMemoryHistory();
|
||||||
const mockLocation = {
|
const mockLocation = {
|
||||||
|
|||||||
@ -27,9 +27,9 @@ import type { CatalogEntity } from "../../api/catalog-entity";
|
|||||||
|
|
||||||
export function HotbarToggleMenuItem(props: { entity: CatalogEntity, addContent: ReactNode, removeContent: ReactNode }) {
|
export function HotbarToggleMenuItem(props: { entity: CatalogEntity, addContent: ReactNode, removeContent: ReactNode }) {
|
||||||
const store = HotbarStore.getInstance(false);
|
const store = HotbarStore.getInstance(false);
|
||||||
const add = () => store?.addToHotbar(props.entity);
|
const add = () => store.addToHotbar(props.entity);
|
||||||
const remove = () => store?.removeFromHotbar(props.entity.getId());
|
const remove = () => store.removeFromHotbar(props.entity.getId());
|
||||||
const [itemInHotbar, setItemInHotbar] = useState(store?.isAddedToActive(props.entity));
|
const [itemInHotbar, setItemInHotbar] = useState(store.isAddedToActive(props.entity));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MenuItem onClick={() => {
|
<MenuItem onClick={() => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user