Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(QSelect): prefer Quasar test AE 'select' override #17017

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 20 additions & 71 deletions ui/src/components/select/__tests__/QSelect.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,7 @@ describe('QSelect API', () => {
}
})
getHostElement()
.click()
cy.get('.q-menu')
.contains('Option 1')
.should('be.visible')
.click()
cy.get('.q-menu')
.select('Option 1')
.then(() => {
expect(fn).to.have.been.calledWith(1)
})
Expand All @@ -243,12 +238,7 @@ describe('QSelect API', () => {
}
})
getHostElement()
.click()
cy.get('.q-menu')
.contains('Option 1')
.should('be.visible')
.click()
cy.get('.q-menu')
.select('Option 1')
.then(() => {
expect(fn).to.have.been.calledWith(options[ 0 ])
})
Expand All @@ -268,27 +258,17 @@ describe('QSelect API', () => {
}
})

getHostElement().click()
cy.withinSelectMenu(() => {
cy.contains('Option 1')
.should('be.visible')
.click()
cy.contains('Option 1')
.then(() => {
expect(model.value).to.equal(options[ 0 ])
})
})
getHostElement()
.select('Option 1')
.then(() => {
expect(model.value).to.equal(options[ 0 ])
})

getHostElement().click()
cy.withinSelectMenu(() => {
cy.contains('Option 2')
.should('be.visible')
.click()
cy.contains('Option 2')
.then(() => {
expect(model.value).to.equal(options[ 1 ])
})
})
getHostElement()
.select('Option 2')
.then(() => {
expect(model.value).to.equal(options[ 1 ])
})
})

it('should select multiple options if multiple is true', () => {
Expand All @@ -302,27 +282,11 @@ describe('QSelect API', () => {
}
})

getHostElement().click()
cy.withinSelectMenu({
persistent: true,
fn: () => {
cy.contains('Option 1')
.should('be.visible')
.click()
cy.contains('Option 1')
.then(() => {
expect(model.value).to.eql([ options[ 0 ] ])
})

cy.contains('Option 2')
.should('be.visible')
.click()
cy.contains('Option 2')
.then(() => {
expect(model.value).to.eql(options)
})
}
})
getHostElement()
.select(options)
.then(() => {
expect(model.value).to.eql(options)
})
})
})
})
Expand Down Expand Up @@ -359,12 +323,7 @@ describe('QSelect API', () => {
}
})
getHostElement()
.click()
cy.get('.q-menu')
.contains(options[ 0 ].label)
.should('be.visible')
.click()
cy.get('.q-menu')
.select(options[ 0 ].label)
.then(() => {
expect(model.value).to.equal(options[ 0 ].value)
})
Expand All @@ -382,12 +341,7 @@ describe('QSelect API', () => {
}
})
getHostElement()
.click()
cy.get('.q-menu')
.contains(options[ 0 ].label)
.should('be.visible')
.click()
cy.get('.q-menu')
.select(options[ 0 ].label)
.then(() => {
expect(model.value).to.equal(options[ 0 ].test)
})
Expand All @@ -405,12 +359,7 @@ describe('QSelect API', () => {
}
})
getHostElement()
.click()
cy.get('.q-menu')
.contains(options[ 0 ].label)
.should('be.visible')
.click()
cy.get('.q-menu')
.select(options[ 0 ].label)
.then(() => {
expect(model.value).to.equal(options[ 0 ].test)
})
Expand Down
Loading