@@ -48,4 +48,86 @@ describe("List - getFocusDomRef Method", () => {
48
48
expect ( ps . getFocusDomRef ( ) ) . to . equal ( psItem . getFocusDomRef ( ) ) ;
49
49
} ) ;
50
50
} ) ;
51
- } ) ;
51
+ } ) ;
52
+
53
+ describe ( "ProductSwitch general interaction" , ( ) => {
54
+ it ( "tests 3-column desktop layout" , ( ) => {
55
+ cy . mount (
56
+ < ProductSwitch desktopColumns = { 3 } >
57
+ < ProductSwitchItem titleText = "Home" subtitleText = "Central Home" icon = "home" > </ ProductSwitchItem >
58
+ < ProductSwitchItem titleText = "Analytics Cloud" subtitleText = "Analytics Cloud" icon = "business-objects-experience" > </ ProductSwitchItem >
59
+ < ProductSwitchItem titleText = "Catalog" subtitleText = "Ariba" icon = "contacts" > </ ProductSwitchItem >
60
+ < ProductSwitchItem titleText = "Guided Buying" icon = "credit-card" > </ ProductSwitchItem >
61
+ </ ProductSwitch >
62
+ ) ;
63
+
64
+ cy . get ( "[ui5-product-switch]" )
65
+ . should ( "have.attr" , "desktop-columns" , "3" )
66
+ . invoke ( "prop" , "items" )
67
+ . should ( "have.length" , 4 )
68
+ . should ( "have.length.at.most" , 6 ) ;
69
+ } ) ;
70
+
71
+ it ( "tests 4-column desktop layout" , ( ) => {
72
+ cy . mount (
73
+ < ProductSwitch desktopColumns = { 4 } >
74
+ < ProductSwitchItem titleText = "Home" subtitleText = "Central Home" icon = "home" > </ ProductSwitchItem >
75
+ < ProductSwitchItem titleText = "Analytics Cloud" subtitleText = "Analytics Cloud" icon = "business-objects-experience" > </ ProductSwitchItem >
76
+ < ProductSwitchItem titleText = "Catalog" subtitleText = "Ariba" icon = "contacts" > </ ProductSwitchItem >
77
+ < ProductSwitchItem titleText = "Guided Buying" icon = "credit-card" > </ ProductSwitchItem >
78
+ < ProductSwitchItem titleText = "Strategic Procurement" icon = "cart-3" > </ ProductSwitchItem >
79
+ < ProductSwitchItem titleText = "Travel & Expense" subtitleText = "Concur" icon = "flight" > </ ProductSwitchItem >
80
+ < ProductSwitchItem titleText = "Vendor Management" subtitleText = "Fieldglass" icon = "shipping-status" > </ ProductSwitchItem >
81
+ < ProductSwitchItem titleText = "Human Capital Management" icon = "customer" > </ ProductSwitchItem >
82
+ < ProductSwitchItem titleText = "Sales Cloud" subtitleText = "Sales Cloud" icon = "sales-notification" > </ ProductSwitchItem >
83
+ < ProductSwitchItem titleText = "Commerce Cloud" subtitleText = "Commerce Cloud" icon = "retail-store" > </ ProductSwitchItem >
84
+ < ProductSwitchItem titleText = "Marketing Cloud" subtitleText = "Marketing Cloud" icon = "marketing-campaign" > </ ProductSwitchItem >
85
+ < ProductSwitchItem titleText = "Service Cloud" icon = "family-care" > </ ProductSwitchItem >
86
+ < ProductSwitchItem titleText = "Customer Data Cloud" icon = "customer-briefing" > </ ProductSwitchItem >
87
+ < ProductSwitchItem titleText = "S/4HANA" icon = "batch-payments" > </ ProductSwitchItem >
88
+ </ ProductSwitch >
89
+ ) ;
90
+
91
+ cy . get ( "[ui5-product-switch]" )
92
+ . should ( "have.attr" , "desktop-columns" , "4" )
93
+ . invoke ( "prop" , "items" )
94
+ . should ( "have.length" , 14 )
95
+ . should ( "have.length.above" , 6 ) ;
96
+ } ) ;
97
+ } ) ;
98
+
99
+ describe ( "ProductSwitch ARIA attributes" , ( ) => {
100
+ it ( "role and aria-label set correctly" , ( ) => {
101
+ cy . mount (
102
+ < ProductSwitch >
103
+ < ProductSwitchItem titleText = "Home" subtitleText = "Central Home" icon = "home" > </ ProductSwitchItem >
104
+ < ProductSwitchItem titleText = "Analytics Cloud" subtitleText = "Analytics Cloud" icon = "business-objects-experience" > </ ProductSwitchItem >
105
+ < ProductSwitchItem titleText = "Catalog" subtitleText = "Ariba" icon = "contacts" > </ ProductSwitchItem >
106
+ < ProductSwitchItem titleText = "Guided Buying" icon = "credit-card" > </ ProductSwitchItem >
107
+ </ ProductSwitch >
108
+ ) ;
109
+
110
+ cy . get ( "[ui5-product-switch]" )
111
+ . shadow ( )
112
+ . find ( ".ui5-product-switch-root" )
113
+ . should ( "have.attr" , "role" , "list" )
114
+ . should ( "have.attr" , "aria-label" , "Products" ) ;
115
+ } ) ;
116
+ } ) ;
117
+
118
+ describe ( "ProductSwitch styles" , ( ) => {
119
+ it ( "tests root element inherit styles" , ( ) => {
120
+ cy . mount (
121
+ < ProductSwitch style = { { display : "flex" , justifyContent : "center" , alignItems : "center" } } >
122
+ < ProductSwitchItem titleText = "Home" subtitleText = "Central Home" icon = "home" > </ ProductSwitchItem >
123
+ < ProductSwitchItem titleText = "Analytics Cloud" subtitleText = "Analytics Cloud" icon = "business-objects-experience" > </ ProductSwitchItem >
124
+ </ ProductSwitch >
125
+ ) ;
126
+
127
+ cy . get ( "[ui5-product-switch]" )
128
+ . shadow ( )
129
+ . find ( ".ui5-product-switch-root" )
130
+ . should ( "have.css" , "justify-content" , "center" )
131
+ . should ( "have.css" , "align-items" , "center" ) ;
132
+ } ) ;
133
+ } ) ;
0 commit comments