Skip to content

Commit

Permalink
Merge pull request #45 from suisin-deriv/suisin/74185/ts_migration_se…
Browse files Browse the repository at this point in the history
…lf_exclusion_modal

Suisin/refactor: ts migration for self-exclusion-modal
  • Loading branch information
niloofar-deriv committed Jan 25, 2023
2 parents 1232228 + 3fad336 commit 114cd95
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ const modal_root = document.createElement('div');
modal_root.setAttribute('id', 'modal_root');
document.body.appendChild(modal_root);

jest.mock('../self-exclusion-article-content', () => () => <div>SelfExclusionArticleContent</div>);
jest.mock('../self-exclusion-article-content', () => {
const mockArticle = () => <div>SelfExclusionArticleContent</div>;
return mockArticle;
});

describe('<SelfExclusionModal />', () => {
it('should be shown on the page', () => {
render(
<SelfExclusionContext.Provider value={{ state: { show_article: true }, toggleArticle: () => {} }}>
<SelfExclusionContext.Provider
value={{ state: { show_article: true }, overlay_ref: document.createElement('div') }}
>
<SelfExclusionModal />
</SelfExclusionContext.Provider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const SelfExclusionModal = () => {
const { state, toggleArticle } = React.useContext(SelfExclusionContext);

return (
<Modal className='self_exclusion__article-modal' is_open={state.show_article} toggleModal={toggleArticle}>
<Modal className='self_exclusion__article-modal' is_open={state?.show_article} toggleModal={toggleArticle}>
<ThemedScrollbars>
<SelfExclusionArticleContent toggleModal={toggleArticle} />
<SelfExclusionArticleContent />
</ThemedScrollbars>
</Modal>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import DemoMessage from 'Components/demo-message';
import LoadErrorMessage from 'Components/load-error-message';
import SelfExclusionArticleContent from './self-exclusion-article-content';
import SelfExclusionContext from './self-exclusion-context';
import SelfExclusionModal from './self-exclusion-modal.jsx';
import SelfExclusionModal from './self-exclusion-modal';
import SelfExclusionWrapper from './self-exclusion-wrapper';
import SelfExclusionForm from './self-exclusion-form.jsx';

Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/components/label/label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const available_modes = [
const available_sizes = ['regular', 'large'] as const;

type TLabel = {
mode: (typeof available_modes)[number];
size: (typeof available_sizes)[number];
mode: typeof available_modes[number];
size: typeof available_sizes[number];
className?: string;
};

Expand Down

0 comments on commit 114cd95

Please sign in to comment.