@sapudex/web-components 2.32.1 → 2.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/fixtures/masthead-shell.ts +281 -0
- package/cypress/specs/Breadcrumbs.cy.tsx +196 -1
- package/cypress/specs/FilterMenu.cy.tsx +53 -0
- package/cypress/specs/ListItem.cy.tsx +48 -0
- package/cypress/specs/MastheadMenu.cy.tsx +564 -0
- package/cypress/specs/MastheadMobileMenu.cy.tsx +573 -0
- package/cypress/specs/MastheadShell.cy.tsx +645 -0
- package/cypress/specs/SecondaryNavigationDesktop.cy.tsx +289 -95
- package/cypress/specs/SecondaryNavigationMobile.cy.tsx +42 -0
- package/cypress/specs/SelectBox.cy.tsx +63 -0
- package/cypress/specs/TabNavigation.cy.tsx +431 -10
- package/cypress/support/component-imports.instrumented.ts +14 -0
- package/cypress/support/component-imports.src.ts +10 -0
- package/dist/Breadcrumbs.d.ts +12 -0
- package/dist/Breadcrumbs.js +30 -6
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/BreadcrumbsPopoverTemplate.js +10 -1
- package/dist/BreadcrumbsPopoverTemplate.js.map +1 -1
- package/dist/BreadcrumbsTemplate.js +1 -1
- package/dist/BreadcrumbsTemplate.js.map +1 -1
- package/dist/ListItem.d.ts +3 -0
- package/dist/ListItem.js +10 -1
- package/dist/ListItem.js.map +1 -1
- package/dist/ListItemBase.d.ts +29 -0
- package/dist/ListItemBase.js +22 -0
- package/dist/ListItemBase.js.map +1 -1
- package/dist/MastheadItem.d.ts +2 -1
- package/dist/MastheadItem.js.map +1 -1
- package/dist/MastheadMenu.d.ts +2 -1
- package/dist/MastheadMenu.js.map +1 -1
- package/dist/SearchableListBase.d.ts +3 -1
- package/dist/SearchableListBase.js +7 -1
- package/dist/SearchableListBase.js.map +1 -1
- package/dist/SecondaryNavigation.d.ts +1 -6
- package/dist/SecondaryNavigation.js +6 -59
- package/dist/SecondaryNavigation.js.map +1 -1
- package/dist/SecondaryNavigationItem.d.ts +5 -12
- package/dist/SecondaryNavigationItem.js +34 -65
- package/dist/SecondaryNavigationItem.js.map +1 -1
- package/dist/SecondaryNavigationItemBase.d.ts +0 -1
- package/dist/SecondaryNavigationItemBase.js +0 -4
- package/dist/SecondaryNavigationItemBase.js.map +1 -1
- package/dist/SelectBase.js +4 -2
- package/dist/SelectBase.js.map +1 -1
- package/dist/Tab.d.ts +19 -0
- package/dist/Tab.js +22 -0
- package/dist/Tab.js.map +1 -1
- package/dist/TabNavigation.d.ts +9 -1
- package/dist/TabNavigation.js +25 -7
- package/dist/TabNavigation.js.map +1 -1
- package/dist/assets/{InputSuggestions-DeXhpK0F.js → InputSuggestions-Bz7HZXUc.js} +1 -1
- package/dist/assets/{ListItemStandardExpandableTextTemplate-jMEdrC07.js → ListItemStandardExpandableTextTemplate-CjE7hAvu.js} +1 -1
- package/dist/assets/{bundle-S1uYREqT.css → bundle-JYo3bV8v.css} +1 -1
- package/dist/assets/{bundle.esm-CwJAt93x.js → bundle.esm-mAR7ytdB.js} +217 -217
- package/dist/css/themes/Breadcrumbs.css +1 -1
- package/dist/css/themes/BreadcrumbsPopover.css +1 -1
- package/dist/css/themes/ListItem.css +1 -1
- package/dist/css/themes/MastheadMenu.css +1 -1
- package/dist/css/themes/MastheadMobileMenu.css +1 -1
- package/dist/css/themes/RatingIndicator.css +1 -1
- package/dist/css/themes/Slider.css +1 -1
- package/dist/css/themes/TabNavigation.css +1 -1
- package/dist/custom-elements-internal.json +1357 -212
- package/dist/custom-elements.json +1342 -197
- package/dist/generated/templates/ListItemTemplate.lit.js +32 -28
- package/dist/generated/templates/ListItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadMenuTemplate.lit.js +8 -1
- package/dist/generated/templates/MastheadMenuTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadMobileMenuTemplate.lit.js +10 -4
- package/dist/generated/templates/MastheadMobileMenuTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SearchableListBaseTemplate.lit.js +3 -3
- package/dist/generated/templates/SearchableListBaseTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SecondaryNavigationItemTemplate.lit.js +4 -4
- package/dist/generated/templates/SecondaryNavigationItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SecondaryNavigationSubItemTemplate.lit.js +3 -3
- package/dist/generated/templates/SecondaryNavigationSubItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SecondaryNavigationTemplate.lit.js +5 -5
- package/dist/generated/templates/SecondaryNavigationTemplate.lit.js.map +1 -1
- package/dist/generated/templates/SelectBoxTemplate.lit.js +12 -10
- package/dist/generated/templates/SelectBoxTemplate.lit.js.map +1 -1
- package/dist/generated/templates/TabHeaderTemplate.lit.js +40 -24
- package/dist/generated/templates/TabHeaderTemplate.lit.js.map +1 -1
- package/dist/generated/templates/TabNavigationTemplate.lit.js +1 -1
- package/dist/generated/templates/TabNavigationTemplate.lit.js.map +1 -1
- package/dist/generated/themes/Breadcrumbs.css.d.ts +1 -1
- package/dist/generated/themes/Breadcrumbs.css.js +1 -1
- package/dist/generated/themes/Breadcrumbs.css.js.map +1 -1
- package/dist/generated/themes/BreadcrumbsPopover.css.d.ts +1 -1
- package/dist/generated/themes/BreadcrumbsPopover.css.js +1 -1
- package/dist/generated/themes/BreadcrumbsPopover.css.js.map +1 -1
- package/dist/generated/themes/ListItem.css.d.ts +1 -1
- package/dist/generated/themes/ListItem.css.js +1 -1
- package/dist/generated/themes/ListItem.css.js.map +1 -1
- package/dist/generated/themes/MastheadMenu.css.d.ts +1 -1
- package/dist/generated/themes/MastheadMenu.css.js +1 -1
- package/dist/generated/themes/MastheadMenu.css.js.map +1 -1
- package/dist/generated/themes/MastheadMobileMenu.css.d.ts +1 -1
- package/dist/generated/themes/MastheadMobileMenu.css.js +1 -1
- package/dist/generated/themes/MastheadMobileMenu.css.js.map +1 -1
- package/dist/generated/themes/RatingIndicator.css.d.ts +1 -1
- package/dist/generated/themes/RatingIndicator.css.js +1 -1
- package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
- package/dist/generated/themes/Slider.css.d.ts +1 -1
- package/dist/generated/themes/Slider.css.js +1 -1
- package/dist/generated/themes/Slider.css.js.map +1 -1
- package/dist/generated/themes/TabNavigation.css.d.ts +1 -1
- package/dist/generated/themes/TabNavigation.css.js +1 -1
- package/dist/generated/themes/TabNavigation.css.js.map +1 -1
- package/dist/vscode.html-custom-data.json +236 -1
- package/dist/web-types.json +393 -3
- package/package.json +1 -1
- package/src/Breadcrumbs.ts +26 -7
- package/src/BreadcrumbsPopoverTemplate.tsx +53 -41
- package/src/BreadcrumbsTemplate.tsx +35 -21
- package/src/ListItem.hbs +42 -14
- package/src/ListItem.ts +12 -1
- package/src/ListItemBase.ts +40 -0
- package/src/MastheadItem.ts +2 -1
- package/src/MastheadMenu.hbs +35 -0
- package/src/MastheadMenu.ts +2 -1
- package/src/MastheadMobileMenu.hbs +40 -9
- package/src/SearchableListBase.hbs +12 -0
- package/src/SearchableListBase.ts +11 -2
- package/src/SecondaryNavigation.hbs +6 -6
- package/src/SecondaryNavigation.ts +7 -66
- package/src/SecondaryNavigationItem.hbs +4 -6
- package/src/SecondaryNavigationItem.ts +40 -83
- package/src/SecondaryNavigationItemBase.ts +0 -3
- package/src/SecondaryNavigationSubItem.hbs +3 -7
- package/src/SelectBase.ts +4 -2
- package/src/SelectBox.hbs +13 -5
- package/src/Tab.ts +32 -0
- package/src/TabHeader.hbs +40 -19
- package/src/TabNavigation.hbs +5 -9
- package/src/TabNavigation.ts +25 -8
- package/src/generated/templates/ListItemTemplate.lit.ts +32 -28
- package/src/generated/templates/MastheadMenuTemplate.lit.ts +8 -1
- package/src/generated/templates/MastheadMobileMenuTemplate.lit.ts +10 -4
- package/src/generated/templates/SearchableListBaseTemplate.lit.ts +3 -3
- package/src/generated/templates/SecondaryNavigationItemTemplate.lit.ts +4 -4
- package/src/generated/templates/SecondaryNavigationSubItemTemplate.lit.ts +3 -3
- package/src/generated/templates/SecondaryNavigationTemplate.lit.ts +5 -5
- package/src/generated/templates/SelectBoxTemplate.lit.ts +12 -10
- package/src/generated/templates/TabHeaderTemplate.lit.ts +40 -24
- package/src/generated/templates/TabNavigationTemplate.lit.ts +1 -1
- package/src/generated/themes/Breadcrumbs.css.ts +1 -1
- package/src/generated/themes/BreadcrumbsPopover.css.ts +1 -1
- package/src/generated/themes/ListItem.css.ts +1 -1
- package/src/generated/themes/MastheadMenu.css.ts +1 -1
- package/src/generated/themes/MastheadMobileMenu.css.ts +1 -1
- package/src/generated/themes/RatingIndicator.css.ts +1 -1
- package/src/generated/themes/Slider.css.ts +1 -1
- package/src/generated/themes/TabNavigation.css.ts +1 -1
- package/src/themes/Breadcrumbs.css +6 -0
- package/src/themes/BreadcrumbsPopover.css +12 -2
- package/src/themes/ListItem.css +12 -5
- package/src/themes/MastheadMenu.css +45 -0
- package/src/themes/MastheadMobileMenu.css +45 -0
- package/src/themes/TabNavigation.css +58 -73
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
import { UDExMastheadMobileMenu } from "../support/component-imports.js";
|
|
2
|
+
|
|
3
|
+
// Fixture: category with 3rd-level sub-items
|
|
4
|
+
const categoryWithSubItems = {
|
|
5
|
+
category: "Cloud Products",
|
|
6
|
+
index: 0,
|
|
7
|
+
items: [
|
|
8
|
+
{
|
|
9
|
+
title: "Platform Services",
|
|
10
|
+
url: "",
|
|
11
|
+
externalLink: false,
|
|
12
|
+
subItems: [
|
|
13
|
+
{
|
|
14
|
+
title: "SAP BTP",
|
|
15
|
+
url: "https://example.com/btp",
|
|
16
|
+
externalLink: false,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
title: "SAP Integration Suite",
|
|
20
|
+
url: "https://example.com/integration",
|
|
21
|
+
externalLink: false,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
title: "ERP Solutions",
|
|
27
|
+
url: "",
|
|
28
|
+
externalLink: false,
|
|
29
|
+
subItems: [
|
|
30
|
+
{
|
|
31
|
+
title: "SAP S/4HANA Cloud",
|
|
32
|
+
url: "https://example.com/s4hana",
|
|
33
|
+
externalLink: false,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Fixture: category with only flat items (no subItems)
|
|
41
|
+
const categoryWithoutSubItems = {
|
|
42
|
+
category: "Services",
|
|
43
|
+
index: 0,
|
|
44
|
+
items: [
|
|
45
|
+
{
|
|
46
|
+
title: "Consulting",
|
|
47
|
+
url: "https://example.com/consulting",
|
|
48
|
+
externalLink: false,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
title: "Training",
|
|
52
|
+
url: "https://example.com/training",
|
|
53
|
+
externalLink: false,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Fixture: mixed — one item with subItems, one without
|
|
59
|
+
const categoryMixed = {
|
|
60
|
+
category: "Solutions",
|
|
61
|
+
index: 0,
|
|
62
|
+
items: [
|
|
63
|
+
{
|
|
64
|
+
title: "Cloud Solutions",
|
|
65
|
+
url: "",
|
|
66
|
+
externalLink: false,
|
|
67
|
+
subItems: [
|
|
68
|
+
{
|
|
69
|
+
title: "SAP Analytics Cloud",
|
|
70
|
+
url: "https://example.com/analytics",
|
|
71
|
+
externalLink: false,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
title: "Direct Link Item",
|
|
77
|
+
url: "https://example.com/direct",
|
|
78
|
+
externalLink: false,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Fixture: sub-category parent items all have urls (linked sub-categories)
|
|
84
|
+
const categoryWithLinkedSubCategories = {
|
|
85
|
+
category: "AI Platform",
|
|
86
|
+
index: 0,
|
|
87
|
+
items: [
|
|
88
|
+
{
|
|
89
|
+
title: "Build",
|
|
90
|
+
url: "https://example.com/build",
|
|
91
|
+
externalLink: false,
|
|
92
|
+
subItems: [
|
|
93
|
+
{
|
|
94
|
+
title: "Develop",
|
|
95
|
+
url: "https://example.com/develop",
|
|
96
|
+
externalLink: false,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
title: "Deploy",
|
|
102
|
+
url: "https://example.com/deploy",
|
|
103
|
+
externalLink: false,
|
|
104
|
+
subItems: [
|
|
105
|
+
{
|
|
106
|
+
title: "Staging",
|
|
107
|
+
url: "https://example.com/staging",
|
|
108
|
+
externalLink: false,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
title: "Production",
|
|
112
|
+
url: "https://example.com/production",
|
|
113
|
+
externalLink: false,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// Fixture: mixed linked and unlinked sub-category parents
|
|
121
|
+
const categoryMixedLinkedAndUnlinked = {
|
|
122
|
+
category: "Data Services",
|
|
123
|
+
index: 0,
|
|
124
|
+
items: [
|
|
125
|
+
{
|
|
126
|
+
title: "Integration",
|
|
127
|
+
url: "https://example.com/integration",
|
|
128
|
+
externalLink: false,
|
|
129
|
+
subItems: [
|
|
130
|
+
{
|
|
131
|
+
title: "API Management",
|
|
132
|
+
url: "https://example.com/api-mgmt",
|
|
133
|
+
externalLink: false,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
title: "Analytics",
|
|
139
|
+
url: "",
|
|
140
|
+
externalLink: false,
|
|
141
|
+
subItems: [
|
|
142
|
+
{
|
|
143
|
+
title: "Dashboards",
|
|
144
|
+
url: "https://example.com/dashboards",
|
|
145
|
+
externalLink: false,
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Helper: mount the mobile menu and activate category-items view.
|
|
154
|
+
* Sets _showCategoryItems = true and _category to the provided fixture,
|
|
155
|
+
* which triggers the category-items inline partial template.
|
|
156
|
+
*/
|
|
157
|
+
function mountWithCategoryItems(category: typeof categoryWithSubItems) {
|
|
158
|
+
cy.mount(<UDExMastheadMobileMenu id="mobile-menu" />);
|
|
159
|
+
cy.get("[udex-masthead-mobile-menu]").then(($el) => {
|
|
160
|
+
const el = $el[0] as any;
|
|
161
|
+
el._category = category;
|
|
162
|
+
el._showCategoryItems = true;
|
|
163
|
+
});
|
|
164
|
+
// Wait for re-render after property changes
|
|
165
|
+
cy.get("[udex-masthead-mobile-menu]").shadow().as("shadow");
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
describe("UDExMastheadMobileMenu -- 3rd-level navigation (sub-items)", () => {
|
|
169
|
+
describe("Rendering sub-categories (no url — span)", () => {
|
|
170
|
+
beforeEach(() => {
|
|
171
|
+
mountWithCategoryItems(categoryWithSubItems);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it("renders a .udex-masthead-mobile-menu__sub-category span for each item with subItems", () => {
|
|
175
|
+
cy.get("@shadow")
|
|
176
|
+
.find(".udex-masthead-mobile-menu__sub-category")
|
|
177
|
+
.should("have.length", 2);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it("renders sub-category as a <span> element when the item has no url", () => {
|
|
181
|
+
cy.get("@shadow")
|
|
182
|
+
.find(".udex-masthead-mobile-menu__sub-category")
|
|
183
|
+
.first()
|
|
184
|
+
.should("have.prop", "tagName", "SPAN");
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it("displays the correct title text for each sub-category span", () => {
|
|
188
|
+
cy.get("@shadow")
|
|
189
|
+
.find(".udex-masthead-mobile-menu__sub-category")
|
|
190
|
+
.eq(0)
|
|
191
|
+
.should("have.text", "Platform Services");
|
|
192
|
+
|
|
193
|
+
cy.get("@shadow")
|
|
194
|
+
.find(".udex-masthead-mobile-menu__sub-category")
|
|
195
|
+
.eq(1)
|
|
196
|
+
.should("have.text", "ERP Solutions");
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
describe("Rendering sub-list and sub-items", () => {
|
|
201
|
+
beforeEach(() => {
|
|
202
|
+
mountWithCategoryItems(categoryWithSubItems);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it("renders a .udex-masthead-mobile-menu__sub-list for each item with subItems", () => {
|
|
206
|
+
cy.get("@shadow")
|
|
207
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
208
|
+
.should("have.length", 2);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
it("renders udex-masthead-menu-item elements inside each sub-list with correct count", () => {
|
|
212
|
+
// First sub-list: "Platform Services" has 2 sub-items
|
|
213
|
+
cy.get("@shadow")
|
|
214
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
215
|
+
.eq(0)
|
|
216
|
+
.find("udex-masthead-menu-item")
|
|
217
|
+
.should("have.length", 2);
|
|
218
|
+
|
|
219
|
+
// Second sub-list: "ERP Solutions" has 1 sub-item
|
|
220
|
+
cy.get("@shadow")
|
|
221
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
222
|
+
.eq(1)
|
|
223
|
+
.find("udex-masthead-menu-item")
|
|
224
|
+
.should("have.length", 1);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it("renders the correct label attribute for each sub-item menu-item", () => {
|
|
228
|
+
cy.get("@shadow")
|
|
229
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
230
|
+
.eq(0)
|
|
231
|
+
.find("udex-masthead-menu-item")
|
|
232
|
+
.eq(0)
|
|
233
|
+
.should("have.attr", "label", "SAP BTP");
|
|
234
|
+
|
|
235
|
+
cy.get("@shadow")
|
|
236
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
237
|
+
.eq(0)
|
|
238
|
+
.find("udex-masthead-menu-item")
|
|
239
|
+
.eq(1)
|
|
240
|
+
.should("have.attr", "label", "SAP Integration Suite");
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it("sets the correct url attribute on sub-item menu-items", () => {
|
|
244
|
+
cy.get("@shadow")
|
|
245
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
246
|
+
.eq(0)
|
|
247
|
+
.find("udex-masthead-menu-item")
|
|
248
|
+
.eq(0)
|
|
249
|
+
.should("have.attr", "url", "https://example.com/btp");
|
|
250
|
+
|
|
251
|
+
cy.get("@shadow")
|
|
252
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
253
|
+
.eq(1)
|
|
254
|
+
.find("udex-masthead-menu-item")
|
|
255
|
+
.eq(0)
|
|
256
|
+
.should("have.attr", "url", "https://example.com/s4hana");
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it("sets third-level attribute on sub-item menu-items", () => {
|
|
260
|
+
cy.get("@shadow")
|
|
261
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
262
|
+
.eq(0)
|
|
263
|
+
.find("udex-masthead-menu-item")
|
|
264
|
+
.first()
|
|
265
|
+
.should("have.attr", "third-level");
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// Updated: has-border removed from sub-item menu-items in template
|
|
269
|
+
it("does not set has-border attribute on sub-item menu-items", () => {
|
|
270
|
+
cy.get("@shadow")
|
|
271
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
272
|
+
.eq(0)
|
|
273
|
+
.find("udex-masthead-menu-item")
|
|
274
|
+
.first()
|
|
275
|
+
.should("not.have.attr", "has-border");
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
describe("Sub-list accessibility", () => {
|
|
280
|
+
beforeEach(() => {
|
|
281
|
+
mountWithCategoryItems(categoryWithSubItems);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
it("sets aria-label on the sub-list matching the sub-category title", () => {
|
|
285
|
+
cy.get("@shadow")
|
|
286
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
287
|
+
.eq(0)
|
|
288
|
+
.should("have.attr", "aria-label", "Platform Services");
|
|
289
|
+
|
|
290
|
+
cy.get("@shadow")
|
|
291
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
292
|
+
.eq(1)
|
|
293
|
+
.should("have.attr", "aria-label", "ERP Solutions");
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
it("wraps sub-items in a <ul> element for correct list semantics", () => {
|
|
297
|
+
cy.get("@shadow")
|
|
298
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
299
|
+
.first()
|
|
300
|
+
.should("have.prop", "tagName", "UL");
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
describe("Regression: items without subItems still render directly", () => {
|
|
305
|
+
beforeEach(() => {
|
|
306
|
+
mountWithCategoryItems(categoryWithoutSubItems);
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
it("does not render any .udex-masthead-mobile-menu__sub-category when no items have subItems", () => {
|
|
310
|
+
cy.get("@shadow")
|
|
311
|
+
.find(".udex-masthead-mobile-menu__sub-category")
|
|
312
|
+
.should("not.exist");
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
it("does not render any .udex-masthead-mobile-menu__sub-list when no items have subItems", () => {
|
|
316
|
+
cy.get("@shadow")
|
|
317
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
318
|
+
.should("not.exist");
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
it("renders udex-masthead-menu-item elements directly for flat items", () => {
|
|
322
|
+
cy.get("@shadow")
|
|
323
|
+
.find(".udex-masthead-mobile-menu__list udex-masthead-menu-item[third-level]")
|
|
324
|
+
.should("have.length", 2);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
it("renders the correct labels for flat items", () => {
|
|
328
|
+
cy.get("@shadow")
|
|
329
|
+
.find(".udex-masthead-mobile-menu__list udex-masthead-menu-item[third-level]")
|
|
330
|
+
.eq(0)
|
|
331
|
+
.should("have.attr", "label", "Consulting");
|
|
332
|
+
|
|
333
|
+
cy.get("@shadow")
|
|
334
|
+
.find(".udex-masthead-mobile-menu__list udex-masthead-menu-item[third-level]")
|
|
335
|
+
.eq(1)
|
|
336
|
+
.should("have.attr", "label", "Training");
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
it("renders the correct url for flat items", () => {
|
|
340
|
+
cy.get("@shadow")
|
|
341
|
+
.find(".udex-masthead-mobile-menu__list udex-masthead-menu-item[third-level]")
|
|
342
|
+
.eq(0)
|
|
343
|
+
.should("have.attr", "url", "https://example.com/consulting");
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
describe("Mixed content: items with and without subItems in the same category", () => {
|
|
348
|
+
beforeEach(() => {
|
|
349
|
+
mountWithCategoryItems(categoryMixed);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
it("renders a sub-category span only for the item that has subItems", () => {
|
|
353
|
+
cy.get("@shadow")
|
|
354
|
+
.find(".udex-masthead-mobile-menu__sub-category")
|
|
355
|
+
.should("have.length", 1)
|
|
356
|
+
.and("have.text", "Cloud Solutions");
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
it("renders a sub-list with the correct sub-item for the grouped item", () => {
|
|
360
|
+
cy.get("@shadow")
|
|
361
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
362
|
+
.should("have.length", 1)
|
|
363
|
+
.find("udex-masthead-menu-item")
|
|
364
|
+
.should("have.length", 1)
|
|
365
|
+
.and("have.attr", "label", "SAP Analytics Cloud");
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
it("renders the flat item as a direct udex-masthead-menu-item outside any sub-list", () => {
|
|
369
|
+
// The direct link item sits at top level in the main list, not inside a sub-list
|
|
370
|
+
cy.get("@shadow")
|
|
371
|
+
.find(
|
|
372
|
+
".udex-masthead-mobile-menu__list > li > udex-masthead-menu-item[third-level]"
|
|
373
|
+
)
|
|
374
|
+
.should("have.length", 1)
|
|
375
|
+
.and("have.attr", "label", "Direct Link Item")
|
|
376
|
+
.and("have.attr", "url", "https://example.com/direct");
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
// Updated: linked sub-categories (with url) now have the
|
|
381
|
+
// .udex-masthead-mobile-menu__sub-category class restored. CSS variable
|
|
382
|
+
// remapping is done via the `udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category`
|
|
383
|
+
// rule (no padding/border — those only apply to the span variant).
|
|
384
|
+
describe("Rendering linked sub-categories (item has url + subItems)", () => {
|
|
385
|
+
beforeEach(() => {
|
|
386
|
+
mountWithCategoryItems(categoryWithLinkedSubCategories);
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
// Updated: linked sub-categories now carry the __sub-category class again
|
|
390
|
+
it("renders .udex-masthead-mobile-menu__sub-category for linked items (udex-masthead-menu-item, not span)", () => {
|
|
391
|
+
cy.get("@shadow")
|
|
392
|
+
.find("udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category")
|
|
393
|
+
.should("have.length", 2);
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
it("renders linked sub-category as a udex-masthead-menu-item (not a span) when the item has a url", () => {
|
|
397
|
+
cy.get("@shadow")
|
|
398
|
+
.find("udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category")
|
|
399
|
+
.first()
|
|
400
|
+
.should("have.prop", "tagName")
|
|
401
|
+
.then((tagName: string) => {
|
|
402
|
+
expect(tagName.toLowerCase()).to.include("udex-masthead-menu-item");
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
it("sets the correct label attribute on the linked sub-category", () => {
|
|
407
|
+
cy.get("@shadow")
|
|
408
|
+
.find("udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category")
|
|
409
|
+
.eq(0)
|
|
410
|
+
.should("have.attr", "label", "Build");
|
|
411
|
+
|
|
412
|
+
cy.get("@shadow")
|
|
413
|
+
.find("udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category")
|
|
414
|
+
.eq(1)
|
|
415
|
+
.should("have.attr", "label", "Deploy");
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
it("sets the correct url attribute on the linked sub-category", () => {
|
|
419
|
+
cy.get("@shadow")
|
|
420
|
+
.find("udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category")
|
|
421
|
+
.eq(0)
|
|
422
|
+
.should("have.attr", "url", "https://example.com/build");
|
|
423
|
+
|
|
424
|
+
cy.get("@shadow")
|
|
425
|
+
.find("udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category")
|
|
426
|
+
.eq(1)
|
|
427
|
+
.should("have.attr", "url", "https://example.com/deploy");
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
it("sets the third-level attribute on the linked sub-category", () => {
|
|
431
|
+
cy.get("@shadow")
|
|
432
|
+
.find("udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category")
|
|
433
|
+
.first()
|
|
434
|
+
.should("have.attr", "third-level");
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
// Updated: linked sub-category has the __sub-category class but does NOT
|
|
438
|
+
// have has-border — padding/border styles only apply to the span variant
|
|
439
|
+
it("does not set has-border attribute on the linked sub-category", () => {
|
|
440
|
+
cy.get("@shadow")
|
|
441
|
+
.find("udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category")
|
|
442
|
+
.first()
|
|
443
|
+
.should("not.have.attr", "has-border");
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
it("still renders the sub-list beneath the linked sub-category", () => {
|
|
447
|
+
cy.get("@shadow")
|
|
448
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
449
|
+
.should("have.length", 2);
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it("renders the correct sub-items inside the sub-list of a linked sub-category", () => {
|
|
453
|
+
// First sub-list (under "Build") has 1 sub-item: "Develop"
|
|
454
|
+
cy.get("@shadow")
|
|
455
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
456
|
+
.eq(0)
|
|
457
|
+
.find("udex-masthead-menu-item")
|
|
458
|
+
.should("have.length", 1)
|
|
459
|
+
.and("have.attr", "label", "Develop");
|
|
460
|
+
|
|
461
|
+
// Second sub-list (under "Deploy") has 2 sub-items: "Staging", "Production"
|
|
462
|
+
cy.get("@shadow")
|
|
463
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
464
|
+
.eq(1)
|
|
465
|
+
.find("udex-masthead-menu-item")
|
|
466
|
+
.should("have.length", 2);
|
|
467
|
+
|
|
468
|
+
cy.get("@shadow")
|
|
469
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
470
|
+
.eq(1)
|
|
471
|
+
.find("udex-masthead-menu-item")
|
|
472
|
+
.eq(0)
|
|
473
|
+
.should("have.attr", "label", "Staging");
|
|
474
|
+
|
|
475
|
+
cy.get("@shadow")
|
|
476
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
477
|
+
.eq(1)
|
|
478
|
+
.find("udex-masthead-menu-item")
|
|
479
|
+
.eq(1)
|
|
480
|
+
.should("have.attr", "label", "Production");
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
it("preserves aria-label on the sub-list matching the linked sub-category title", () => {
|
|
484
|
+
cy.get("@shadow")
|
|
485
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
486
|
+
.eq(0)
|
|
487
|
+
.should("have.attr", "aria-label", "Build");
|
|
488
|
+
|
|
489
|
+
cy.get("@shadow")
|
|
490
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
491
|
+
.eq(1)
|
|
492
|
+
.should("have.attr", "aria-label", "Deploy");
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
describe("Mixed linked and unlinked sub-categories in the same category", () => {
|
|
497
|
+
beforeEach(() => {
|
|
498
|
+
mountWithCategoryItems(categoryMixedLinkedAndUnlinked);
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
// Updated: linked sub-category now has the __sub-category class restored;
|
|
502
|
+
// target it via udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category
|
|
503
|
+
it("renders the linked sub-category as a udex-masthead-menu-item with __sub-category class", () => {
|
|
504
|
+
// "Integration" has a url — should be a menu-item with the class
|
|
505
|
+
cy.get("@shadow")
|
|
506
|
+
.find(
|
|
507
|
+
"udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category"
|
|
508
|
+
)
|
|
509
|
+
.should("have.length", 1)
|
|
510
|
+
.and("have.attr", "label", "Integration")
|
|
511
|
+
.and("have.attr", "url", "https://example.com/integration");
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
it("renders the unlinked sub-category as a span", () => {
|
|
515
|
+
// "Analytics" has no url — should be a span
|
|
516
|
+
cy.get("@shadow")
|
|
517
|
+
.find("span.udex-masthead-mobile-menu__sub-category")
|
|
518
|
+
.should("have.length", 1)
|
|
519
|
+
.and("have.text", "Analytics");
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
// Updated: both linked and unlinked sub-categories now have __sub-category class
|
|
523
|
+
it("renders two .udex-masthead-mobile-menu__sub-category elements (one linked, one unlinked)", () => {
|
|
524
|
+
cy.get("@shadow")
|
|
525
|
+
.find(".udex-masthead-mobile-menu__sub-category")
|
|
526
|
+
.should("have.length", 2);
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
it("renders sub-lists for both linked and unlinked sub-categories", () => {
|
|
530
|
+
cy.get("@shadow")
|
|
531
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
532
|
+
.should("have.length", 2);
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
it("renders the linked sub-category's sub-item correctly", () => {
|
|
536
|
+
cy.get("@shadow")
|
|
537
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
538
|
+
.eq(0)
|
|
539
|
+
.find("udex-masthead-menu-item")
|
|
540
|
+
.should("have.length", 1)
|
|
541
|
+
.and("have.attr", "label", "API Management")
|
|
542
|
+
.and("have.attr", "url", "https://example.com/api-mgmt");
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
it("renders the unlinked sub-category's sub-item correctly", () => {
|
|
546
|
+
cy.get("@shadow")
|
|
547
|
+
.find(".udex-masthead-mobile-menu__sub-list")
|
|
548
|
+
.eq(1)
|
|
549
|
+
.find("udex-masthead-menu-item")
|
|
550
|
+
.should("have.length", 1)
|
|
551
|
+
.and("have.attr", "label", "Dashboards")
|
|
552
|
+
.and("have.attr", "url", "https://example.com/dashboards");
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
// Updated: linked sub-category has __sub-category class but NOT has-border;
|
|
556
|
+
// padding/border styles only apply to the span variant via CSS rule split
|
|
557
|
+
it("sets third-level but not has-border on the linked sub-category menu-item", () => {
|
|
558
|
+
cy.get("@shadow")
|
|
559
|
+
.find(
|
|
560
|
+
"udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category"
|
|
561
|
+
)
|
|
562
|
+
.first()
|
|
563
|
+
.should("have.attr", "third-level");
|
|
564
|
+
|
|
565
|
+
cy.get("@shadow")
|
|
566
|
+
.find(
|
|
567
|
+
"udex-masthead-menu-item.udex-masthead-mobile-menu__sub-category"
|
|
568
|
+
)
|
|
569
|
+
.first()
|
|
570
|
+
.should("not.have.attr", "has-border");
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
});
|