Skip to content

Commit

Permalink
fix(CLI-drawer): Add preventdefault to adjust scroll issue
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinandan13jan authored and root committed May 27, 2020
1 parent 6004e58 commit 6ed9257
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const Drawer: React.FC<DrawerProps> = ({
};

const handleResizeStart = (e: DraggableEvent) => {
e.preventDefault();
lastObservedHeightRef.current = currentHeight;
// always start with actual drawer height
const drawerHeight = drawerRef.current?.offsetHeight || currentHeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ describe('DrawerComponent', () => {
});

it('should handle resizing', () => {
const e = { preventDefault: jest.fn() };
const data = {} as DraggableData;
const onChange = jest.fn();
const wrapper = shallow(<Drawer resizable defaultHeight={100} onChange={onChange} />);
wrapper
.find(DraggableCoreIFrameFix)
.props()
.onStart({ pageY: 500 } as any, data);
.onStart({ pageY: 500, ...e } as any, data);
expect(wrapper.find('.ocs-drawer').prop('style').height).toBe(100);
wrapper
.find(DraggableCoreIFrameFix)
Expand Down

0 comments on commit 6ed9257

Please sign in to comment.