Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
38 changes: 38 additions & 0 deletions packages/main/cypress/specs/Select.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,44 @@ describe("Select - Popover", () => {
.should("be.visible")
.should("have.text", "Custom message");
});

it("Value state message popover can extend beyond select width", () => {
cy.mount(
<Select valueState="Critical">
<Option>Short</Option>
<Option>Long</Option>
<div slot="valueStateMessage">
This is a very long value state message that should extend beyond the narrow select component width and not be constrained by it.
</div>
</Select>
);

// Trigger the value state popover by clicking and then pressing Escape
cy.get("[ui5-select]")
.realClick()
.realPress("Escape");

// Get the select width for comparison
cy.get("[ui5-select]")
.invoke("outerWidth")
.as("selectWidth");

// Find the standalone value state popover
cy.get("[ui5-select]")
.shadow()
.find(".ui5-valuestatemessage-popover")
.should("exist")
.as("valueStatePopover");

// Verify the popover width is greater than the select width
cy.get("@valueStatePopover")
.invoke("outerWidth")
.then((popoverWidth) => {
cy.get("@selectWidth").then((selectWidth) => {
expect(popoverWidth).to.be.greaterThan(Number(selectWidth));
});
});
});
});

describe("Select - Properties", () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/main/src/Select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@ class Select extends UI5Element implements IFormInputElement {
return {
popoverValueState: {
"ui5-valuestatemessage-root": true,
"ui5-valuestatemessage-header": !this._isPhone,
"ui5-valuestatemessage--success": this.valueState === ValueState.Positive,
"ui5-valuestatemessage--error": this.valueState === ValueState.Negative,
"ui5-valuestatemessage--warning": this.valueState === ValueState.Critical,
Expand All @@ -1009,11 +1010,12 @@ class Select extends UI5Element implements IFormInputElement {
get styles() {
return {
popoverHeader: {
"max-width": `${this.offsetWidth}px`,
"display": "block",
},
responsivePopoverHeader: {
"display": this.options.length && this._listWidth === 0 ? "none" : "inline-block",
"width": `${this.options.length ? this._listWidth : this.offsetWidth}px`,
"max-width": "100%",
},
responsivePopover: {
"min-width": `${this.offsetWidth}px`,
Expand Down
Loading