-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(CopyToClipboard): replaced class component by functional com…
…ponent (#1216)
- Loading branch information
1 parent
1f5a161
commit 61d14fa
Showing
4 changed files
with
50 additions
and
75 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
18 changes: 18 additions & 0 deletions
18
src/components/CopyToClipboard/__tests__/CopyToClipboard.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,18 @@ | ||
import React from 'react'; | ||
|
||
import {render} from '../../../../test-utils/utils'; | ||
import {CopyToClipboard} from '../CopyToClipboard'; | ||
import type {CopyToClipboardContent} from '../types'; | ||
|
||
describe('CopyToClipboard', () => { | ||
test('content must be a valid react element', () => { | ||
const onCopy = jest.fn(); | ||
expect(() => | ||
render( | ||
<CopyToClipboard text="Text to copy" onCopy={onCopy}> | ||
{(() => 123) as any as CopyToClipboardContent} | ||
</CopyToClipboard>, | ||
), | ||
).toThrow('Content must be a valid react element'); | ||
}); | ||
}); |
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