From 039da4eecddb38de1f3cd46d6a8baee00fe7e5c1 Mon Sep 17 00:00:00 2001 From: Marcos Gomez Castillo Date: Tue, 11 May 2021 14:49:19 +0200 Subject: [PATCH 1/3] docs: improve JSDocs for RenderOptions --- types/index.d.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index 6d0c67ee..8c89d052 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -34,10 +34,38 @@ export interface RenderOptions< Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement > { + /** By default, React Testing Library will create a div and append that div to the document.body and this is + * where your React component will be rendered. If you provide your own HTMLElement container via this option, + * it will not be appended to the document.body automatically. + * + * For example: If you are unit testing a tablebody element, it cannot be a child of a div. In this case, you can + * specify a table as the render container. + * + * @link https://testing-library.com/docs/react-testing-library/api/#container + */ container?: Container + /** If the container is specified, then this defaults to that, otherwise this defaults to document.body. This is used as + * the base element for the queries as well as what is printed when you use debug(). + * + * @link https://testing-library.com/docs/react-testing-library/api/#baseelement + */ baseElement?: Element + /** If hydrate is set to true, then it will render with ReactDOM.hydrate. This may be useful if you are using server-side + * rendering and use ReactDOM.hydrate to mount your components. + * + * @link https://testing-library.com/docs/react-testing-library/api/#hydrate) + */ hydrate?: boolean + /** Queries to bind. Overrides the default set from DOM Testing Library unless merged. + * + * @link https://testing-library.com/docs/react-testing-library/api/#queries + */ queries?: Q + /** Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating + * reusable custom render functions for common data providers. See setup for examples. + * + * @link https://testing-library.com/docs/react-testing-library/api/#wrapper + */ wrapper?: React.ComponentType } From 94b04f26057d65c357b464fcf59f8f3f59e83511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20G=C3=B3mez?= <44379989+ImADrafter@users.noreply.github.com> Date: Sat, 22 May 2021 12:21:16 +0200 Subject: [PATCH 2/3] Update types/index.d.ts Co-authored-by: Sebastian Silbermann --- types/index.d.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 8c89d052..68acf3e2 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -34,23 +34,22 @@ export interface RenderOptions< Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement > { - /** By default, React Testing Library will create a div and append that div to the document.body and this is - * where your React component will be rendered. If you provide your own HTMLElement container via this option, + /** By default, React Testing Library will create a div and append that div to the document.body. Your React component will be rendered in the created div. If you provide your own HTMLElement container via this option, * it will not be appended to the document.body automatically. * - * For example: If you are unit testing a tablebody element, it cannot be a child of a div. In this case, you can + * For example: If you are unit testing a `` element, it cannot be a child of a div. In this case, you can * specify a table as the render container. * * @link https://testing-library.com/docs/react-testing-library/api/#container */ container?: Container - /** If the container is specified, then this defaults to that, otherwise this defaults to document.body. This is used as - * the base element for the queries as well as what is printed when you use debug(). + /** Defaults to the container if the container is specified. Otherwise `document.body` is used for the default. This is used as + * the base element for the queries as well as what is printed when you use `debug()`. * * @link https://testing-library.com/docs/react-testing-library/api/#baseelement */ baseElement?: Element - /** If hydrate is set to true, then it will render with ReactDOM.hydrate. This may be useful if you are using server-side + /** If `hydrate` is set to `true`, then it will render with `ReactDOM.hydrate`. This may be useful if you are using server-side * rendering and use ReactDOM.hydrate to mount your components. * * @link https://testing-library.com/docs/react-testing-library/api/#hydrate) From fd7dbd8165089b44ab332d01719633d8c02d8dd8 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Sat, 11 Sep 2021 11:22:17 +0200 Subject: [PATCH 3/3] @link -> @see --- types/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 68acf3e2..97948702 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -40,30 +40,30 @@ export interface RenderOptions< * For example: If you are unit testing a `` element, it cannot be a child of a div. In this case, you can * specify a table as the render container. * - * @link https://testing-library.com/docs/react-testing-library/api/#container + * @see https://testing-library.com/docs/react-testing-library/api/#container */ container?: Container /** Defaults to the container if the container is specified. Otherwise `document.body` is used for the default. This is used as * the base element for the queries as well as what is printed when you use `debug()`. * - * @link https://testing-library.com/docs/react-testing-library/api/#baseelement + * @see https://testing-library.com/docs/react-testing-library/api/#baseelement */ baseElement?: Element /** If `hydrate` is set to `true`, then it will render with `ReactDOM.hydrate`. This may be useful if you are using server-side * rendering and use ReactDOM.hydrate to mount your components. * - * @link https://testing-library.com/docs/react-testing-library/api/#hydrate) + * @see https://testing-library.com/docs/react-testing-library/api/#hydrate) */ hydrate?: boolean /** Queries to bind. Overrides the default set from DOM Testing Library unless merged. * - * @link https://testing-library.com/docs/react-testing-library/api/#queries + * @see https://testing-library.com/docs/react-testing-library/api/#queries */ queries?: Q /** Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating * reusable custom render functions for common data providers. See setup for examples. * - * @link https://testing-library.com/docs/react-testing-library/api/#wrapper + * @see https://testing-library.com/docs/react-testing-library/api/#wrapper */ wrapper?: React.ComponentType }