From e9c827c938fbd7912aee176d072bf2d02429195f Mon Sep 17 00:00:00 2001 From: Alex Lilly Date: Thu, 3 Nov 2022 17:46:06 -0400 Subject: [PATCH 1/5] add mocking-useLocation to how-to in docs --- docs/docs/how-to/mocking-useLocation.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/docs/how-to/mocking-useLocation.md diff --git a/docs/docs/how-to/mocking-useLocation.md b/docs/docs/how-to/mocking-useLocation.md new file mode 100644 index 000000000000..1cbab9d22bf4 --- /dev/null +++ b/docs/docs/how-to/mocking-useLocation.md @@ -0,0 +1,13 @@ +# Mocking useLocation + +To mock useLocation for your component tests, wrap the component with ``LocationProvider``. + +```jsx +import { LocationProvider } from '@redwoodjs/router' + +render( + + + +) +``` From dfba073b19220c8b86f962ea18b46017b93514c7 Mon Sep 17 00:00:00 2001 From: Alex Lilly Date: Thu, 3 Nov 2022 17:48:56 -0400 Subject: [PATCH 2/5] Update mocking-useLocation.md --- docs/docs/how-to/mocking-useLocation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/how-to/mocking-useLocation.md b/docs/docs/how-to/mocking-useLocation.md index 1cbab9d22bf4..a34bec25fa18 100644 --- a/docs/docs/how-to/mocking-useLocation.md +++ b/docs/docs/how-to/mocking-useLocation.md @@ -1,6 +1,6 @@ # Mocking useLocation -To mock useLocation for your component tests, wrap the component with ``LocationProvider``. +To mock ``useLocation`` for your component tests, wrap the component with ``LocationProvider``. ```jsx import { LocationProvider } from '@redwoodjs/router' From 0d08ec4aa97113f6b2c154d3d68f2d3375ea46f3 Mon Sep 17 00:00:00 2001 From: Alex Lilly Date: Fri, 4 Nov 2022 15:38:21 -0400 Subject: [PATCH 3/5] move mocking-useLocation to testing --- docs/docs/how-to/mocking-useLocation.md | 13 ------------- docs/docs/testing.md | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 docs/docs/how-to/mocking-useLocation.md diff --git a/docs/docs/how-to/mocking-useLocation.md b/docs/docs/how-to/mocking-useLocation.md deleted file mode 100644 index a34bec25fa18..000000000000 --- a/docs/docs/how-to/mocking-useLocation.md +++ /dev/null @@ -1,13 +0,0 @@ -# Mocking useLocation - -To mock ``useLocation`` for your component tests, wrap the component with ``LocationProvider``. - -```jsx -import { LocationProvider } from '@redwoodjs/router' - -render( - - - -) -``` diff --git a/docs/docs/testing.md b/docs/docs/testing.md index d6b6875a73ae..9ff2a78a3714 100644 --- a/docs/docs/testing.md +++ b/docs/docs/testing.md @@ -274,6 +274,19 @@ render(
, { }) ``` ::: +### Mocking useLocation + +To mock ``useLocation`` for your component tests, wrap the component with ``LocationProvider``. + +```jsx +import { LocationProvider } from '@redwoodjs/router' + +render( + + + +) +``` ## Testing Custom Hooks From 50b27f952ae2753d0f8b5591d1fbfb20bbda279a Mon Sep 17 00:00:00 2001 From: Alex Lilly Date: Fri, 4 Nov 2022 16:29:01 -0400 Subject: [PATCH 4/5] Update docs/docs/testing.md Co-authored-by: Dominic Saadi --- docs/docs/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/testing.md b/docs/docs/testing.md index 9ff2a78a3714..4a8351f0277b 100644 --- a/docs/docs/testing.md +++ b/docs/docs/testing.md @@ -276,7 +276,7 @@ render(
, { ::: ### Mocking useLocation -To mock ``useLocation`` for your component tests, wrap the component with ``LocationProvider``. +To mock `useLocation` in your component tests, wrap the component with `LocationProvider`: ```jsx import { LocationProvider } from '@redwoodjs/router' From 9d8fc1f184696848e1882894d8f3247f541b1368 Mon Sep 17 00:00:00 2001 From: Dominic Saadi Date: Fri, 4 Nov 2022 13:37:29 -0700 Subject: [PATCH 5/5] Update docs/docs/testing.md --- docs/docs/testing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/testing.md b/docs/docs/testing.md index 4a8351f0277b..63064466181d 100644 --- a/docs/docs/testing.md +++ b/docs/docs/testing.md @@ -282,9 +282,9 @@ To mock `useLocation` in your component tests, wrap the component with `Location import { LocationProvider } from '@redwoodjs/router' render( - - - + + + ) ```