@sapudex/web-components 2.31.0 → 2.32.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/specs/Breadcrumbs.cy.tsx +26 -0
- package/cypress/specs/MediaPlayer.cy.tsx +209 -0
- package/cypress/specs/SecondaryNavigationDesktop.cy.tsx +74 -21
- package/cypress/specs/SecondaryNavigationMobile.cy.tsx +58 -1
- package/cypress/specs/TabNavigation.cy.tsx +603 -39
- package/cypress/support/component-imports.instrumented.ts +2 -0
- package/cypress/support/component-imports.src.ts +2 -0
- package/dist/Breadcrumbs.d.ts +5 -0
- package/dist/Breadcrumbs.js +8 -1
- package/dist/Breadcrumbs.js.map +1 -1
- package/dist/MastheadItem.js +5 -4
- package/dist/MastheadItem.js.map +1 -1
- package/dist/MediaPlayer.d.ts +15 -0
- package/dist/MediaPlayer.js +28 -0
- package/dist/MediaPlayer.js.map +1 -1
- package/dist/SecondaryNavigation.d.ts +12 -2
- package/dist/SecondaryNavigation.js +59 -8
- package/dist/SecondaryNavigation.js.map +1 -1
- package/dist/SecondaryNavigationItem.d.ts +0 -1
- package/dist/SecondaryNavigationItem.js +0 -4
- package/dist/SecondaryNavigationItem.js.map +1 -1
- package/dist/SecondaryNavigationSubItem.js +1 -1
- package/dist/SecondaryNavigationSubItem.js.map +1 -1
- package/dist/Tab.d.ts +1 -1
- package/dist/Tab.js +3 -3
- package/dist/Tab.js.map +1 -1
- package/dist/TabNavigation.d.ts +64 -0
- package/dist/TabNavigation.js +124 -1
- package/dist/TabNavigation.js.map +1 -1
- package/dist/assets/{InputSuggestions-i2kFpCfC.js → InputSuggestions-CHLLTki3.js} +1 -1
- package/dist/assets/{ListItemStandardExpandableTextTemplate-C1ceDaxu.js → ListItemStandardExpandableTextTemplate-vM1eIFe4.js} +1 -1
- package/dist/assets/{bundle.esm-DQ3cxywT.js → bundle.esm-fUZ1I3qm.js} +219 -219
- package/dist/assets/messagebundle_en-iNqRB1VZ.js +1 -0
- package/dist/css/themes/BreadcrumbsPopover.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 +375 -154
- package/dist/custom-elements.json +288 -139
- package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
- package/dist/generated/i18n/i18n-defaults.js +1 -1
- package/dist/generated/i18n/i18n-defaults.js.map +1 -1
- package/dist/generated/templates/SecondaryNavigationTemplate.lit.js +1 -1
- package/dist/generated/templates/SecondaryNavigationTemplate.lit.js.map +1 -1
- package/dist/generated/templates/TabNavigationTemplate.lit.js +10 -8
- package/dist/generated/templates/TabNavigationTemplate.lit.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/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/messagebundle.properties +1 -1
- package/dist/messagebundle_en.properties +1 -1
- package/dist/vscode.html-custom-data.json +23 -3
- package/dist/web-types.json +64 -4
- package/package.json +1 -1
- package/src/Breadcrumbs.ts +9 -1
- package/src/MastheadItem.ts +5 -4
- package/src/MediaPlayer.ts +35 -0
- package/src/SecondaryNavigation.hbs +1 -0
- package/src/SecondaryNavigation.ts +77 -9
- package/src/SecondaryNavigationItem.ts +0 -6
- package/src/SecondaryNavigationSubItem.ts +1 -1
- package/src/Tab.ts +4 -4
- package/src/TabNavigation.hbs +15 -0
- package/src/TabNavigation.ts +134 -1
- package/src/generated/i18n/i18n-defaults.ts +1 -1
- package/src/generated/templates/SecondaryNavigationTemplate.lit.ts +1 -1
- package/src/generated/templates/TabNavigationTemplate.lit.ts +10 -8
- package/src/generated/themes/BreadcrumbsPopover.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/i18n/messagebundle.properties +1 -1
- package/src/i18n/messagebundle_en.properties +1 -1
- package/src/themes/BreadcrumbsPopover.css +2 -2
- package/src/themes/TabNavigation.css +27 -16
- package/dist/assets/messagebundle_en-DWAgV5VH.js +0 -1
|
@@ -46,6 +46,32 @@ describe("Breadcrumbs", () => {
|
|
|
46
46
|
cy.mount(breadcrumbs);
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
+
describe("item-click event source", () => {
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
const itemClickHandler = cy.stub().as("itemClickHandler");
|
|
52
|
+
cy.get("#breadcrumbs").then($breadcrumbs => {
|
|
53
|
+
$breadcrumbs[0].addEventListener("item-click", itemClickHandler);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("fires item-click with source 'main' when clicking a visible breadcrumb link", () => {
|
|
58
|
+
cy.get("#breadcrumbs").shadow().find("[udex-link].udex-breadcrumbs__item--visible").first().click();
|
|
59
|
+
cy.get("@itemClickHandler")
|
|
60
|
+
.should("have.been.called")
|
|
61
|
+
.its("lastCall.args.0.detail.source")
|
|
62
|
+
.should("equal", "main");
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("fires item-click with source 'dropdown' when clicking an item inside the dropdown", () => {
|
|
66
|
+
cy.get("#breadcrumbs").shadow().find(".udex-breadcrumbs__trigger").click();
|
|
67
|
+
cy.get("#breadcrumbs").shadow().find("[udex-link].udex-breadcrumbs__item--hidden").first().click();
|
|
68
|
+
cy.get("@itemClickHandler")
|
|
69
|
+
.should("have.been.called")
|
|
70
|
+
.its("lastCall.args.0.detail.source")
|
|
71
|
+
.should("equal", "dropdown");
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
49
75
|
it("tests if web component is correctly rendered", () => {
|
|
50
76
|
cy.get("#breadcrumbs").shadow().find(".ui5-breadcrumbs-root").should("be.visible");
|
|
51
77
|
});
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { UDExMediaPlayer } from "../support/component-imports.js";
|
|
2
|
+
|
|
3
|
+
// A real video source is not needed for plugin tests — VideoJS initialises
|
|
4
|
+
// its player regardless of whether the source resolves, so we use a
|
|
5
|
+
// lightweight placeholder that avoids network requests in CI.
|
|
6
|
+
const BLANK_SOURCE = "about:blank";
|
|
7
|
+
const BLANK_TYPE = "video/mp4";
|
|
8
|
+
|
|
9
|
+
const basicPlayer = (
|
|
10
|
+
<UDExMediaPlayer
|
|
11
|
+
id="test-media-player"
|
|
12
|
+
source={BLANK_SOURCE}
|
|
13
|
+
type={BLANK_TYPE}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
describe("MediaPlayer — custom plugin support", () => {
|
|
18
|
+
describe("videojsReady event", () => {
|
|
19
|
+
it("fires before the player is created", () => {
|
|
20
|
+
// Attach a window-level listener BEFORE mounting so we never miss the
|
|
21
|
+
// event regardless of how quickly the videojs import resolves.
|
|
22
|
+
// videojsReady has bubbles:true so it reaches the window.
|
|
23
|
+
let playerExistedAtEventTime = true; // pessimistic default
|
|
24
|
+
|
|
25
|
+
cy.window().then((win) => {
|
|
26
|
+
win.addEventListener("videojsReady", (e: Event) => {
|
|
27
|
+
const el = (e as CustomEvent).target as any;
|
|
28
|
+
playerExistedAtEventTime = !!el?.player;
|
|
29
|
+
}, { once: true });
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
cy.mount(basicPlayer);
|
|
33
|
+
|
|
34
|
+
// Wait for the player to eventually be created, then verify the captured
|
|
35
|
+
// flag shows the player did NOT exist when the event fired.
|
|
36
|
+
cy.get("#test-media-player").should(() => {
|
|
37
|
+
expect(
|
|
38
|
+
(Cypress.$("#test-media-player")[0] as any).player,
|
|
39
|
+
"player should be created after videojsReady"
|
|
40
|
+
).to.exist;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
cy.then(() => {
|
|
44
|
+
expect(playerExistedAtEventTime, "player.player must be null when videojsReady fires").to.be.false;
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("provides the videojs constructor in event detail", () => {
|
|
49
|
+
let capturedVideojs: any = null;
|
|
50
|
+
|
|
51
|
+
cy.window().then((win) => {
|
|
52
|
+
win.addEventListener("videojsReady", (e: Event) => {
|
|
53
|
+
capturedVideojs = (e as CustomEvent).detail.videojs;
|
|
54
|
+
}, { once: true });
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
cy.mount(basicPlayer);
|
|
58
|
+
|
|
59
|
+
cy.get("#test-media-player").should(() => {
|
|
60
|
+
expect(capturedVideojs, "videojs must be received in event detail").to.be.a("function");
|
|
61
|
+
expect(capturedVideojs.registerPlugin).to.be.a("function");
|
|
62
|
+
expect(capturedVideojs.getPlugin).to.be.a("function");
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("allows registering a plugin that is available on the player", () => {
|
|
67
|
+
cy.window().then((win) => {
|
|
68
|
+
win.addEventListener("videojsReady", (e: Event) => {
|
|
69
|
+
const videojs = (e as CustomEvent).detail.videojs;
|
|
70
|
+
videojs.registerPlugin("eventListenerPlugin", function (this: any) {
|
|
71
|
+
this.addClass("plugin-applied");
|
|
72
|
+
});
|
|
73
|
+
}, { once: true });
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
cy.mount(
|
|
77
|
+
<UDExMediaPlayer
|
|
78
|
+
id="plugin-player"
|
|
79
|
+
source={BLANK_SOURCE}
|
|
80
|
+
type={BLANK_TYPE}
|
|
81
|
+
options={JSON.stringify({ plugins: { eventListenerPlugin: {} } })}
|
|
82
|
+
/>,
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
// hasPlugin() returns true once the plugin has been registered on the
|
|
86
|
+
// videojs constructor — it does not require the player to be created yet.
|
|
87
|
+
cy.get("#plugin-player").should(() => {
|
|
88
|
+
const el = Cypress.$("#plugin-player")[0] as any;
|
|
89
|
+
expect(el.player?.hasPlugin("eventListenerPlugin")).to.be.true;
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe("registerPlugin() method", () => {
|
|
95
|
+
it("stores plugins in _pendingPlugins before rendering", () => {
|
|
96
|
+
cy.document().then((doc) => {
|
|
97
|
+
const el = doc.createElement("udex-media-player") as any;
|
|
98
|
+
el.id = "pre-register-player";
|
|
99
|
+
// Register BEFORE appending to DOM (before onAfterRendering fires).
|
|
100
|
+
el.registerPlugin("storedPlugin", () => {});
|
|
101
|
+
expect(el._pendingPlugins).to.have.length(1);
|
|
102
|
+
expect(el._pendingPlugins[0].name).to.equal("storedPlugin");
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("applies pending plugins to videojs before creating the player", () => {
|
|
107
|
+
let pluginWasRegistered = false;
|
|
108
|
+
|
|
109
|
+
// Use window listener to capture videojsReady and check registration.
|
|
110
|
+
cy.window().then((win) => {
|
|
111
|
+
win.addEventListener("videojsReady", (e: Event) => {
|
|
112
|
+
const videojs = (e as CustomEvent).detail.videojs;
|
|
113
|
+
// If registerPlugin() worked, the plugin was registered on the
|
|
114
|
+
// constructor before this event fired.
|
|
115
|
+
pluginWasRegistered = typeof videojs.getPlugin("prePlugin") === "function";
|
|
116
|
+
}, { once: true });
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
cy.document().then((doc) => {
|
|
120
|
+
const el = doc.createElement("udex-media-player") as any;
|
|
121
|
+
el.id = "pre-mount-player";
|
|
122
|
+
el.source = BLANK_SOURCE;
|
|
123
|
+
el.type = BLANK_TYPE;
|
|
124
|
+
el.registerPlugin("prePlugin", () => {});
|
|
125
|
+
doc.body.appendChild(el);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
cy.get("#pre-mount-player").should(() => {
|
|
129
|
+
expect(pluginWasRegistered, "plugin must be on videojs constructor when videojsReady fires").to.be.true;
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("clears _pendingPlugins after applying them", () => {
|
|
134
|
+
cy.mount(basicPlayer);
|
|
135
|
+
|
|
136
|
+
// Add a plugin after mount (will be applied on next render cycle or
|
|
137
|
+
// persists until next onAfterRendering — here we just verify the array
|
|
138
|
+
// is empty once initialization is complete).
|
|
139
|
+
cy.get("#test-media-player").should(() => {
|
|
140
|
+
const el = Cypress.$("#test-media-player")[0] as any;
|
|
141
|
+
// After first onAfterRendering, _pendingPlugins must be cleared.
|
|
142
|
+
expect(el._pendingPlugins, "_pendingPlugins must be empty after init").to.have.length(0);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
describe("enableGlobalDependency interaction", () => {
|
|
148
|
+
it("exposes window.videojs and still fires videojsReady", () => {
|
|
149
|
+
let videojsReadyFired = false;
|
|
150
|
+
|
|
151
|
+
cy.window().then((win) => {
|
|
152
|
+
win.addEventListener("videojsReady", () => {
|
|
153
|
+
videojsReadyFired = true;
|
|
154
|
+
}, { once: true });
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
cy.mount(
|
|
158
|
+
<UDExMediaPlayer
|
|
159
|
+
id="global-dep-player"
|
|
160
|
+
source={BLANK_SOURCE}
|
|
161
|
+
type={BLANK_TYPE}
|
|
162
|
+
enableGlobalDependency
|
|
163
|
+
/>,
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
cy.window().should((win) => {
|
|
167
|
+
expect((win as any).videojs, "window.videojs must be set").to.be.a("function");
|
|
168
|
+
expect(videojsReadyFired, "videojsReady must have fired").to.be.true;
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
describe("backward compatibility", () => {
|
|
174
|
+
it("renders the video-js element without any custom plugins", () => {
|
|
175
|
+
cy.mount(basicPlayer);
|
|
176
|
+
|
|
177
|
+
cy.get("#test-media-player")
|
|
178
|
+
.shadow()
|
|
179
|
+
.find(".video-js")
|
|
180
|
+
.should("exist");
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("still fires videoReady after custom plugin setup", () => {
|
|
184
|
+
const videoReadyStub = cy.stub().as("videoReady");
|
|
185
|
+
|
|
186
|
+
// Attach both listeners before mounting — videoReady has bubbles:true
|
|
187
|
+
// so it reaches the window. Attaching after cy.mount() risks missing
|
|
188
|
+
// the event if the player's ready callback resolves first.
|
|
189
|
+
cy.window().then((win) => {
|
|
190
|
+
win.addEventListener("videojsReady", (e: Event) => {
|
|
191
|
+
const videojs = (e as CustomEvent).detail.videojs;
|
|
192
|
+
videojs.registerPlugin("compatPlugin", function (this: any) {});
|
|
193
|
+
}, { once: true });
|
|
194
|
+
|
|
195
|
+
win.addEventListener("videoReady", videoReadyStub, { once: true });
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
cy.mount(
|
|
199
|
+
<UDExMediaPlayer
|
|
200
|
+
id="compat-player"
|
|
201
|
+
source={BLANK_SOURCE}
|
|
202
|
+
type={BLANK_TYPE}
|
|
203
|
+
/>,
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
cy.get("@videoReady").should("have.been.calledOnce");
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
});
|
|
@@ -262,29 +262,37 @@ describe("Desktop", () => {
|
|
|
262
262
|
cy.get("#secondary-nav-without-breadcrumbs").shadow().find("div").first().should("have.attr", "class", rootClass)
|
|
263
263
|
});
|
|
264
264
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
265
|
+
it("emits empty analyticsPath when clicking a top-level item without sub-items", () => {
|
|
266
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").eq(2).click();
|
|
267
|
+
cy.get("@itemClickHandler").should("have.been.called")
|
|
268
|
+
.its("lastCall.args.0.detail.analyticsPath").should("deep.equal", ["Secondary Navigation 3"]);
|
|
269
|
+
});
|
|
270
270
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
.should("have.attr", "data-horizontal-align", "right")
|
|
277
|
-
});
|
|
271
|
+
it("emits analyticsPath with only the item title when clicking a top-level item with sub-items", () => {
|
|
272
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click();
|
|
273
|
+
cy.get("@itemClickHandler").should("have.been.called")
|
|
274
|
+
.its("lastCall.args.0.detail.analyticsPath").should("deep.equal", ["Secondary Navigation 1"]);
|
|
275
|
+
});
|
|
278
276
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
277
|
+
it("emits analyticsPath with parent and sub-item titles when clicking a sub-item", () => {
|
|
278
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click();
|
|
279
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
280
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(1).click();
|
|
281
|
+
cy.get("@itemClickHandler").should("have.been.called")
|
|
282
|
+
.its("lastCall.args.0.detail.analyticsPath").should("deep.equal", ["Secondary Navigation 1", "secondary nested 2"]);
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
it("emits analyticsPath with full ancestor chain when clicking a deeply nested sub-item", () => {
|
|
286
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click();
|
|
287
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
288
|
+
.shadow().find("udex-secondary-navigation-sub-item").first().click();
|
|
289
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
290
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(2).click();
|
|
291
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
292
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(1).click();
|
|
293
|
+
cy.get("@itemClickHandler").should("have.been.called")
|
|
294
|
+
.its("lastCall.args.0.detail.analyticsPath").should("deep.equal", ["Secondary Navigation 1", "secondary nested 1", "tertiary nested 2", "quaternary nested 1"]);
|
|
295
|
+
});
|
|
288
296
|
|
|
289
297
|
it("closes dropdown and focuses buy now button", () => {
|
|
290
298
|
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click()
|
|
@@ -362,4 +370,49 @@ describe("Desktop", () => {
|
|
|
362
370
|
|
|
363
371
|
cy.get("@itemClickHandler").should("have.been.called").its("lastCall.args.0.detail.clickedItem").should("include",{ title: "secondary nested 2", path: "#secondary_nested_2"})
|
|
364
372
|
});
|
|
373
|
+
|
|
374
|
+
it("emits isMore: true when clicking the More button", () => {
|
|
375
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").eq(6).click();
|
|
376
|
+
cy.get("@itemClickHandler").should("have.been.called")
|
|
377
|
+
.its("lastCall.args.0.detail.isMore").should("be.true");
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
it("emits isMore: true when clicking an overflow item from the More dropdown", () => {
|
|
381
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").eq(6).click();
|
|
382
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").eq(6)
|
|
383
|
+
.shadow().find("udex-secondary-navigation-sub-item").first().click();
|
|
384
|
+
cy.get("@itemClickHandler").should("have.been.called")
|
|
385
|
+
.its("lastCall.args.0.detail.isMore").should("be.true");
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
it("does not emit isMore when clicking a regular item", () => {
|
|
389
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").eq(2).click();
|
|
390
|
+
cy.get("@itemClickHandler").should("have.been.called")
|
|
391
|
+
.its("lastCall.args.0.detail").should("not.have.property", "isMore");
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
describe("Direction attributes", () => {
|
|
395
|
+
beforeEach(() => {
|
|
396
|
+
cy.mount(secondaryNavigationWithoutBreadcrumbs)
|
|
397
|
+
cy.viewport(1080, 640);
|
|
398
|
+
})
|
|
399
|
+
|
|
400
|
+
// TODO: Fix tests in scope https://github.tools.sap/sapudex/digital-design-system/issues/2989
|
|
401
|
+
xit("has the attr \"data-horizontal-align=`right`\" when doesn't fit", () => {
|
|
402
|
+
cy.get("#secondary-nav-without-breadcrumbs").shadow().find("[udex-secondary-navigation-item]").eq(5).click();
|
|
403
|
+
cy.get("#secondary-nav-without-breadcrumbs").shadow().find("[udex-secondary-navigation-item]").eq(5)
|
|
404
|
+
.shadow().find(".udex-secondary-navigation__dropdown", { timeout: 5000 })
|
|
405
|
+
.should("be.visible")
|
|
406
|
+
.should("have.attr", "data-horizontal-align", "right")
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
xit("has the attr \"data-horizontal-align=`left`\" when doesn't fit in the \"rtl\" mode", () => {
|
|
410
|
+
cy.get("body").invoke("attr", "dir", "rtl");
|
|
411
|
+
cy.get("#secondary-nav-without-breadcrumbs").shadow().find("[udex-secondary-navigation-item]").eq(5).click();
|
|
412
|
+
cy.get("#secondary-nav-without-breadcrumbs").shadow().find("[udex-secondary-navigation-item]").eq(5)
|
|
413
|
+
.shadow()
|
|
414
|
+
.find(".udex-secondary-navigation__dropdown")
|
|
415
|
+
.should("have.attr", "data-horizontal-align", "left")
|
|
416
|
+
});
|
|
417
|
+
})
|
|
365
418
|
});
|
|
@@ -78,5 +78,62 @@ describe("SecondaryNavigation", () => {
|
|
|
78
78
|
const subTitle = cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").shadow().find(".udex-secondary-navigation__item-sub-title");
|
|
79
79
|
subTitle.should("have.text", "Secondary Navigation 3 mobile");
|
|
80
80
|
});
|
|
81
|
+
|
|
82
|
+
describe("analyticsPath", () => {
|
|
83
|
+
beforeEach(() => {
|
|
84
|
+
const itemClickHandler = cy.stub().as("itemClickHandler");
|
|
85
|
+
cy.get("#secondary-nav").then($navigation => {
|
|
86
|
+
$navigation[0].addEventListener("item-click", itemClickHandler);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("uses mobileLinkTitle in analyticsPath when clicking a top-level item", () => {
|
|
91
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").click();
|
|
92
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav")
|
|
93
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(2).click();
|
|
94
|
+
cy.get("@itemClickHandler").should("have.been.called")
|
|
95
|
+
.its("lastCall.args.0.detail.analyticsPath").should("deep.equal", ["Secondary Navigation 3 mobile"]);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("uses title in analyticsPath when mobileLinkTitle is absent", () => {
|
|
99
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").click();
|
|
100
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav")
|
|
101
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(1).click();
|
|
102
|
+
cy.get("@itemClickHandler").should("have.been.called")
|
|
103
|
+
.its("lastCall.args.0.detail.analyticsPath").should("deep.equal", ["Secondary Navigation 2"]);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe("mobile-menu-opener-click event", () => {
|
|
108
|
+
beforeEach(() => {
|
|
109
|
+
const mobileMenuOpenerClickHandler = cy.stub().as("mobileMenuOpenerClickHandler");
|
|
110
|
+
cy.get("#secondary-nav").then($navigation => {
|
|
111
|
+
$navigation[0].addEventListener("mobile-menu-opener-click", mobileMenuOpenerClickHandler);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("fires when the mobile menu opener is clicked", () => {
|
|
116
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").click();
|
|
117
|
+
cy.get("@mobileMenuOpenerClickHandler").should("have.been.calledOnce");
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it("event detail contains analyticsName", () => {
|
|
121
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").click();
|
|
122
|
+
cy.get("@mobileMenuOpenerClickHandler").should("have.been.called")
|
|
123
|
+
.its("lastCall.args.0.detail.analyticsName").should("equal", "header-sub");
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("event detail contains sourceNode", () => {
|
|
127
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").click();
|
|
128
|
+
cy.get("@mobileMenuOpenerClickHandler").should("have.been.called")
|
|
129
|
+
.its("lastCall.args.0.detail.sourceNode").should("exist");
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it("event detail contains originalEvent", () => {
|
|
133
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").click();
|
|
134
|
+
cy.get("@mobileMenuOpenerClickHandler").should("have.been.called")
|
|
135
|
+
.its("lastCall.args.0.detail.originalEvent").should("exist");
|
|
136
|
+
});
|
|
137
|
+
});
|
|
81
138
|
});
|
|
82
|
-
})
|
|
139
|
+
})
|