fix: remove shortening of description content (#1346)

* fix: remove shortening of description content

* chore: remove test for removed functionality
This commit is contained in:
Dexter Edwards 2022-09-16 17:03:11 +01:00 committed by GitHub
parent 9385e0f4c3
commit 4aa9bbaa23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 43 deletions

View File

@ -208,39 +208,6 @@ describe('Proposal header', () => {
expect(screen.getByTestId('proposal-details')).toHaveTextContent('long'); expect(screen.getByTestId('proposal-details')).toHaveTextContent('long');
}); });
it('Renders Freeform proposal - extra long rationale (165 chars)', () => {
render(
renderComponent(
generateProposal({
id: 'extraLong',
rationale: {
title:
'Aenean sem odio, eleifend non sodales vitae, porttitor eu ex. Aliquam erat volutpat. Fusce pharetra libero quis risus lobortis, sed ornare leo efficitur turpis duis.',
description:
'Aenean sem odio, eleifend non sodales vitae, porttitor eu ex. Aliquam erat volutpat. Fusce pharetra libero quis risus lobortis, sed ornare leo efficitur turpis duis.',
},
terms: {
change: {
__typename: 'NewFreeform',
},
},
})
)
);
// For a rationale over 160 chars, we expect the header to be truncated at 100
// chars with ellipsis and the details-one element to contain 60 chars and also
// be truncated with an ellipsis.
expect(screen.getByTestId('proposal-title')).toHaveTextContent(
'Aenean sem odio, eleifend non sodales vitae, porttitor eu ex. Aliquam erat volutpat. Fusce pharetra…'
);
expect(screen.getByTestId('proposal-description')).toHaveTextContent(
'Aenean sem odio, eleifend non sodales vitae, porttitor eu e…'
);
expect(screen.getByTestId('proposal-details')).toHaveTextContent(
'extraLong'
);
});
// Remove once proposals have rationale and re-enable above tests // Remove once proposals have rationale and re-enable above tests
it('Renders Freeform proposal - id for title', () => { it('Renders Freeform proposal - id for title', () => {
render( render(

View File

@ -18,7 +18,6 @@ export const ProposalHeader = ({ proposal }: { proposal: ProposalFields }) => {
} }
const titleContent = shorten(title, 100); const titleContent = shorten(title, 100);
const descriptionContent = shorten(description, 60);
switch (change.__typename) { switch (change.__typename) {
case 'NewMarket': { case 'NewMarket': {
@ -90,15 +89,9 @@ export const ProposalHeader = ({ proposal }: { proposal: ProposalFields }) => {
{titleContent || t('Unknown proposal')} {titleContent || t('Unknown proposal')}
</h2> </h2>
</header> </header>
{descriptionContent && ( {description && (
<div <div className="mb-4" data-testid="proposal-description">
className="mb-4" {description}
{...(description.length > descriptionContent.length && {
title: description,
})}
data-testid="proposal-description"
>
{descriptionContent}
</div> </div>
)} )}
{details && <div data-testid="proposal-details">{details}</div>} {details && <div data-testid="proposal-details">{details}</div>}