Skip to content

Commit

Permalink
test: adds tests for visibilty when clipped by ancestor overflow:hidd…
Browse files Browse the repository at this point in the history
…en (#29844)

* test: adds tests for visibilty when clipped by ancestor overflow:hidden

* fn instead of arrow fn

* Update packages/driver/cypress/e2e/dom/visibility.cy.ts

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>

---------

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
  • Loading branch information
cacieprins and jennifer-shehane committed Jul 12, 2024
1 parent 17fd597 commit 48c81e3
Showing 1 changed file with 34 additions and 4 deletions.
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

4 comments on commit 48c81e3

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 48c81e3 Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.13.1/linux-arm64/develop-48c81e385e9f5c097e2cc808f68e38738d48df6b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 48c81e3 Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.13.1/linux-x64/develop-48c81e385e9f5c097e2cc808f68e38738d48df6b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 48c81e3 Jul 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.13.1/darwin-x64/develop-48c81e385e9f5c097e2cc808f68e38738d48df6b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 48c81e3 Jul 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.13.1/darwin-arm64/develop-48c81e385e9f5c097e2cc808f68e38738d48df6b/cypress.tgz

Please sign in to comment.