From 63eba01e5ada9a1e79214c4e99ef8a5c0c18380e Mon Sep 17 00:00:00 2001 From: Ben Monro Date: Mon, 25 May 2020 22:57:07 -0700 Subject: [PATCH 1/5] docs: added showSuggestions --- docs/dom-testing-library/api-configuration.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/dom-testing-library/api-configuration.md b/docs/dom-testing-library/api-configuration.md index 2abd43ead..10383942d 100644 --- a/docs/dom-testing-library/api-configuration.md +++ b/docs/dom-testing-library/api-configuration.md @@ -24,7 +24,8 @@ for you to identify the part of your code that resulted in the error (async stack traces are hard to debug). If you want to disable this, then set `showOriginalStackTrace` to `false`. You can also disable this for a specific call in the options you pass to `waitFor`. - +`showSuggestions`: When enabled, if [better queries](https://testing-library.com/docs/guide-which-query) are available +the test will fail and provide a suggested query to use instead. Default is 'false' `testIdAttribute`: The attribute used by [`getByTestId`](api-queries#bytestid) and related queries. Defaults to `data-testid`. From 81185472608f91ff086c456e3529759fb3ebffe4 Mon Sep 17 00:00:00 2001 From: Ben Monro Date: Mon, 25 May 2020 23:09:54 -0700 Subject: [PATCH 2/5] Update api-configuration.md --- docs/dom-testing-library/api-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dom-testing-library/api-configuration.md b/docs/dom-testing-library/api-configuration.md index 10383942d..5296029fb 100644 --- a/docs/dom-testing-library/api-configuration.md +++ b/docs/dom-testing-library/api-configuration.md @@ -24,7 +24,7 @@ for you to identify the part of your code that resulted in the error (async stack traces are hard to debug). If you want to disable this, then set `showOriginalStackTrace` to `false`. You can also disable this for a specific call in the options you pass to `waitFor`. -`showSuggestions`: When enabled, if [better queries](https://testing-library.com/docs/guide-which-query) are available +`showSuggestions`: (experimental) When enabled, if [better queries](https://testing-library.com/docs/guide-which-query) are available the test will fail and provide a suggested query to use instead. Default is 'false' `testIdAttribute`: The attribute used by [`getByTestId`](api-queries#bytestid) and related queries. Defaults to `data-testid`. From 94919ce5940bd88cfc8572bbc2e68b07b9806f93 Mon Sep 17 00:00:00 2001 From: Ben Monro Date: Fri, 29 May 2020 08:50:48 -0700 Subject: [PATCH 3/5] Update api-configuration.md --- docs/dom-testing-library/api-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dom-testing-library/api-configuration.md b/docs/dom-testing-library/api-configuration.md index 5296029fb..4b33f6514 100644 --- a/docs/dom-testing-library/api-configuration.md +++ b/docs/dom-testing-library/api-configuration.md @@ -24,7 +24,7 @@ for you to identify the part of your code that resulted in the error (async stack traces are hard to debug). If you want to disable this, then set `showOriginalStackTrace` to `false`. You can also disable this for a specific call in the options you pass to `waitFor`. -`showSuggestions`: (experimental) When enabled, if [better queries](https://testing-library.com/docs/guide-which-query) are available +`throwSuggestions`: (experimental) When enabled, if [better queries](https://testing-library.com/docs/guide-which-query) are available the test will fail and provide a suggested query to use instead. Default is 'false' `testIdAttribute`: The attribute used by [`getByTestId`](api-queries#bytestid) and related queries. Defaults to `data-testid`. From 780fc9e51254ca821e300c963eb4268b5fdddf1f Mon Sep 17 00:00:00 2001 From: Ben Monro Date: Fri, 29 May 2020 08:55:04 -0700 Subject: [PATCH 4/5] Update api-configuration.md --- docs/dom-testing-library/api-configuration.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/dom-testing-library/api-configuration.md b/docs/dom-testing-library/api-configuration.md index 4b33f6514..e95ed22f4 100644 --- a/docs/dom-testing-library/api-configuration.md +++ b/docs/dom-testing-library/api-configuration.md @@ -26,6 +26,12 @@ stack traces are hard to debug). If you want to disable this, then set call in the options you pass to `waitFor`. `throwSuggestions`: (experimental) When enabled, if [better queries](https://testing-library.com/docs/guide-which-query) are available the test will fail and provide a suggested query to use instead. Default is 'false' + +To disable a suggestion for a single query just add `{suggest:false}` as an option. +```js +screen.getByTestId("foo", {suggest:false}); // will not throw a suggestion +``` + `testIdAttribute`: The attribute used by [`getByTestId`](api-queries#bytestid) and related queries. Defaults to `data-testid`. From 983cc50f5981a35a7512214628dbb1953798af60 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Fri, 29 May 2020 12:47:25 -0600 Subject: [PATCH 5/5] Update docs/dom-testing-library/api-configuration.md Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> --- docs/dom-testing-library/api-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dom-testing-library/api-configuration.md b/docs/dom-testing-library/api-configuration.md index e95ed22f4..2c82abd33 100644 --- a/docs/dom-testing-library/api-configuration.md +++ b/docs/dom-testing-library/api-configuration.md @@ -25,7 +25,7 @@ stack traces are hard to debug). If you want to disable this, then set `showOriginalStackTrace` to `false`. You can also disable this for a specific call in the options you pass to `waitFor`. `throwSuggestions`: (experimental) When enabled, if [better queries](https://testing-library.com/docs/guide-which-query) are available -the test will fail and provide a suggested query to use instead. Default is 'false' +the test will fail and provide a suggested query to use instead. Default to `false`. To disable a suggestion for a single query just add `{suggest:false}` as an option. ```js