This repository has been archived by the owner on Jan 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into mayank/monorepo
- Loading branch information
Showing
8 changed files
with
315 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/iTwinUI-react/src/core/Modal/ModalContent.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import { render, screen } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { ModalContent } from './ModalContent'; | ||
|
||
it('should render in its most basic state', () => { | ||
const { container } = render( | ||
<ModalContent> | ||
<div>Lorem ipsum dolor sit amet.</div> | ||
</ModalContent>, | ||
); | ||
expect(container.querySelector('.iui-modal-content')).toBeTruthy(); | ||
screen.getByText('Lorem ipsum dolor sit amet.'); | ||
}); | ||
|
||
it('should propagate miscellaneous props', () => { | ||
const { container } = render( | ||
<ModalContent | ||
className='test-class' | ||
id='test-id' | ||
style={{ fontSize: 'x-large' }} | ||
> | ||
<div>Lorem ipsum dolor sit amet.</div> | ||
</ModalContent>, | ||
); | ||
|
||
const content = container.querySelector('.iui-modal-content') as HTMLElement; | ||
expect(content).toHaveClass('test-class'); | ||
expect(content).toHaveStyle('fontSize: x-large'); | ||
expect(content.id).toEqual('test-id'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import React from 'react'; | ||
import cx from 'classnames'; | ||
import { CommonProps, useTheme } from '../utils'; | ||
import '@itwin/itwinui-css/css/modal.css'; | ||
|
||
export type ModalContentProps = { | ||
/** | ||
* Main content in the `Modal`. | ||
*/ | ||
children: React.ReactNode; | ||
} & Omit<CommonProps, 'title'>; | ||
|
||
/** | ||
* Container for content in `Modal`. | ||
*/ | ||
export const ModalContent = (props: ModalContentProps) => { | ||
const { children, className, ...rest } = props; | ||
|
||
useTheme(); | ||
return ( | ||
<div className={cx('iui-modal-content', className)} {...rest}> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default ModalContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.