From 42254d8822ca3cfe67a5cdc77dba0b32bda05903 Mon Sep 17 00:00:00 2001 From: Diana Pazheva Date: Mon, 17 Jan 2022 10:08:38 +0200 Subject: [PATCH] fix(ui5-breadcrumbs): correct missing label for single breadcrumb (#4578) Add the missing label of breadcrumbs with a single item. Fixes #4565 --- packages/main/src/Breadcrumbs.js | 4 ++-- packages/main/test/pages/Breadcrumbs.html | 2 +- packages/main/test/specs/Breadcrumbs.spec.js | 8 ++++++++ packages/theming/hash.txt | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/main/src/Breadcrumbs.js b/packages/main/src/Breadcrumbs.js index b5cbaeb0c0c8..4de04563cb06 100644 --- a/packages/main/src/Breadcrumbs.js +++ b/packages/main/src/Breadcrumbs.js @@ -434,7 +434,7 @@ class Breadcrumbs extends UI5Element { _hasVisibleContent(item) { // the check is not complete but may be extended in the future if needed to cover - // cases becides the standard (UX-recommended) ones + // cases besides the standard (UX-recommended) ones return item.innerText || Array.from(item.children).some(child => !child.hidden); } @@ -454,7 +454,7 @@ class Breadcrumbs extends UI5Element { get _currentLocationText() { const items = this.getSlottedNodes("items"); - if (this._endsWithCurrentLocationLabel && items.length > 1) { + if (this._endsWithCurrentLocationLabel && items.length) { const item = items[items.length - 1]; if (this._isItemVisible(item)) { return item.innerText; diff --git a/packages/main/test/pages/Breadcrumbs.html b/packages/main/test/pages/Breadcrumbs.html index 0df5f8bd16b8..554d33ce8f41 100644 --- a/packages/main/test/pages/Breadcrumbs.html +++ b/packages/main/test/pages/Breadcrumbs.html @@ -139,7 +139,7 @@

Empty Breadcrumbs

diff --git a/packages/main/test/specs/Breadcrumbs.spec.js b/packages/main/test/specs/Breadcrumbs.spec.js index 56821f8562d7..3b4db91aee8b 100644 --- a/packages/main/test/specs/Breadcrumbs.spec.js +++ b/packages/main/test/specs/Breadcrumbs.spec.js @@ -140,6 +140,14 @@ describe("Breadcrumbs general interaction", () => { assert.strictEqual(await breadcrumbs.getProperty("_overflowSize"), expectedCountItemsInOverflowAfter, "a link is added to the overflow"); }); + it("standard breadcrumb with single item shows location", async () => { + const breadcrumbs = await browser.$("#breadcrumbsWithSingleItem"), + label = (await breadcrumbs.shadow$("ui5-label")); + + // Check + assert.strictEqual(await label.getText(), "Location", "label is displayed"); + }); + it("opens upon space", async () => { await browser.url(`http://localhost:${PORT}/test-resources/pages/Breadcrumbs.html`); diff --git a/packages/theming/hash.txt b/packages/theming/hash.txt index 1211e6a6a47a..e933b8077c92 100644 --- a/packages/theming/hash.txt +++ b/packages/theming/hash.txt @@ -1 +1 @@ -rZnyMTmoc2CFM82C+7zGHcw3GGY= \ No newline at end of file +CQhk8M6oN0XzkZBkgImthR2kdTs= \ No newline at end of file