@@ -69,12 +69,12 @@ declare global {
69
69
* __Note:__ Chaining this command to a `ui5-list` selector is recommended.
70
70
*
71
71
* @param {string } text The text of the list item that should be clicked.
72
- * @param options ClickOptions
72
+ * @param { Partial<ClickOptions> } [ options] ClickOptions (without `force`)
73
73
* @example
74
74
* cy.get('[ui5-list]').clickUi5ListItemByText("List Item")
75
75
* cy.clickUi5ListItemByText("List Item")
76
76
*/
77
- clickUi5ListItemByText ( text : string , options : Partial < ClickOptions > ) : Chainable < Element > ;
77
+ clickUi5ListItemByText ( text : string , options ? : Partial < Omit < ClickOptions , 'force' > > ) : Chainable < Element > ;
78
78
79
79
/**
80
80
* Click on an `ui5-option` of the `ui5-select` component by text.
@@ -85,7 +85,7 @@ declare global {
85
85
* @param options ClickOptions
86
86
*
87
87
*
88
- * @example cy.get('[ui5-select]').clickUi5SelectOptionByText('Option2');*
88
+ * @example cy.get('[ui5-select]').clickUi5SelectOptionByText('Option2');
89
89
*/
90
90
clickUi5SelectOptionByText ( text : string , options ?: Partial < ClickOptions > ) : Chainable < Element > ;
91
91
@@ -194,15 +194,15 @@ Cypress.Commands.add('closeUi5PopupWithEsc', () => {
194
194
cy . get ( 'body' ) . type ( '{esc}' , { force : true } ) ;
195
195
} ) ;
196
196
197
- Cypress . Commands . add ( 'clickUi5ListItemByText' , { prevSubject : 'optional' } , ( subject , text ) => {
197
+ Cypress . Commands . add ( 'clickUi5ListItemByText' , { prevSubject : 'optional' } , ( subject , text , options = { } ) => {
198
198
cy . document ( ) . then ( ( doc ) => {
199
199
const _subject = ( subject as Cypress . JQueryWithSelector < UI5Element > ) ?. [ 0 ] || doc ;
200
200
const li = _subject . querySelector ( `[text="${ text } "]` ) ;
201
201
202
202
if ( li ) {
203
- cy . wrap ( li ) . click ( ) ;
203
+ cy . wrap ( li ) . click ( options ) ;
204
204
} else {
205
- cy . wrap ( _subject ) . contains ( text ) . click ( ) ;
205
+ cy . wrap ( _subject ) . contains ( text ) . click ( options ) ;
206
206
}
207
207
} ) ;
208
208
} ) ;
0 commit comments