mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-04 10:32:44 +00:00
Allow reporting a room when rejecting an invite. (#29570)
* Add report room dialog button/dialog. * Update copy * fixup tests / lint * Fix title in test. * update snapshot * Add unit tests for dialog * lint * First pass at adding a report room on invite. * Use a single line input field for reason to avoid bumping the layout. * Fixups * Embed reason to make it clear on grouping * Revert accidental commit * lint * Add some playwright tests. * tweaks * Make ignored users list more accessible. * i18n * Fix sliding sync test. * Add unit test * Even more unit tests. * move test * Update to match designs. * remove console statements * fix css * tidy up * improve comments * fix css * updates
This commit is contained in:
@@ -279,37 +279,31 @@ describe("<RoomPreviewBar />", () => {
|
||||
});
|
||||
|
||||
it("renders join and reject action buttons correctly", () => {
|
||||
const component = getComponent({ inviterName, room, onJoinClick, onRejectClick });
|
||||
expect(getActions(component)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders reject and ignore action buttons when handler is provided", () => {
|
||||
const onRejectAndIgnoreClick = jest.fn();
|
||||
const component = getComponent({
|
||||
inviterName,
|
||||
room,
|
||||
onJoinClick,
|
||||
onRejectClick,
|
||||
onRejectAndIgnoreClick,
|
||||
});
|
||||
const component = getComponent({ inviterName, room, onJoinClick, onDeclineClick: onRejectClick });
|
||||
expect(getActions(component)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders join and reject action buttons in reverse order when room can previewed", () => {
|
||||
// when room is previewed action buttons are rendered left to right, with primary on the right
|
||||
const component = getComponent({ inviterName, room, onJoinClick, onRejectClick, canPreview: true });
|
||||
const component = getComponent({
|
||||
inviterName,
|
||||
room,
|
||||
onJoinClick,
|
||||
onDeclineClick: onRejectClick,
|
||||
canPreview: true,
|
||||
});
|
||||
expect(getActions(component)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("joins room on primary button click", () => {
|
||||
const component = getComponent({ inviterName, room, onJoinClick, onRejectClick });
|
||||
const component = getComponent({ inviterName, room, onJoinClick, onDeclineClick: onRejectClick });
|
||||
fireEvent.click(getPrimaryActionButton(component)!);
|
||||
|
||||
expect(onJoinClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("rejects invite on secondary button click", () => {
|
||||
const component = getComponent({ inviterName, room, onJoinClick, onRejectClick });
|
||||
const component = getComponent({ inviterName, room, onJoinClick, onDeclineClick: onRejectClick });
|
||||
fireEvent.click(getSecondaryActionButton(component)!);
|
||||
|
||||
expect(onRejectClick).toHaveBeenCalled();
|
||||
@@ -337,18 +331,6 @@ describe("<RoomPreviewBar />", () => {
|
||||
const component = getComponent({ inviterName, room });
|
||||
expect(getMessage(component)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders join and reject action buttons with correct labels", () => {
|
||||
const onRejectAndIgnoreClick = jest.fn();
|
||||
const component = getComponent({
|
||||
inviterName,
|
||||
room,
|
||||
onJoinClick,
|
||||
onRejectAndIgnoreClick,
|
||||
onRejectClick,
|
||||
});
|
||||
expect(getActions(component)).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -364,7 +346,7 @@ describe("<RoomPreviewBar />", () => {
|
||||
async () => {
|
||||
const onJoinClick = jest.fn();
|
||||
const onRejectClick = jest.fn();
|
||||
const component = getComponent({ ...props, onJoinClick, onRejectClick });
|
||||
const component = getComponent({ ...props, onJoinClick, onDeclineClick: onRejectClick });
|
||||
await waitFor(() => expect(getPrimaryActionButton(component)).toBeTruthy());
|
||||
if (expectSecondaryButton) expect(getSecondaryActionButton(component)).toBeFalsy();
|
||||
fireEvent.click(getPrimaryActionButton(component)!);
|
||||
|
||||
@@ -339,34 +339,6 @@ exports[`<RoomPreviewBar /> with an invite without an invited email for a dm roo
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<RoomPreviewBar /> with an invite without an invited email for a dm room renders join and reject action buttons with correct labels 1`] = `
|
||||
<div
|
||||
class="mx_RoomPreviewBar_actions"
|
||||
>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
Start chatting
|
||||
</div>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_secondary"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
Reject & Ignore user
|
||||
</div>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_secondary"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
Reject
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<RoomPreviewBar /> with an invite without an invited email for a non-dm room renders invite message 1`] = `
|
||||
<div
|
||||
class="mx_RoomPreviewBar_message"
|
||||
@@ -421,7 +393,7 @@ exports[`<RoomPreviewBar /> with an invite without an invited email for a non-dm
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
Reject
|
||||
Decline
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -435,7 +407,7 @@ exports[`<RoomPreviewBar /> with an invite without an invited email for a non-dm
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
Reject
|
||||
Decline
|
||||
</div>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary"
|
||||
@@ -446,31 +418,3 @@ exports[`<RoomPreviewBar /> with an invite without an invited email for a non-dm
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<RoomPreviewBar /> with an invite without an invited email for a non-dm room renders reject and ignore action buttons when handler is provided 1`] = `
|
||||
<div
|
||||
class="mx_RoomPreviewBar_actions"
|
||||
>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
Accept
|
||||
</div>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_secondary"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
Reject & Ignore user
|
||||
</div>
|
||||
<div
|
||||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_secondary"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
Reject
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user