Skip to content

Commit

Permalink
chore: fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammer5 committed Apr 25, 2024
1 parent abe86cf commit 1e9057e
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ Given('a SplitButton with an icon is rendered', () => {
})

Then('the icon is visible on the left button only', () => {
cy.get('[data-test="dhis2-uicore-splitbutton-button"] :contains("Icon")')
.should('be.visible')
cy.get(
'[data-test="dhis2-uicore-splitbutton-button"] :contains("Icon")'
).should('be.visible')

cy.get('[data-test="dhis2-uicore-splitbutton-toggle"] :contains("Icon")')
.should('not.exist')
cy.get(
'[data-test="dhis2-uicore-splitbutton-toggle"] :contains("Icon")'
).should('not.exist')
})
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ When('an option is clicked', () => {
})

When('the selected option is clicked', () => {
cy.get('[data-test="dhis2-uicore-multiselectoption"]:contains("option one")').click()
cy.get(
'[data-test="dhis2-uicore-multiselectoption"]:contains("option one")'
).click()
})

When('another option is clicked', () => {
Expand All @@ -36,7 +38,9 @@ When('the disabled option is clicked', () => {
})

When('the selected option is clicked again', () => {
cy.get('[data-test="dhis2-uicore-multiselectoption"]:contains("option one")').click()
cy.get(
'[data-test="dhis2-uicore-multiselectoption"]:contains("option one")'
).click()
})

Then('the clicked option is selected', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ Then(
}
)
Then('both options are highlighted in the dropdown', () => {
cy.get('[data-test="dhis2-uicore-singleselectoption"]:contains("option one")')
.should('have.class', 'active')
cy.get(
'[data-test="dhis2-uicore-singleselectoption"]:contains("option one")'
).should('have.class', 'active')

cy.get('[data-test="dhis2-uicore-singleselectoption"]:contains("option one a")')
.should('have.class', 'active')
cy.get(
'[data-test="dhis2-uicore-singleselectoption"]:contains("option one a")'
).should('have.class', 'active')
})
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Given('the {int}. item is highlighted', (previousPisition) => {
.invoke('attr', 'data-value')
// For some reason, using `.as()` directly doesn't work.
// Wrapping it inside a `.then` works though
.then(previousValue => cy.wrap(previousValue).as('previousValue'))
.then((previousValue) => cy.wrap(previousValue).as('previousValue'))

cy.get('{transfer-pickedoptions} {transferoption}')
.eq(index)
Expand Down Expand Up @@ -55,7 +55,7 @@ Then('the highlighted item should be moved to the {int}. place', (next) => {
const index = next - 1

cy.get('@previousValue')
.then(previousValue => cy.get(`[data-value="${previousValue}"]`))
.then((previousValue) => cy.get(`[data-value="${previousValue}"]`))
.invoke('index')
.should('equal', index)
})
Expand Down
14 changes: 8 additions & 6 deletions cypress/support/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import { parseSelectorWithDataTest } from './common/parseSelectorWithDataTest.js
* cy.get('.foo').find('{node} input', 'custom-prefix')
* cy.get('.foo').find('[data-test="custom-prefix-node"] input')
*/
// eslint-disable-next-line max-params
Cypress.Commands.overwriteQuery('find', function (originalFn, selectors, options = {}) {
const { prefix, ...restOptions } = options
const selector = parseSelectorWithDataTest(selectors, prefix)
return originalFn.call(this, selector, restOptions)
})
Cypress.Commands.overwriteQuery(
'find',
function (originalFn, selectors, options = {}) {
const { prefix, ...restOptions } = options
const selector = parseSelectorWithDataTest(selectors, prefix)
return originalFn.call(this, selector, restOptions)
}
)
13 changes: 8 additions & 5 deletions cypress/support/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ import { parseSelectorWithDataTest } from './common/parseSelectorWithDataTest.js
* cy.get('{node} {node} input', 'custom-prefix')
* cy.get('[data-test="custom-prefix-node"] [data-test="custom-prefix-node"] input')
*/
Cypress.Commands.overwriteQuery('get', function (originalFn, selectors, options = {}) {
const { prefix, ...restOptions } = options
const selector = parseSelectorWithDataTest(selectors, prefix)
return originalFn.call(this, selector, restOptions)
})
Cypress.Commands.overwriteQuery(
'get',
function (originalFn, selectors, options = {}) {
const { prefix, ...restOptions } = options
const selector = parseSelectorWithDataTest(selectors, prefix)
return originalFn.call(this, selector, restOptions)
}
)

0 comments on commit 1e9057e

Please sign in to comment.