mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-04 14:00:22 -05:00
fix: cy.then shows wrong type when raw HTMLElement is provided. (#15624)
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
This commit is contained in:
Vendored
+12
@@ -1824,6 +1824,12 @@ declare namespace Cypress {
|
||||
* @see https://on.cypress.io/then
|
||||
*/
|
||||
then<S>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => PromiseLike<S>): Chainable<S>
|
||||
/**
|
||||
* Enables you to work with the subject yielded from the previous command / promise.
|
||||
*
|
||||
* @see https://on.cypress.io/then
|
||||
*/
|
||||
then<S extends HTMLElement>(fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<JQuery<S>>
|
||||
/**
|
||||
* Enables you to work with the subject yielded from the previous command / promise.
|
||||
*
|
||||
@@ -1836,6 +1842,12 @@ declare namespace Cypress {
|
||||
* @see https://on.cypress.io/then
|
||||
*/
|
||||
then<S>(fn: (this: ObjectLike, currentSubject: Subject) => S): ThenReturn<Subject, S>
|
||||
/**
|
||||
* Enables you to work with the subject yielded from the previous command / promise.
|
||||
*
|
||||
* @see https://on.cypress.io/then
|
||||
*/
|
||||
then<S extends HTMLElement>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<JQuery<S>>
|
||||
/**
|
||||
* Enables you to work with the subject yielded from the previous command / promise.
|
||||
*
|
||||
|
||||
@@ -236,6 +236,26 @@ describe('then', () => {
|
||||
s // $ExpectType string
|
||||
})
|
||||
})
|
||||
|
||||
it('HTMLElement', () => {
|
||||
cy.get('div')
|
||||
.then(($div) => {
|
||||
$div // $ExpectType JQuery<HTMLDivElement>
|
||||
return $div[0]
|
||||
})
|
||||
.then(($div) => {
|
||||
$div // $ExpectType JQuery<HTMLDivElement>
|
||||
})
|
||||
|
||||
cy.get('p')
|
||||
.then(($p) => {
|
||||
$p // $ExpectType JQuery<HTMLParagraphElement>
|
||||
return $p[0]
|
||||
})
|
||||
.then({timeout: 3000}, ($p) => {
|
||||
$p // $ExpectType JQuery<HTMLParagraphElement>
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
cy.wait(['@foo', '@bar'])
|
||||
|
||||
Reference in New Issue
Block a user