Skip to content

Commit

Permalink
fix(ui5-side-navigation): fix expand and collapse (#10418)
Browse files Browse the repository at this point in the history
  • Loading branch information
GerganaKremenska authored Dec 19, 2024
1 parent 36f1565 commit 4d17e57
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
38 changes: 38 additions & 0 deletions packages/fiori/cypress/specs/SideNavigation.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { html } from "lit";
import "../../src/SideNavigation.js";
import "../../src/SideNavigationItem.js";
import "../../src/SideNavigationSubItem.js";

const sample = html` <ui5-side-navigation>
<ui5-side-navigation-item
id="item1"
text="Home"
icon="home"
tooltip="Home tooltip"
></ui5-side-navigation-item>
<ui5-side-navigation-item id="item2" text="People" icon="group">
<ui5-side-navigation-sub-item
id="item21"
text="From My Team"
icon="employee-approvals"
tooltip="From My Team tooltip"
></ui5-side-navigation-sub-item>
<ui5-side-navigation-sub-item
id="item22"
text="From Other Teams"
icon="employee-rejections"
></ui5-side-navigation-sub-item>
</ui5-side-navigation-item>
</ui5-side-navigation>`;

describe("Side Navigation interaction", () => {
it("Tests that expand works", () => {
cy.mount(sample);

// act
cy.get("#item2").shadow().find(".ui5-sn-item-toggle-icon").realClick();

// assert
cy.get("#item2").should("have.attr", "expanded");
});
});
6 changes: 4 additions & 2 deletions packages/fiori/src/SideNavigationItemTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ function TreeItemTemplate(this: SideNavigationItem) {
{!!this.items.length &&
<Icon class="ui5-sn-item-toggle-icon"
name={this.expanded ? navDownArrow : navRightArrow}
onui5-click={this._onToggleClick}
// @ts-expect-error
onClick={this._onToggleClick}
/>
}
</a>
Expand Down Expand Up @@ -149,7 +150,8 @@ function TreeItemTemplate(this: SideNavigationItem) {
{!!this.items.length &&
<Icon class="ui5-sn-item-toggle-icon"
name={this.expanded ? navDownArrow : navRightArrow}
onui5-click={this._onToggleClick}
// @ts-expect-error
onClick={this._onToggleClick}
/>
}
</div>
Expand Down

0 comments on commit 4d17e57

Please sign in to comment.