You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`It looks like you passed a Promise object instead of a DOM node. Did you do something like \`fireEvent.click(screen.findBy...\` when you meant to use a \`getBy\` query \`fireEvent.click(screen.getBy...\`, or await the findBy query \`fireEvent.click(await screen.findBy...\`?`,
103
123
)
@@ -106,8 +126,8 @@ function getWindowFromNode(node) {
106
126
`It looks like you passed an Array instead of a DOM node. Did you do something like \`fireEvent.click(screen.getAllBy...\` when you meant to use a \`getBy\` query \`fireEvent.click(screen.getBy...\`?`,
`It looks like you passed a \`screen\` object. Did you do something like \`fireEvent.click(screen, ...\` when you meant to use a query, e.g. \`fireEvent.click(screen.getBy..., \`?`,
@@ -120,11 +140,16 @@ function getWindowFromNode(node) {
// As the name implies, waitForElementToBeRemoved should check `present` --> `removed`
7
-
functioninitialCheck(elements){
11
+
functioninitialCheck(elements: Result): void{
8
12
if(isRemoved(elements)){
9
13
thrownewError(
10
14
'The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.',
Copy file name to clipboardExpand all lines: src/wait-for-element.ts
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,22 @@
1
+
import{waitForOptions}from'../types'
1
2
import{waitFor}from'./wait-for'
2
3
3
4
lethasWarned=false
4
5
5
6
// deprecated... TODO: remove this method. People should use a find* query or
6
7
// wait instead the reasoning is that this doesn't really do anything useful
7
8
// that you can't get from using find* or wait.
8
-
asyncfunctionwaitForElement(callback,options){
9
+
asyncfunctionwaitForElement<T>(
10
+
callback: ()=>T,
11
+
options?: waitForOptions,
12
+
): Promise<T>{
9
13
if(!hasWarned){
10
14
hasWarned=true
11
15
console.warn(
12
16
`\`waitForElement\` has been deprecated. Use a \`find*\` query (preferred: https://testing-library.com/docs/dom-testing-library/api-queries#findby) or use \`waitFor\` instead: https://testing-library.com/docs/dom-testing-library/api-async#waitfor`,
0 commit comments