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
test('requires a function as the first parameter',()=>{
48
+
test('requires an element to exist first',()=>{
49
49
returnexpect(
50
-
waitForElementToBeRemoved(),
50
+
waitForElementToBeRemoved(null),
51
51
).rejects.toThrowErrorMatchingInlineSnapshot(
52
-
`"waitForElementToBeRemoved requires a callback as the first parameter"`,
52
+
`"The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal."`,
53
53
)
54
54
})
55
55
56
-
test('requires an element to exist first',()=>{
56
+
test('requires an unempty array of elements to exist first',()=>{
57
+
returnexpect(
58
+
waitForElementToBeRemoved([]),
59
+
).rejects.toThrowErrorMatchingInlineSnapshot(
60
+
`"The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal."`,
61
+
)
62
+
})
63
+
64
+
test('requires an element to exist first (function form)',()=>{
57
65
returnexpect(
58
66
waitForElementToBeRemoved(()=>null),
59
67
).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(s) before waiting for removal."`,
68
+
`"The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal."`,
61
69
)
62
70
})
63
71
64
-
test('requires an unempty array of elements to exist first',()=>{
72
+
test('requires an unempty array of elements to exist first (function form)',()=>{
65
73
returnexpect(
66
74
waitForElementToBeRemoved(()=>[]),
67
75
).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(s) before waiting for removal."`,
76
+
`"The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal."`,
'waitForElementToBeRemoved requires a callback as the first parameter',
10
-
),
5
+
// Check if the element is not present.
6
+
// As the name implies, waitForElementToBeRemoved should check `present` --> `removed`
7
+
functioninitialCheck(elements){
8
+
if(isRemoved(elements)){
9
+
thrownewError(
10
+
'The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.',
11
11
)
12
12
}
13
+
}
13
14
14
-
// Check if the element is not present synchronously,
15
-
// As the name implies, waitForElementToBeRemoved should check `present` --> `removed`
16
-
if(isRemoved(callback())){
17
-
thrownewError(
18
-
'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.',
0 commit comments