From 11dee7a7b0242cf57cdce13ad48f14c5060275ed Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Mon, 17 Sep 2018 17:46:54 -0700 Subject: [PATCH 1/2] New: expose option to override bound queries --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 6c63f002..860848f5 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,10 @@ import ReactDOM from 'react-dom' import {Simulate} from 'react-dom/test-utils' -import {getQueriesForElement, prettyDOM} from 'dom-testing-library' +import {getQueriesForElement, prettyDOM, queries as domQueries} from 'dom-testing-library' const mountedContainers = new Set() -function render(ui, {container, baseElement = container} = {}) { +function render(ui, {container, baseElement = container, queries = domQueries} = {}) { if (!container) { // default to document.body instead of documentElement to avoid output of potentially-large // head elements (such as JSS style blocks) in debug output @@ -29,7 +29,7 @@ function render(ui, {container, baseElement = container} = {}) { // Intentionally do not return anything to avoid unnecessarily complicating the API. // folks can use all the same utilities we return in the first place that are bound to the container }, - ...getQueriesForElement(baseElement), + ...getQueriesForElement(baseElement, queries), } } From dc283216d2b51ddbde070365612a7557b72e4cf4 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Tue, 18 Sep 2018 10:22:25 -0600 Subject: [PATCH 2/2] remove unecessary default dom-testing-library will default the queries for us: https://github.com/kentcdodds/dom-testing-library/blob/cbbda90762f9b5c97471841b0d00f05ddfe772ba/src/get-queries-for-element.js#L12 --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 860848f5..d8258a23 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,10 @@ import ReactDOM from 'react-dom' import {Simulate} from 'react-dom/test-utils' -import {getQueriesForElement, prettyDOM, queries as domQueries} from 'dom-testing-library' +import {getQueriesForElement, prettyDOM} from 'dom-testing-library' const mountedContainers = new Set() -function render(ui, {container, baseElement = container, queries = domQueries} = {}) { +function render(ui, {container, baseElement = container, queries} = {}) { if (!container) { // default to document.body instead of documentElement to avoid output of potentially-large // head elements (such as JSS style blocks) in debug output