File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -35,4 +35,38 @@ describe("DynamicPage", () => {
35
35
. invoke ( "prop" , "headerPinned" )
36
36
. should ( "be.false" ) ;
37
37
} ) ;
38
+
39
+ it ( "should show correct tooltip for pin button based on pinned state" , ( ) => {
40
+ // Initially the header should not be pinned, so tooltip should be "Pin Header"
41
+ cy . get ( "@dynamicPage" )
42
+ . shadow ( )
43
+ . find ( "ui5-dynamic-page-header-actions" )
44
+ . shadow ( )
45
+ . find ( ".ui5-dynamic-page-header-action-pin" )
46
+ . should ( "have.attr" , "tooltip" , "Pin Header" ) ;
47
+
48
+ // Pin the header
49
+ cy . get ( "@dynamicPage" )
50
+ . invoke ( "prop" , "headerPinned" , true ) ;
51
+
52
+ // After pinning, tooltip should change to "Unpin Header"
53
+ cy . get ( "@dynamicPage" )
54
+ . shadow ( )
55
+ . find ( "ui5-dynamic-page-header-actions" )
56
+ . shadow ( )
57
+ . find ( ".ui5-dynamic-page-header-action-pin" )
58
+ . should ( "have.attr" , "tooltip" , "Unpin Header" ) ;
59
+
60
+ // Unpin the header
61
+ cy . get ( "@dynamicPage" )
62
+ . invoke ( "prop" , "headerPinned" , false ) ;
63
+
64
+ // After unpinning, tooltip should change back to "Pin Header"
65
+ cy . get ( "@dynamicPage" )
66
+ . shadow ( )
67
+ . find ( "ui5-dynamic-page-header-actions" )
68
+ . shadow ( )
69
+ . find ( ".ui5-dynamic-page-header-action-pin" )
70
+ . should ( "have.attr" , "tooltip" , "Pin Header" ) ;
71
+ } ) ;
38
72
} ) ;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import {
26
26
DYNAMIC_PAGE_ARIA_LABEL_EXPAND_HEADER ,
27
27
DYNAMIC_PAGE_ARIA_LABEL_SNAP_HEADER ,
28
28
DYNAMIC_PAGE_ARIA_LABEL_PIN_HEADER ,
29
+ DYNAMIC_PAGE_ARIA_LABEL_UNPIN_HEADER ,
29
30
} from "./generated/i18n/i18n-defaults.js" ;
30
31
31
32
type DynamicPageHeaderActionsAccessibilityAttributes = Pick < AccessibilityAttributes , "controls" > ;
@@ -153,7 +154,9 @@ class DynamicPageHeaderActions extends UI5Element {
153
154
}
154
155
155
156
get pinLabel ( ) {
156
- return DynamicPageHeaderActions . i18nBundle . getText ( DYNAMIC_PAGE_ARIA_LABEL_PIN_HEADER ) ;
157
+ return this . pinned
158
+ ? DynamicPageHeaderActions . i18nBundle . getText ( DYNAMIC_PAGE_ARIA_LABEL_UNPIN_HEADER )
159
+ : DynamicPageHeaderActions . i18nBundle . getText ( DYNAMIC_PAGE_ARIA_LABEL_PIN_HEADER ) ;
157
160
}
158
161
159
162
get expandLabel ( ) {
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ DYNAMIC_PAGE_ARIA_LABEL_SNAP_HEADER=Snap Header
23
23
# XACT: Aria label for the button that pins the header
24
24
DYNAMIC_PAGE_ARIA_LABEL_PIN_HEADER =Pin Header
25
25
26
+ # XACT: Aria label for the button that unpins the header
27
+ DYNAMIC_PAGE_ARIA_LABEL_UNPIN_HEADER =Unpin Header
28
+
26
29
# XACT: Aria description for the button that toggles the header
27
30
DYNAMIC_PAGE_ARIA_DESCR_TOGGLE_HEADER =Toggle Header
28
31
You can’t perform that action at this time.
0 commit comments