Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4bd341f

Browse files
committed
fix: beef up test
1 parentb0a9df9 commit4bd341f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎site/src/hooks/useClipboard.test.tsx‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,22 @@ describe.each(secureContextValues)("useClipboard - secure: %j", (isSecure) => {
287287
setSimulateFailure(true);
288288
awaitact(()=>result.current.copyToClipboard("dummy-text-2"));
289289
expect(result.current.copyToClipboard).toBe(initialCopy);
290+
291+
/**
292+
* Trigger a successful clipboard interaction
293+
*
294+
*@todo For some reason, using the assertClipboardUpdateLifecycle
295+
* helper triggers Jest errors with it thinking that values are being
296+
* accessed after teardown, even though the problem doesn't exist for
297+
* any other test case.
298+
*
299+
* It's not a huge deal, because we only need to inspect React after the
300+
* interaction, instead of the full DOM, but for correctness, it would
301+
* be nice if we could get this issue figured out.
302+
*/
303+
setSimulateFailure(false);
304+
awaitact(()=>result.current.copyToClipboard("dummy-text-2"));
305+
expect(result.current.copyToClipboard).toBe(initialCopy);
290306
});
291307

292308
it("Always uses the most up-to-date onError prop",async()=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp