-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip hook * fix types * initial test * wip * Full test suite completed * server test added and fix prettier * hook implementation * matchMedia's mock improvement * fix test * Fix matchMediaMock usage * Docs * server.spec * server test fix * hook implementation * usePrefersColorScheme hook implementation * wip hook * fix types * initial test * wip * Full test suite completed * server test added and fix prettier * docs added * fix review Co-authored-by: Gabriel Henriques <[email protected]> Co-authored-by: Guilherme Gazzo <[email protected]> Co-authored-by: Tasso Evangelista <[email protected]>
- Loading branch information
1 parent
f54a69d
commit 35ab50a
Showing
9 changed files
with
342 additions
and
120 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
13 changes: 13 additions & 0 deletions
13
packages/fuselage-hooks/docs/fuselage-hooks.useclipboard.md
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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@rocket.chat/fuselage-hooks](./fuselage-hooks.md) > [useClipboard](./fuselage-hooks.useclipboard.md) | ||
|
||
## useClipboard variable | ||
|
||
Hook to copy the passed content to the clipboard. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
useClipboard: (text: string, { clearTime, onCopySuccess, onCopyError, }?: UseClipboardParams) => UseClipboardReturn | ||
``` |
14 changes: 14 additions & 0 deletions
14
packages/fuselage-hooks/docs/fuselage-hooks.useclipboardreturn.md
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,14 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@rocket.chat/fuselage-hooks](./fuselage-hooks.md) > [UseClipboardReturn](./fuselage-hooks.useclipboardreturn.md) | ||
|
||
## UseClipboardReturn type | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type UseClipboardReturn = { | ||
copy: (e?: Event) => Promise<void>; | ||
hasCopied: boolean; | ||
}; | ||
``` |
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
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,24 @@ | ||
/** | ||
* @jest-environment node | ||
*/ | ||
|
||
import { FunctionComponent, createElement, StrictMode } from 'react'; | ||
import { renderToString } from 'react-dom/server'; | ||
|
||
import { useClipboard, UseClipboardReturn } from './useClipboard'; | ||
|
||
describe('useClipboard hook on server', () => { | ||
it('has hasCopied and copy properties', () => { | ||
let hookObject: UseClipboardReturn; | ||
|
||
const TestComponent: FunctionComponent = () => { | ||
hookObject = useClipboard('Lorem Ipsum Indolor Dolor'); | ||
return null; | ||
}; | ||
|
||
renderToString(createElement(StrictMode, {}, createElement(TestComponent))); | ||
|
||
expect(hookObject).toHaveProperty('copy'); | ||
expect(hookObject).toHaveProperty('hasCopied'); | ||
}); | ||
}); |
Oops, something went wrong.