@@ -2,13 +2,15 @@ import DynamicPage from "../../src/DynamicPage.js";
22import DynamicPageTitle from "../../src/DynamicPageTitle.js" ;
33import DynamicPageHeader from "../../src/DynamicPageHeader.js" ;
44
5+ const PAGE_HEIGHT = "600px" ;
6+
57describe ( "DynamicPage Mobile Behaviour" , ( ) => {
68 beforeEach ( ( ) => {
79 cy . ui5SimulateDevice ( "phone" ) ;
810 } ) ;
911 it ( "should display snapped title on mobile when snappedTitleOnMobile slot has content and header is snapped" , ( ) => {
1012 cy . mount (
11- < DynamicPage style = { { height : "600px" } } >
13+ < DynamicPage style = { { height : PAGE_HEIGHT } } >
1214 < DynamicPageTitle slot = "titleArea" >
1315 < div slot = "heading" > Page Title</ div >
1416 < div slot = "snappedTitleOnMobile" > Mobile Snapped Title</ div >
@@ -30,7 +32,7 @@ describe("DynamicPage Mobile Behaviour", () => {
3032
3133 it ( "the header content should not be rendered when snappedTitleOnMobile content is present" , ( ) => {
3234 cy . mount (
33- < DynamicPage style = { { height : "600px" } } >
35+ < DynamicPage style = { { height : PAGE_HEIGHT } } >
3436 < DynamicPageTitle slot = "titleArea" >
3537 < div slot = "heading" > Page Title</ div >
3638 < div slot = "snappedTitleOnMobile" > Mobile Snapped Title</ div >
@@ -60,7 +62,7 @@ describe("DynamicPage Mobile Behaviour", () => {
6062
6163 it ( "should not display snapped title on mobile when snappedTitleOnMobile slot is empty" , ( ) => {
6264 cy . mount (
63- < DynamicPage style = { { height : "600px" } } >
65+ < DynamicPage style = { { height : PAGE_HEIGHT } } >
6466 < DynamicPageTitle slot = "titleArea" >
6567 < div slot = "heading" > Page Title</ div >
6668 < div slot = "snappedTitleOnMobile" > Mobile Snapped Title</ div >
@@ -94,7 +96,7 @@ describe("DynamicPage Mobile Behaviour", () => {
9496
9597 it ( "should expand the header when clicked on the snapped title on mobile" , ( ) => {
9698 cy . mount (
97- < DynamicPage style = { { height : "600px" } } >
99+ < DynamicPage style = { { height : PAGE_HEIGHT } } >
98100 < DynamicPageTitle slot = "titleArea" >
99101 < div slot = "heading" > Page Title</ div >
100102 < div slot = "snappedTitleOnMobile" > Mobile Snapped Title</ div >
@@ -122,7 +124,7 @@ describe("DynamicPage Mobile Behaviour", () => {
122124
123125 it ( "should not display snapped title on mobile when header is not snapped" , ( ) => {
124126 cy . mount (
125- < DynamicPage style = { { height : "600px" } } >
127+ < DynamicPage style = { { height : PAGE_HEIGHT } } >
126128 < DynamicPageTitle slot = "titleArea" >
127129 < div slot = "heading" > Page Title</ div >
128130 < div slot = "snappedTitleOnMobile" > Mobile Snapped Title</ div >
@@ -142,9 +144,9 @@ describe("DynamicPage Mobile Behaviour", () => {
142144 cy . contains ( "Mobile Snapped Title" ) . should ( "not.be.visible" ) ;
143145 } ) ;
144146
145- it ( "should focus the title focus area when header action is clicked to snap the header" , ( ) => {
147+ it ( "should focus the title focus area when header action is clicked to snap the header" , ( ) => {
146148 cy . mount (
147- < DynamicPage style = { { height : "600px" } } >
149+ < DynamicPage style = { { height : PAGE_HEIGHT } } >
148150 < DynamicPageTitle slot = "titleArea" >
149151 < div slot = "heading" > Page Title</ div >
150152 < div slot = "snappedTitleOnMobile" > Mobile Snapped Title</ div >
@@ -160,21 +162,44 @@ describe("DynamicPage Mobile Behaviour", () => {
160162
161163 cy . get ( "[ui5-dynamic-page]" )
162164 . invoke ( "prop" , "headerSnapped" , false ) ;
163-
165+
164166 cy . get ( "[ui5-dynamic-page]" )
165167 . shadow ( )
166168 . find ( "ui5-dynamic-page-header-actions" )
167169 . shadow ( )
168170 . find ( ".ui5-dynamic-page-header-action" )
169171 . first ( )
170172 . click ( ) ;
171-
173+
172174 cy . get ( "[ui5-dynamic-page]" )
173175 . should ( "have.prop" , "headerSnapped" , true ) ;
174-
176+
175177 cy . get ( "[ui5-dynamic-page-title]" )
176178 . shadow ( )
177179 . find ( ".ui5-dynamic-page-title-focus-area" )
178180 . should ( "be.focused" ) ;
179181 } ) ;
182+
183+ it ( "should not display pin button on mobile devices" , ( ) => {
184+ cy . mount (
185+ < DynamicPage style = { { height : PAGE_HEIGHT } } >
186+ < DynamicPageTitle slot = "titleArea" >
187+ < div slot = "heading" > Page Title</ div >
188+ </ DynamicPageTitle >
189+ < DynamicPageHeader slot = "headerArea" >
190+ < div > Header Content</ div >
191+ </ DynamicPageHeader >
192+ < div style = { { height : "1000px" } } >
193+ Page content with enough height to enable scrolling
194+ </ div >
195+ </ DynamicPage >
196+ ) ;
197+
198+ cy . get ( "[ui5-dynamic-page]" )
199+ . shadow ( )
200+ . find ( "ui5-dynamic-page-header-actions" )
201+ . shadow ( )
202+ . find ( ".ui5-dynamic-page-header-action-pin" )
203+ . should ( "not.exist" ) ;
204+ } ) ;
180205} ) ;
0 commit comments