Avoid rendering view-message link in RoomKnocksBar unnecessarily (#11598)
Signed-off-by: Charly Nguyen <charly.nguyen@nordeck.net>
This commit is contained in:
parent
3c6d8a2a28
commit
bb91df1d3c
2 changed files with 23 additions and 8 deletions
|
@ -165,13 +165,28 @@ describe("RoomKnocksBar", () => {
|
|||
expect(screen.getByRole("paragraph")).toHaveTextContent(`${bob.name} (${bob.userId})`);
|
||||
});
|
||||
|
||||
it("renders a link to open the room settings people tab", () => {
|
||||
getComponent(room);
|
||||
fireEvent.click(getButton("View message"));
|
||||
expect(dis.dispatch).toHaveBeenCalledWith({
|
||||
action: "open_room_settings",
|
||||
initial_tab_id: RoomSettingsTab.People,
|
||||
room_id: roomId,
|
||||
describe("when a knock reason is not provided", () => {
|
||||
it("does not render a link to open the room settings people tab", () => {
|
||||
getComponent(room);
|
||||
expect(screen.queryByRole("button", { name: "View message" })).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe("when a knock reason is provided", () => {
|
||||
it("renders a link to open the room settings people tab", () => {
|
||||
bob.setMembershipEvent(
|
||||
new MatrixEvent({
|
||||
content: { displayname: "Bob", membership: "knock", reason: "some reason" },
|
||||
type: EventType.RoomMember,
|
||||
}),
|
||||
);
|
||||
getComponent(room);
|
||||
fireEvent.click(getButton("View message"));
|
||||
expect(dis.dispatch).toHaveBeenCalledWith({
|
||||
action: "open_room_settings",
|
||||
initial_tab_id: RoomSettingsTab.People,
|
||||
room_id: roomId,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue