From 5f55727c11c9cb67d2a1288f4c67b765e154a01f Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Fri, 12 Jul 2024 10:54:49 -0400 Subject: [PATCH 1/3] test: adds tests for visibilty when clipped by ancestor overflow:hidden --- .../driver/cypress/e2e/dom/visibility.cy.ts | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/packages/driver/cypress/e2e/dom/visibility.cy.ts b/packages/driver/cypress/e2e/dom/visibility.cy.ts index 5dc7495afc30..eb19615d532a 100644 --- a/packages/driver/cypress/e2e/dom/visibility.cy.ts +++ b/packages/driver/cypress/e2e/dom/visibility.cy.ts @@ -246,9 +246,7 @@ describe('src/cypress/dom/visibility', () => { this.$parentNoWidth = add(`\
-
parent width: 0 -
`) this.$parentNoHeight = add(`\ @@ -263,11 +261,28 @@ describe('src/cypress/dom/visibility', () => { this.$parentWithWidthHeightNoOverflow = add(`\
-
parent with size, overflow: hidden -
`) + this.$ancestorWithWidthHeightNoOverflow = add(`\ +
+
parent with size, overflow: hidden
+
`) + + this.$ancestorNoWidth = add(`\ +
+
+ ancestor width: 0 +
+
`) + + this.$ancestorNoHeight = add(`\ +
+
+ ancestor width: 0 +
+
`) + this.$childPosAbs = add(`\
@@ -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', () => { + 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', () => { From ba7c0d64612a824e693314b2c1c60c9319f44f49 Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Fri, 12 Jul 2024 11:55:25 -0400 Subject: [PATCH 2/3] fn instead of arrow fn --- packages/driver/cypress/e2e/dom/visibility.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/driver/cypress/e2e/dom/visibility.cy.ts b/packages/driver/cypress/e2e/dom/visibility.cy.ts index eb19615d532a..c89871ea97a1 100644 --- a/packages/driver/cypress/e2e/dom/visibility.cy.ts +++ b/packages/driver/cypress/e2e/dom/visibility.cy.ts @@ -762,7 +762,7 @@ describe('src/cypress/dom/visibility', () => { expect(this.$ancestorNoWidth.find('span')).to.not.be.visible }) - it('is hidden if ancestor has overflow:hidden and no height', () => { + 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 }) From 5a712c291afd94392c15bd5bec4adb3d7343d871 Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Fri, 12 Jul 2024 16:32:13 -0400 Subject: [PATCH 3/3] Update packages/driver/cypress/e2e/dom/visibility.cy.ts Co-authored-by: Jennifer Shehane --- packages/driver/cypress/e2e/dom/visibility.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/driver/cypress/e2e/dom/visibility.cy.ts b/packages/driver/cypress/e2e/dom/visibility.cy.ts index c89871ea97a1..fc747350b5c3 100644 --- a/packages/driver/cypress/e2e/dom/visibility.cy.ts +++ b/packages/driver/cypress/e2e/dom/visibility.cy.ts @@ -279,7 +279,7 @@ describe('src/cypress/dom/visibility', () => { this.$ancestorNoHeight = add(`\
- ancestor width: 0 + ancestor height: 0
`)