Skip to content

Commit 329ec3f

Browse files
authored
fix(cypress-commands): make the options optional for clickUi5ListItemByText
1 parent 69d9fbc commit 329ec3f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/cypress-commands/src/commands.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ declare global {
7474
* cy.get('[ui5-list]').clickUi5ListItemByText("List Item")
7575
* cy.clickUi5ListItemByText("List Item")
7676
*/
77-
clickUi5ListItemByText(text: string, options: Partial<ClickOptions>): Chainable<Element>;
77+
clickUi5ListItemByText(text: string, options?: Partial<ClickOptions>): Chainable<Element>;
7878

7979
/**
8080
* Click on an `ui5-option` of the `ui5-select` component by text.
@@ -194,15 +194,15 @@ Cypress.Commands.add('closeUi5PopupWithEsc', () => {
194194
cy.get('body').type('{esc}', { force: true });
195195
});
196196

197-
Cypress.Commands.add('clickUi5ListItemByText', { prevSubject: 'optional' }, (subject, text) => {
197+
Cypress.Commands.add('clickUi5ListItemByText', { prevSubject: 'optional' }, (subject, text, options = {}) => {
198198
cy.document().then((doc) => {
199199
const _subject = (subject as Cypress.JQueryWithSelector<UI5Element>)?.[0] || doc;
200200
const li = _subject.querySelector(`[text="${text}"]`);
201201

202202
if (li) {
203-
cy.wrap(li).click();
203+
cy.wrap(li).click(options);
204204
} else {
205-
cy.wrap(_subject).contains(text).click();
205+
cy.wrap(_subject).contains(text).click(options);
206206
}
207207
});
208208
});

0 commit comments

Comments
 (0)