Skip to content

Commit 546f0fb

Browse files
fix(ui5-combobox): prevent whitespace below value state when no items are present (#12218)
fix(ui5-combobox): prevent whitespace below value state when no items present
1 parent bd9299e commit 546f0fb

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

packages/main/cypress/specs/ComboBox.cy.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,29 @@ describe("General Interaction", () => {
395395
.find(".ui5-li-title")
396396
.should("have.text", "I #1");
397397
});
398+
399+
it("should not render ComboBox items list when no items are present", () => {
400+
cy.mount(
401+
<ComboBox valueState="Negative" open>
402+
{/* No ComboBox items */}
403+
</ComboBox>
404+
);
405+
406+
cy.get("[ui5-combobox]")
407+
.as("combo")
408+
.shadow()
409+
.find("ui5-responsive-popover")
410+
.as("popover")
411+
.should("have.attr", "open");
412+
413+
cy.get("@popover")
414+
.find(".ui5-responsive-popover-header.ui5-valuestatemessage-root")
415+
.should("exist");
416+
417+
cy.get("@popover")
418+
.find("ui5-list")
419+
.should("not.exist");
420+
});
398421
});
399422

400423
describe("Keyboard navigation", () => {

packages/main/src/ComboBoxPopoverTemplate.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export default function ComboBoxPopoverTemplate(this: ComboBox) {
8686
</div>
8787
}
8888

89+
{!!this._filteredItems.length &&
8990
<List
9091
class="ui5-combobox-items-list"
9192
separators="None"
@@ -97,6 +98,7 @@ export default function ComboBoxPopoverTemplate(this: ComboBox) {
9798
>
9899
{ this._filteredItems.map(item => <slot name={item._individualSlot}></slot>)}
99100
</List>
101+
}
100102

101103
{this._isPhone &&
102104
<div slot="footer" class="ui5-responsive-popover-footer">

0 commit comments

Comments
 (0)