Skip to content

Commit

Permalink
polish test case
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Jun 5, 2021
1 parent 0428852 commit c810afd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/material-ui/src/Popover/Popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const Popover = React.forwardRef(function Popover(inProps, ref) {
...other
} = props;
const paperRef = React.useRef();
const handleRef = useForkRef(paperRef, PaperProps.ref);
const handlePaperRef = useForkRef(paperRef, PaperProps.ref);

const styleProps = {
...props,
Expand Down Expand Up @@ -372,7 +372,7 @@ const Popover = React.forwardRef(function Popover(inProps, ref) {
<PopoverPaper
elevation={elevation}
{...PaperProps}
ref={handleRef}
ref={handlePaperRef}
className={clsx(classes.paper, PaperProps.className)}
>
{children}
Expand Down
7 changes: 2 additions & 5 deletions packages/material-ui/src/Popover/Popover.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,20 +257,17 @@ describe('<Popover />', () => {
describe('PaperProps.ref', () => {
it('should position popover correctly', () => {
const handleEntering = spy();
mount(
render(
<Popover
{...defaultProps}
open
PaperProps={{ 'data-testid': 'Popover', ref: () => null }}
anchorOrigin={{ vertical: 'top', horizontal: 'left' }}
TransitionProps={{ onEntering: handleEntering }}
>
<div />
</Popover>,
);

const element = handleEntering.args[0][0];
expect(element.style.top === '16px' && element.style.left === '16px').to.equal(true);
expect(handleEntering.args[0][0]).toHaveInlineStyle({ top: '16px', left: '16px' });
});
});

Expand Down

0 comments on commit c810afd

Please sign in to comment.