diff --git a/packages/main/cypress/specs/ExpandableText.cy.tsx b/packages/main/cypress/specs/ExpandableText.cy.tsx
index 18ef33e4e8cb..06a2e66a6c97 100644
--- a/packages/main/cypress/specs/ExpandableText.cy.tsx
+++ b/packages/main/cypress/specs/ExpandableText.cy.tsx
@@ -223,6 +223,76 @@ describe("ExpandableText", () => {
});
});
+ describe("CSS Inheritance", () => {
+ it("Text element inherits white-space from host", () => {
+ const text = "This is a very long text that should be displayed";
+
+ cy.mount(
+
+
+
+ );
+
+ cy.get("[ui5-expandable-text]")
+ .shadow()
+ .find(".ui5-exp-text-text")
+ .should("have.css", "white-space", "pre-wrap")
+ .and("have.css", "display", "inline");
+ });
+
+ it("Text element inherits white-space 'nowrap' from host", () => {
+ const text = "This is a very long text that should be displayed";
+
+ cy.mount(
+
+
+
+ );
+
+ cy.get("[ui5-expandable-text]")
+ .shadow()
+ .find(".ui5-exp-text-text")
+ .should("have.css", "white-space", "nowrap");
+ });
+
+ it("Popover and popover text inherit white-space, font-family, and font-size from host", () => {
+ const text = "This is a very long text that should be displayed";
+ const maxCharacters = 5;
+
+ cy.mount(
+
+
+
+ );
+
+ cy.get("[ui5-expandable-text]").shadow().as("expTextShadow");
+
+ cy.get("@expTextShadow")
+ .find(".ui5-exp-text-toggle")
+ .realClick();
+
+ cy.get("[ui5-expandable-text]")
+ .invoke("css", "font-family")
+ .then(hostFontFamily => {
+ cy.get("[ui5-expandable-text]")
+ .invoke("css", "font-size")
+ .then(hostFontSize => {
+ cy.get("@expTextShadow")
+ .find(".ui5-exp-text-popover")
+ .should("have.css", "white-space", "pre-line")
+ .and("have.css", "font-family", hostFontFamily as unknown as string)
+ .and("have.css", "font-size", hostFontSize as unknown as string);
+
+ cy.get("@expTextShadow")
+ .find(".ui5-exp-text-popover-text")
+ .should("have.css", "white-space", "pre-line")
+ .and("have.css", "font-family", hostFontFamily as unknown as string)
+ .and("have.css", "font-size", hostFontSize as unknown as string);
+ });
+ });
+ });
+ });
+
describe("Empty Indicator", () => {
it("Should display empty indicator if text is empty and emptyIndicatorMode=On", () => {
cy.mount();
diff --git a/packages/main/src/ExpandableTextTemplate.tsx b/packages/main/src/ExpandableTextTemplate.tsx
index eee3966f882e..22c0e6a0d329 100644
--- a/packages/main/src/ExpandableTextTemplate.tsx
+++ b/packages/main/src/ExpandableTextTemplate.tsx
@@ -37,7 +37,7 @@ export default function ExpandableTextTemplate(this: ExpandableText) {
class="ui5-exp-text-popover"
onClose={this._handlePopoverClose}
>
- {this.text}
+ {this.text}