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: adds tests for visibilty when clipped by ancestor overflow:hidden #29844

Merged
merged 5 commits into from
Jul 12, 2024
Merged
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
38 changes: 34 additions & 4 deletions packages/driver/cypress/e2e/dom/visibility.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,7 @@ describe('src/cypress/dom/visibility', () => {

this.$parentNoWidth = add(`\
<div style='width: 0; height: 100px; overflow: hidden;'>
<div style='height: 500px; width: 500px;'>
<span>parent width: 0</span>
</div>
</div>`)

this.$parentNoHeight = add(`\
Expand All @@ -263,11 +261,28 @@ describe('src/cypress/dom/visibility', () => {

this.$parentWithWidthHeightNoOverflow = add(`\
<div style='width: 100px; height: 100px; overflow: hidden;'>
<div style='height: 100px; width: 100px;'>
<span>parent with size, overflow: hidden</span>
</div>
</div>`)

this.$ancestorWithWidthHeightNoOverflow = add(`\
<div style='width: 100px; height: 100px'>
<div><span>parent with size, overflow: hidden</span></div>
</div>`)

this.$ancestorNoWidth = add(`\
<div style='width: 0; height: 100px; overflow: hidden;'>
<div>
<span>ancestor width: 0</span>
</div>
</div>`)

this.$ancestorNoHeight = add(`\
<div style='width: 100px; height: 0px; overflow: hidden;'>
<div>
<span>ancestor height: 0</span>
</div>
</div>`)

this.$childPosAbs = add(`\
<div style='width: 0; height: 100px; overflow: hidden;'>
<div style='height: 500px; width: 500px;'>
Expand Down Expand Up @@ -742,10 +757,25 @@ describe('src/cypress/dom/visibility', () => {
expect(this.$parentNoHeight.find('span')).to.not.be.visible
})

it('is hidden if ancestor has overflow:hidden and no width', function () {
expect(this.$ancestorNoWidth.find('span')).to.be.hidden
expect(this.$ancestorNoWidth.find('span')).to.not.be.visible
})

it('is hidden if ancestor has overflow:hidden and no height', function () {
expect(this.$ancestorNoHeight.find('span')).to.be.hidden
expect(this.$ancestorNoHeight.find('span')).to.not.be.visible
})

it('is visible when parent has positive dimensions even with overflow hidden', function () {
expect(this.$parentWithWidthHeightNoOverflow.find('span')).to.be.visible
expect(this.$parentWithWidthHeightNoOverflow.find('span')).to.not.be.hidden
})

it('is visible when ancestor has positive dimensions even with overflow hidden', function () {
expect(this.$ancestorWithWidthHeightNoOverflow.find('span')).to.be.visible
expect(this.$ancestorWithWidthHeightNoOverflow.find('span')).to.not.be.hidden
})
})

describe('css position', () => {
Expand Down
Loading