Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yauheni/74111/formbody ts migration #7

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ describe('<FormBody />', () => {
<div>Test children</div>
</FormBody>
);
expect(container.querySelector('account__scrollbars_container--grid-layout')).toBeInTheDocument;
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yauheni-kryzhyk-deriv please consider finding elements by data-testids, or disabling these eslint rules in config instead of explicitly disabling separate lines 🙂

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. will rewrite tests)

expect(container.querySelector('.account__scrollbars_container--grid-layout')).toBeInTheDocument();
expect(screen.getByText('Test children')).toBeInTheDocument();
});

it('should render FormBody component with children in mobile', () => {
isMobile.mockReturnValue(true);
isDesktop.mockReturnValue(false);
(isMobile as jest.Mock).mockReturnValue(true);
(isDesktop as jest.Mock).mockReturnValue(false);
const { container } = render(
<FormBody>
<div>Test children</div>
</FormBody>
);
// eslint-disable-next-line testing-library/no-node-access
expect(container.firstChild).toHaveClass('account__scrollbars_container--grid-layout');
expect(screen.getByText('Test children')).toBeInTheDocument();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { Div100vhContainer, DesktopWrapper, MobileWrapper } from '@deriv/components';
import React from 'react';
import { Div100vhContainer, DesktopWrapper, MobileWrapper } from '@deriv/components';
import { ScrollbarsContainer } from 'Components/scrollbars-container/scrollbars-container.jsx';

export const FormBody = ({ children, scroll_offset }) => (
type TFormBody = {
scroll_offset?: string;
};

export const FormBody = ({ children, scroll_offset }: React.PropsWithChildren<TFormBody>) => (
<React.Fragment>
<DesktopWrapper>
<ScrollbarsContainer className='account__scrollbars_container--grid-layout' scroll_offset={scroll_offset}>
Expand Down
3 changes: 0 additions & 3 deletions packages/account/src/Components/form-body/index.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/account/src/Components/form-body/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { FormBody } from './form-body';

export default FormBody;