Skip to content

Commit

Permalink
fix: fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
orrgottlieb committed Apr 29, 2021
1 parent dfb6631 commit 00a8b6f
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 9 deletions.
12 changes: 9 additions & 3 deletions src/components/Menu/MenuItem/MenuItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import useMenuItemMouseEvents from "./hooks/useMenuItemMouseEvents";
import useMenuItemKeyboardEvents from "./hooks/useMenuItemKeyboardEvents";

import "./MenuItem.scss";
import { DialogPositions } from "../../../constants/sizes";

const MenuItem = ({
classname,
Expand Down Expand Up @@ -227,7 +228,7 @@ const MenuItem = ({
};

MenuItem.iconType = Icon.type;

MenuItem.tooltipPositions = DialogPositions;
MenuItem.defaultProps = {
classname: "",
title: "",
Expand All @@ -246,7 +247,7 @@ MenuItem.defaultProps = {
setSubMenuIsOpenByIndex: undefined,
resetOpenSubMenuIndex: undefined,
useDocumentEventListeners: false,
tooltipPosition: "right",
tooltipPosition: MenuItem.tooltipPositions.RIGHT,
tooltipShowDelay: 300
};

Expand All @@ -268,7 +269,12 @@ MenuItem.propTypes = {
hasOpenSubMenu: PropTypes.bool,
setSubMenuIsOpenByIndex: PropTypes.func,
useDocumentEventListeners: PropTypes.bool,
tooltipPosition: PropTypes.oneOf("right", "left", "top", "bottom"),
tooltipPosition: PropTypes.oneOf([
MenuItem.tooltipPositions.RIGHT,
MenuItem.tooltipPositions.LEFT,
MenuItem.tooltipPositions.TOP,
MenuItem.tooltipPositions.BOTTOM
]),
tooltipShowDelay: PropTypes.number
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Snapshots renders correctly when disabled 1`] = `
<li
aria-current={false}
className="monday-style-menu-item-button"
id="undefined-undefined"
role="menuitem"
>
<button
aria-busy={false}
aria-expanded={false}
aria-haspopup={false}
className="monday-style-button monday-style-button--size-small monday-style-button--kind-primary monday-style-button--color-primary"
disabled={true}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
onMouseUp={[Function]}
type="button"
>
<div
className="menu-item-button-content"
>
my item
</div>
</button>
</li>
`;

exports[`Snapshots renders correctly when selected 1`] = `
<li
aria-current={false}
className="monday-style-menu-item-button"
id="undefined-undefined"
role="menuitem"
>
<button
aria-busy={false}
aria-expanded={false}
aria-haspopup={false}
className="monday-style-button monday-style-button--size-small monday-style-button--kind-primary monday-style-button--color-primary"
disabled={false}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
onMouseUp={[Function]}
type="button"
>
<div
className="menu-item-button-content"
>
my item
</div>
</button>
</li>
`;

exports[`Snapshots renders correctly with custom class name 1`] = `
<li
aria-current={false}
className="monday-style-menu-item-button dummy-class-name"
id="undefined-undefined"
role="menuitem"
>
<button
aria-busy={false}
aria-expanded={false}
aria-haspopup={false}
className="monday-style-button monday-style-button--size-small monday-style-button--kind-primary monday-style-button--color-primary"
disabled={false}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
onMouseUp={[Function]}
type="button"
>
<div
className="menu-item-button-content"
/>
</button>
</li>
`;

exports[`Snapshots renders correctly with empty props 1`] = `
<li
aria-current={false}
className="monday-style-menu-item-button"
id="undefined-undefined"
role="menuitem"
>
<button
aria-busy={false}
aria-expanded={false}
aria-haspopup={false}
className="monday-style-button monday-style-button--size-small monday-style-button--kind-primary monday-style-button--color-primary"
disabled={false}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
onMouseUp={[Function]}
type="button"
>
<div
className="menu-item-button-content"
/>
</button>
</li>
`;

exports[`Snapshots renders correctly with title and icon 1`] = `
<li
aria-current={false}
className="monday-style-menu-item-button"
id="undefined-undefined"
role="menuitem"
>
<button
aria-busy={false}
aria-expanded={false}
aria-haspopup={false}
className="monday-style-button monday-style-button--size-small monday-style-button--kind-primary monday-style-button--color-primary"
disabled={false}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
onMouseUp={[Function]}
type="button"
>
<div
className="menu-item-button-content"
>
my item
</div>
</button>
</li>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`Snapshots renders correctly with disabled 1`] = `
>
<button
aria-busy={false}
aria-expended={false}
aria-expanded={false}
aria-haspopup={false}
className="monday-style-split-button__main-button monday-style-button monday-style-button--size-medium monday-style-button--kind-primary monday-style-button--color-primary monday-style-button--right-flat monday-style-button--prevent-click-animation"
disabled={true}
Expand All @@ -33,7 +33,7 @@ exports[`Snapshots renders correctly with disabled 1`] = `
>
<button
aria-busy={false}
aria-expended={false}
aria-expanded={false}
aria-haspopup={true}
aria-label="additional actions"
className="monday-style-split-button__secondary-button monday-style-button monday-style-button--size-medium monday-style-button--kind-primary monday-style-button--color-primary monday-style-button--left-flat monday-style-button--prevent-click-animation monday-style-button--no-side-padding"
Expand Down Expand Up @@ -76,7 +76,7 @@ exports[`Snapshots renders correctly with only required props 1`] = `
>
<button
aria-busy={false}
aria-expended={false}
aria-expanded={false}
aria-haspopup={false}
className="monday-style-split-button__main-button monday-style-button monday-style-button--size-medium monday-style-button--kind-primary monday-style-button--color-primary monday-style-button--right-flat monday-style-button--prevent-click-animation"
disabled={false}
Expand All @@ -102,7 +102,7 @@ exports[`Snapshots renders correctly with only required props 1`] = `
>
<button
aria-busy={false}
aria-expended={false}
aria-expanded={false}
aria-haspopup={true}
aria-label="additional actions"
className="monday-style-split-button__secondary-button monday-style-button monday-style-button--size-medium monday-style-button--kind-primary monday-style-button--color-primary monday-style-button--left-flat monday-style-button--prevent-click-animation monday-style-button--no-side-padding"
Expand Down Expand Up @@ -145,7 +145,7 @@ exports[`Snapshots renders correctly with tertiary button 1`] = `
>
<button
aria-busy={false}
aria-expended={false}
aria-expanded={false}
aria-haspopup={false}
className="monday-style-split-button__main-button monday-style-button monday-style-button--size-medium monday-style-button--kind-tertiary monday-style-button--color-primary monday-style-button--right-flat monday-style-button--prevent-click-animation"
disabled={true}
Expand All @@ -171,7 +171,7 @@ exports[`Snapshots renders correctly with tertiary button 1`] = `
>
<button
aria-busy={false}
aria-expended={false}
aria-expanded={false}
aria-haspopup={true}
aria-label="additional actions"
className="monday-style-split-button__secondary-button monday-style-button monday-style-button--size-medium monday-style-button--kind-tertiary monday-style-button--color-primary monday-style-button--left-flat monday-style-button--prevent-click-animation monday-style-button--no-side-padding"
Expand Down
15 changes: 15 additions & 0 deletions src/constants/sizes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,18 @@ export const SIZES = Object.freeze({
MEDIUM: "medium",
SMALL: "small"
});

export const DialogPositions = Object.freeze({
LEFT: "left",
LEFT_START: "left-start",
LEFT_END: "left-end",
RIGHT: "right",
RIGHT_START: "right-start",
RIGHT_END: "right-end",
TOP: "top",
TOP_START: "top-start",
TOP_END: "top-end",
BOTTOM: "bottom",
BOTTOM_START: "bottom-start",
BOTTOM_END: "bottom-end"
});

0 comments on commit 00a8b6f

Please sign in to comment.