F.wait() parameter handling issue
- Dominant language
- JavaScript
- Stars
- 571
- Forks
- 370
- PR merge metrics
- No merged PRs in 30d
Description
Hi Alex,
I was looking at:
waits.js (line 274)
```
wait: function( checker, timeout, success, message ) {
if(typeof checker === "number"){
timeout = checker;
FuncUnit.wait(timeout, success)
return this;
} else {
return this.size(checker, timeout, success, message)
}
},
```
If F().wait() was called in the context of a timer wait, as implied by `typeof checker === "number"` then the call signature is expected to be: `F('selector').wait(1234, successFn)`
According to my example, the mapping is as follows:
checker -> 1234
timeout -> successFn
success -> undefined
message -> undefined
So the expected internal call is: `FuncUnit.wait(checker, timeout)`
But in your logic you are using the variable `success` for the success handler instead of timeout which holds the success handler.
This is the suggested fix:
```
wait: function( checker, timeout, success, message ) {
if(typeof checker === "number") {
success = timeout;
timeout = checker;
FuncUnit.wait(timeout, success);
return this;
} else {
return this.size(checker, timeout, success, message)
}
},
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at waits.js line 274 and trace the numeric-checker path for F('selector').wait(1234, successFn), comparing its argument mapping with FuncUnit.wait. The issue is done when the success handler is passed correctly for timer waits while the selector-based path remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100