Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui5-breadcrumbs): correct missing label for single breadcrumb #4578

Merged
merged 3 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/base/hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0KpYdce4OrU70VpvAgA0qr2FulM=
6YiE/tv+O4z5p0flJGMvfbR+4jo=
4 changes: 2 additions & 2 deletions packages/main/src/Breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/main/test/pages/Breadcrumbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ <h2>Empty Breadcrumbs</h2>

<div class="breadcrumbs9auto">
<h2>Empty Breadcrumbs with Location only</h2>
<ui5-breadcrumbs>
<ui5-breadcrumbs id="breadcrumbsWithSingleItem">
<ui5-breadcrumbs-item>Location</ui5-breadcrumbs-item>
</ui5-breadcrumbs>
</div>
Expand Down
8 changes: 8 additions & 0 deletions packages/main/test/specs/Breadcrumbs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);

Expand Down
2 changes: 1 addition & 1 deletion packages/theming/hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rZnyMTmoc2CFM82C+7zGHcw3GGY=
CQhk8M6oN0XzkZBkgImthR2kdTs=