Skip to content

Commit 42254d8

Browse files
authored
fix(ui5-breadcrumbs): correct missing label for single breadcrumb (#4578)
Add the missing label of breadcrumbs with a single item. Fixes #4565
1 parent fb40514 commit 42254d8

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

packages/main/src/Breadcrumbs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ class Breadcrumbs extends UI5Element {
434434

435435
_hasVisibleContent(item) {
436436
// the check is not complete but may be extended in the future if needed to cover
437-
// cases becides the standard (UX-recommended) ones
437+
// cases besides the standard (UX-recommended) ones
438438
return item.innerText || Array.from(item.children).some(child => !child.hidden);
439439
}
440440

@@ -454,7 +454,7 @@ class Breadcrumbs extends UI5Element {
454454

455455
get _currentLocationText() {
456456
const items = this.getSlottedNodes("items");
457-
if (this._endsWithCurrentLocationLabel && items.length > 1) {
457+
if (this._endsWithCurrentLocationLabel && items.length) {
458458
const item = items[items.length - 1];
459459
if (this._isItemVisible(item)) {
460460
return item.innerText;

packages/main/test/pages/Breadcrumbs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ <h2>Empty Breadcrumbs</h2>
139139

140140
<div class="breadcrumbs9auto">
141141
<h2>Empty Breadcrumbs with Location only</h2>
142-
<ui5-breadcrumbs>
142+
<ui5-breadcrumbs id="breadcrumbsWithSingleItem">
143143
<ui5-breadcrumbs-item>Location</ui5-breadcrumbs-item>
144144
</ui5-breadcrumbs>
145145
</div>

packages/main/test/specs/Breadcrumbs.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ describe("Breadcrumbs general interaction", () => {
140140
assert.strictEqual(await breadcrumbs.getProperty("_overflowSize"), expectedCountItemsInOverflowAfter, "a link is added to the overflow");
141141
});
142142

143+
it("standard breadcrumb with single item shows location", async () => {
144+
const breadcrumbs = await browser.$("#breadcrumbsWithSingleItem"),
145+
label = (await breadcrumbs.shadow$("ui5-label"));
146+
147+
// Check
148+
assert.strictEqual(await label.getText(), "Location", "label is displayed");
149+
});
150+
143151
it("opens upon space", async () => {
144152
await browser.url(`http://localhost:${PORT}/test-resources/pages/Breadcrumbs.html`);
145153

packages/theming/hash.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rZnyMTmoc2CFM82C+7zGHcw3GGY=
1+
CQhk8M6oN0XzkZBkgImthR2kdTs=

0 commit comments

Comments
 (0)