Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit c44c772

Browse files
manancodesManan Sadanaflorianduros
authored
Fix: Right panel keeps showing chat when unmaximizing widget. (#11697)
* Right panel chat closes when unmaximising widget * Basic right panel tests added * Accessible selectors used for new tests * Test added to check if chat exists in right panel --------- Co-authored-by: Manan Sadana <[email protected]> Co-authored-by: Florian Duros <[email protected]>
1 parent c28f316 commit c44c772

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

cypress/e2e/widgets/layout.spec.ts

+16
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,20 @@ describe("Widget Layout", () => {
129129

130130
cy.get('iframe[title="widget"]').invoke("height").should("be.greaterThan", 400);
131131
});
132+
it("open right panel with chat when maximizing widget", () => {
133+
cy.get('iframe[title="widget"]').invoke("height").should("be.lessThan", 250);
134+
cy.findByRole("button", { name: "Maximise" }).click();
135+
cy.get(".mx_RightPanel").within(() => {
136+
cy.get(".mx_BaseCard_header").should("contain", "Chat");
137+
});
138+
});
139+
it("close right panel with chat when unmaximizing widget", () => {
140+
cy.get('iframe[title="widget"]').invoke("height").should("be.lessThan", 250);
141+
cy.findByRole("button", { name: "Maximise" }).click();
142+
cy.get(".mx_RightPanel").within(() => {
143+
cy.get(".mx_BaseCard_header").should("contain", "Chat");
144+
});
145+
cy.findByRole("button", { name: "Un-maximise" }).click();
146+
cy.get(".mx_RightPanel").should("not.exist");
147+
});
132148
});

src/components/structures/RoomView.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
539539
if (this.context.widgetLayoutStore.hasMaximisedWidget(this.state.room)) {
540540
// Show chat in right panel when a widget is maximised
541541
this.context.rightPanelStore.setCard({ phase: RightPanelPhases.Timeline });
542+
} else {
543+
// Close the chat in right panel when the widget is unmaximised
544+
this.context.rightPanelStore.togglePanel(null);
542545
}
543546
this.checkWidgets(this.state.room);
544547
};

0 commit comments

Comments
 (0)