diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..0f148de5ef --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "esbenp.prettier-vscode" + ] +} \ No newline at end of file diff --git a/CommonUI/src/Components/HiddenText/HiddenText.tsx b/CommonUI/src/Components/HiddenText/HiddenText.tsx index 4413da0dfa..d44bb443dd 100644 --- a/CommonUI/src/Components/HiddenText/HiddenText.tsx +++ b/CommonUI/src/Components/HiddenText/HiddenText.tsx @@ -14,7 +14,7 @@ const HiddenText: FunctionComponent = ( const [copiedToClipboard, setCopyToClipboard] = useState(false); if (!showText) { return ( -

{ @@ -26,11 +26,11 @@ const HiddenText: FunctionComponent = ( ); } return ( -

+
-
{props.text} @@ -50,9 +50,9 @@ const HiddenText: FunctionComponent = ( data-testid={props.dataTestId} className="pointer underline" onClick={async () => { - await navigator.clipboard.writeText(props.text); + await navigator.clipboard.writeText(props.text); setCopyToClipboard(true); - }} + }} > {' '} {copiedToClipboard diff --git a/CommonUI/src/Components/Icon/Icon.tsx b/CommonUI/src/Components/Icon/Icon.tsx index a80b0a8758..cdfef096ed 100644 --- a/CommonUI/src/Components/Icon/Icon.tsx +++ b/CommonUI/src/Components/Icon/Icon.tsx @@ -139,15 +139,13 @@ export interface ComponentProps { thick?: ThickProp; onClick?: (() => void) | undefined; style?: CSSProperties | undefined; - } - const Icon: FunctionComponent = ({ size = SizeProp.Regular, icon, className, color, - thick =ThickProp.Normal, + thick = ThickProp.Normal, onClick, style, }: ComponentProps): ReactElement => { diff --git a/CommonUI/src/Tests/HiddenText.test.tsx b/CommonUI/src/Tests/HiddenText.test.tsx index e85cebf677..dde750b08a 100644 --- a/CommonUI/src/Tests/HiddenText.test.tsx +++ b/CommonUI/src/Tests/HiddenText.test.tsx @@ -7,75 +7,67 @@ describe('tests for HiddenText component', () => { it('it should click paragraph and show text in document', async () => { act(() => { render(); - }); -const paragraph: HTMLElement = screen.getByRole('paragraph'); + }); + const paragraph: HTMLElement = screen.getByRole('paragraph'); await act(async () => { - fireEvent.click(paragraph); - }); + fireEvent.click(paragraph); + }); expect(screen.getByText('text')).toBeInTheDocument(); - }); + }); it('it should call function after clicking paragraph', async () => { -const setShowText: () => true = jest.fn(); + const setShowText: () => true = jest.fn(); act(() => { render(); - }); - const paragraph:HTMLElement = screen.getByRole('paragraph'); + }); + const paragraph: HTMLElement = screen.getByRole('paragraph'); await act(async () => { - fireEvent.click(paragraph); - }); + fireEvent.click(paragraph); + }); expect(setShowText).toBeCalled; - }); -it('it should click paragraph and copy to clipboard', async () => { - act(() => { + }); + it('it should click paragraph and copy to clipboard', async () => { + act(() => { render( - - ); - }); - const paragraph :HTMLElement = screen.getByRole('paragraph'); + + ); + }); + const paragraph: HTMLElement = screen.getByRole('paragraph'); await act(async () => { fireEvent.click(paragraph); }); expect(screen.getByTestId('test-id')).toHaveTextContent( 'Copy to Clipboard' - ) - }); - it('it should call function after clicking paragraph', async () => { - const setCopyToClipboard: (() => false) = jest.fn(); + ); + }); + it('it should call function after clicking paragraph', async () => { + const setCopyToClipboard: () => false = jest.fn(); act(() => { - render(); - }); - const paragraph : HTMLElement = screen.getByRole('paragraph'); + render(); + }); + const paragraph: HTMLElement = screen.getByRole('paragraph'); await act(async () => { - fireEvent.click(paragraph); + fireEvent.click(paragraph); }); expect(setCopyToClipboard).toBeCalled; - }); + }); test('it should show icon in the document', () => { - render( - - ); + render(); expect(Icon).toBeInTheDocument; }); test('it should show paragraph in the document and its content ', () => { - render( - - ); + render(); const testId: HTMLElement = screen.getByRole('paragraph'); expect(testId).toBeInTheDocument; expect(testId).toHaveTextContent('Click here to reveal'); }); - - test('it should have a paragraph and its role attribute', () => { - render(); - const testId = screen.getByRole('paragraph'); - expect(testId).toHaveAttribute('role','paragraph'); - }); - -}); - - + test('it should have a paragraph and its role attribute', () => { + render(); + const testId = screen.getByRole('paragraph'); + expect(testId).toHaveAttribute('role', 'paragraph'); + }); +});