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
feat(wait): wait will now also run your callback on DOM changes (#415)
Closes#376Closes#416
BREAKING CHANGE: `waitForElement` is deprecated in favor of `find*` queries or `wait`.
BREAKING CHANGE: `waitForDomChange` is deprecated in favor of `wait`
BREAKING CHANGE: default timeout for async utilities is now 1000ms rather than 4500ms. This can be configured: https://testing-library.com/docs/dom-testing-library/api-configuration
Copy file name to clipboardExpand all lines: src/__tests__/wait-for-element-to-be-removed.js
+18-3
Original file line number
Diff line number
Diff line change
@@ -49,23 +49,23 @@ test('requires a function as the first parameter', () => {
49
49
returnexpect(
50
50
waitForElementToBeRemoved(),
51
51
).rejects.toThrowErrorMatchingInlineSnapshot(
52
-
`"waitForElementToBeRemoved requires a function as the first parameter"`,
52
+
`"waitForElementToBeRemoved requires a callback as the first parameter"`,
53
53
)
54
54
})
55
55
56
56
test('requires an element to exist first',()=>{
57
57
returnexpect(
58
58
waitForElementToBeRemoved(()=>null),
59
59
).rejects.toThrowErrorMatchingInlineSnapshot(
60
-
`"The callback function which was passed did not return an element or non-empty array of elements. waitForElementToBeRemoved requires that the element(s) exist before waiting for removal."`,
60
+
`"The callback function which was passed did not return an element or non-empty array of elements. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal."`,
61
61
)
62
62
})
63
63
64
64
test('requires an unempty array of elements to exist first',()=>{
65
65
returnexpect(
66
66
waitForElementToBeRemoved(()=>[]),
67
67
).rejects.toThrowErrorMatchingInlineSnapshot(
68
-
`"The callback function which was passed did not return an element or non-empty array of elements. waitForElementToBeRemoved requires that the element(s) exist before waiting for removal."`,
68
+
`"The callback function which was passed did not return an element or non-empty array of elements. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal."`,
69
69
)
70
70
})
71
71
@@ -117,3 +117,18 @@ test("doesn't change jest's timers value when importing the module", () => {
"\`waitForElement\` has been deprecated. Use a \`find*\` query (preferred: https://testing-library.com/docs/dom-testing-library/api-queries#findby) or use \`wait\` instead (it's the same API, so you can find/replace): https://testing-library.com/docs/dom-testing-library/api-async#wait",
26
+
],
27
+
]
28
+
`)
21
29
})
22
30
23
31
test('waits for element to appear in a specified container',async()=>{
0 commit comments