Skip to content

Commit

Permalink
added data-testid for Popover and added optional chaining to context …
Browse files Browse the repository at this point in the history
…passed function
  • Loading branch information
KitoC committed Aug 6, 2024
1 parent 95aab77 commit 0f848ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/components/ActionsMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ export const ActionsMenuHeading = styled((props) => {
// // Only sets `aria-labelledby` on the Popover root element
// // if this component is mounted inside it.
useLayoutEffect(() => {
actionMenu.setLabelId(id);
actionMenu?.setLabelId?.(id);

return () => actionMenu.setLabelId(undefined);
return () => actionMenu?.setLabelId?.(undefined);
}, [id, actionMenu]);

return (
Expand Down
4 changes: 3 additions & 1 deletion lib/components/Popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ export default function Popover({
enableSelectAll,
variant,
ariaLabel,
"data-testid": dataTestId = "popover",

Check warning on line 273 in lib/components/Popover/index.js

View workflow job for this annotation

GitHub Actions / build

'data-testid' is missing in props validation
...props
}) {
const [visible, setVisible] = useState(false);
Expand Down Expand Up @@ -303,7 +304,8 @@ export default function Popover({

const triggerProps = {
...getReferenceProps({
ref: refs.setReference
ref: refs.setReference,
"data-testid": dataTestId
})
};

Expand Down

0 comments on commit 0f848ab

Please sign in to comment.