Skip to content

Commit

Permalink
apply simone's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Feranchz committed Dec 14, 2023
1 parent 96eab1c commit 3d86b1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ export const ReleaseDetailsLayout = ({
variant="default"
onClick={handlePublishRelease}
loading={isPublishing}
disabled={release.actions.meta.count === 0}
>
{formatMessage({
id: 'content-releases.header.actions.publish',
Expand All @@ -302,8 +303,6 @@ export const ReleaseDetailsLayout = ({
);
};

const Bold = (children: React.ReactNode) => <Typography fontWeight="bold">{children}</Typography>;

/* -------------------------------------------------------------------------------------------------
* ReleaseDetailsBody
* -----------------------------------------------------------------------------------------------*/
Expand Down Expand Up @@ -460,7 +459,12 @@ const ReleaseDetailsBody = () => {
defaultMessage:
'This entry was <b>{isPublish, select, true {published} other {unpublished}}</b>.',
},
{ isPublish: type === 'publish', b: Bold }
{
isPublish: type === 'publish',
b: (children: React.ReactNode) => (
<Typography fontWeight="bold">{children}</Typography>
),
}
)}
</Typography>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ describe('Releases details page', () => {
const refreshButton = screen.getByRole('button', { name: 'Refresh' });
expect(refreshButton).toBeInTheDocument();

const releaseButton = screen.getByRole('button', { name: 'Release' });
expect(releaseButton).toBeInTheDocument();
const publishButton = screen.getByRole('button', { name: 'Publish' });
expect(publishButton).toBeInTheDocument();
expect(publishButton).toBeDisabled();

const noContent = screen.getByText(/This release is empty./i);
expect(noContent).toBeInTheDocument();
Expand Down Expand Up @@ -140,6 +141,7 @@ describe('Releases details page', () => {
expect(publishButton).not.toBeInTheDocument();

expect(screen.queryByRole('radio', { name: 'publish' })).not.toBeInTheDocument();
expect(screen.getByText('This entry was published.')).toBeInTheDocument();
const container = screen.getByText(/This entry was/);
expect(container.querySelector('span')).toHaveTextContent('published');
});
});

0 comments on commit 3d86b1a

Please sign in to comment.