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

Commit

Permalink
Revert "MessageComposerButtons: don't hide moreButtons behind dropdow…
Browse files Browse the repository at this point in the history
…n in wide mode"

This reverts commit 5fd0906.
  • Loading branch information
ckiee committed Jun 29, 2022
1 parent 5fd0906 commit 5697af3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 41 deletions.
27 changes: 0 additions & 27 deletions mkpriv.sh

This file was deleted.

14 changes: 5 additions & 9 deletions src/components/views/rooms/MessageComposerButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,11 @@ const MessageComposerButtons: React.FC<IProps> = (props: IProps) => {

return <UploadButtonContextProvider roomId={roomId} relation={props.relation}>
{ mainButtons }
{ moreButtons.length > 0 &&
(narrow ?
<AccessibleTooltipButton
className={moreOptionsClasses}
onClick={props.toggleButtonMenu}
title={_t("More options")}
/> : moreButtons
)
}
{ moreButtons.length > 0 && <AccessibleTooltipButton
className={moreOptionsClasses}
onClick={props.toggleButtonMenu}
title={_t("More options")}
/> }
{ props.isMenuOpen && (
<IconizedContextMenu
onFinished={props.toggleButtonMenu}
Expand Down
32 changes: 27 additions & 5 deletions test/components/views/rooms/MessageComposerButtons-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const mockProps: React.ComponentProps<typeof MessageComposerButtons> = {
};

describe("MessageComposerButtons", () => {
it("Renders all buttons in wide mode", () => {
it("Renders emoji and upload buttons in wide mode", () => {
const buttons = wrapAndRender(
<MessageComposerButtons
isMenuOpen={false}
Expand All @@ -55,10 +55,32 @@ describe("MessageComposerButtons", () => {
expect(buttonLabels(buttons)).toEqual([
"Emoji",
"Attachment",
"Sticker",
"Voice Message",
"Poll",
"Location",
"More options",
]);
});

it("Renders other buttons in menu in wide mode", () => {
const buttons = wrapAndRender(
<MessageComposerButtons
isMenuOpen={true}
showLocationButton={true}
showPollsButton={true}
showStickersButton={true}
{...mockProps}
/>,
false,
);

expect(buttonLabels(buttons)).toEqual([
"Emoji",
"Attachment",
"More options",
[
"Sticker",
"Voice Message",
"Poll",
"Location",
],
]);
});

Expand Down

0 comments on commit 5697af3

Please sign in to comment.