diff --git a/packages/fiori/cypress/specs/DynamicPage.mobile.cy.tsx b/packages/fiori/cypress/specs/DynamicPage.mobile.cy.tsx index 1579704f1b42..f38164a84f1c 100644 --- a/packages/fiori/cypress/specs/DynamicPage.mobile.cy.tsx +++ b/packages/fiori/cypress/specs/DynamicPage.mobile.cy.tsx @@ -2,13 +2,15 @@ import DynamicPage from "../../src/DynamicPage.js"; import DynamicPageTitle from "../../src/DynamicPageTitle.js"; import DynamicPageHeader from "../../src/DynamicPageHeader.js"; +const PAGE_HEIGHT = "600px"; + describe("DynamicPage Mobile Behaviour", () => { beforeEach(() => { cy.ui5SimulateDevice("phone"); }); it("should display snapped title on mobile when snappedTitleOnMobile slot has content and header is snapped", () => { cy.mount( - +
Page Title
Mobile Snapped Title
@@ -30,7 +32,7 @@ describe("DynamicPage Mobile Behaviour", () => { it("the header content should not be rendered when snappedTitleOnMobile content is present", () => { cy.mount( - +
Page Title
Mobile Snapped Title
@@ -60,7 +62,7 @@ describe("DynamicPage Mobile Behaviour", () => { it("should not display snapped title on mobile when snappedTitleOnMobile slot is empty", () => { cy.mount( - +
Page Title
Mobile Snapped Title
@@ -94,7 +96,7 @@ describe("DynamicPage Mobile Behaviour", () => { it("should expand the header when clicked on the snapped title on mobile", () => { cy.mount( - +
Page Title
Mobile Snapped Title
@@ -122,7 +124,7 @@ describe("DynamicPage Mobile Behaviour", () => { it("should not display snapped title on mobile when header is not snapped", () => { cy.mount( - +
Page Title
Mobile Snapped Title
@@ -142,9 +144,9 @@ describe("DynamicPage Mobile Behaviour", () => { cy.contains("Mobile Snapped Title").should("not.be.visible"); }); - it("should focus the title focus area when header action is clicked to snap the header", () => { + it("should focus the title focus area when header action is clicked to snap the header", () => { cy.mount( - +
Page Title
Mobile Snapped Title
@@ -160,7 +162,7 @@ describe("DynamicPage Mobile Behaviour", () => { cy.get("[ui5-dynamic-page]") .invoke("prop", "headerSnapped", false); - + cy.get("[ui5-dynamic-page]") .shadow() .find("ui5-dynamic-page-header-actions") @@ -168,13 +170,36 @@ describe("DynamicPage Mobile Behaviour", () => { .find(".ui5-dynamic-page-header-action") .first() .click(); - + cy.get("[ui5-dynamic-page]") .should("have.prop", "headerSnapped", true); - + cy.get("[ui5-dynamic-page-title]") .shadow() .find(".ui5-dynamic-page-title-focus-area") .should("be.focused"); }); + + it("should not display pin button on mobile devices", () => { + cy.mount( + + +
Page Title
+
+ +
Header Content
+
+
+ Page content with enough height to enable scrolling +
+
+ ); + + cy.get("[ui5-dynamic-page]") + .shadow() + .find("ui5-dynamic-page-header-actions") + .shadow() + .find(".ui5-dynamic-page-header-action-pin") + .should("not.exist"); + }); }); \ No newline at end of file diff --git a/packages/fiori/src/DynamicPage.ts b/packages/fiori/src/DynamicPage.ts index 9e79dd87531c..c3aab7f13465 100644 --- a/packages/fiori/src/DynamicPage.ts +++ b/packages/fiori/src/DynamicPage.ts @@ -284,6 +284,10 @@ class DynamicPage extends UI5Element { return this.hasHeading ? this._headerLabel : undefined; } + get _hidePinButton() { + return this.hidePinButton || isPhone(); + } + /** * Defines if the header is snapped. * diff --git a/packages/fiori/src/DynamicPageTemplate.tsx b/packages/fiori/src/DynamicPageTemplate.tsx index 79a321a06f37..91c1e81f320c 100644 --- a/packages/fiori/src/DynamicPageTemplate.tsx +++ b/packages/fiori/src/DynamicPageTemplate.tsx @@ -61,7 +61,7 @@ function headerActions(this: DynamicPage) {