Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions src/amo/pages/Addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,38 +344,6 @@ export class AddonBase extends React.Component {
) : null;
}

renderVersionReleaseNotes() {
const { addon, i18n, currentVersion } = this.props;
if (!addon) {
return null;
}

if (!currentVersion || !currentVersion.releaseNotes) {
return null;
}

const header = i18n.sprintf(
i18n.gettext('Release notes for %(addonVersion)s'),
{ addonVersion: currentVersion.version },
);
const releaseNotes = sanitizeUserHTML(currentVersion.releaseNotes);

const showMoreCardNotesName = 'AddonDescription-version-notes';

/* eslint-disable react/no-danger */
return (
<ShowMoreCard
contentId={addon.id}
className={showMoreCardNotesName}
id={showMoreCardNotesName}
header={header}
>
<div dangerouslySetInnerHTML={releaseNotes} />
</ShowMoreCard>
);
/* eslint-enable react/no-danger */
}

renderCategorySuggestions(requiredVariant) {
const { addon, clientApp, variant } = this.props;

Expand Down Expand Up @@ -523,8 +491,6 @@ export class AddonBase extends React.Component {

<ContributeCard addon={addon} />

{this.renderVersionReleaseNotes()}

{this.renderRecommendations()}
</div>
</div>
Expand Down
93 changes: 0 additions & 93 deletions tests/unit/amo/pages/TestAddon.js
Original file line number Diff line number Diff line change
Expand Up @@ -1264,99 +1264,6 @@ describe(__filename, () => {
});
});

describe('version release notes', () => {
const renderWithVersion = (props = {}) => {
addon.current_version = { ...fakeVersion, ...props };
renderWithAddon();
};

it('is hidden when an add-on has not loaded yet', () => {
render();

expect(
screen.queryByClassName('AddonDescription-version-notes'),
).not.toBeInTheDocument();
});

it('is hidden when the add-on does not have a current version', () => {
addon.current_version = null;
renderWithAddon();

expect(
screen.queryByClassName('AddonDescription-version-notes'),
).not.toBeInTheDocument();
});

it('is hidden when the current version does not have release notes', () => {
renderWithVersion({ release_notes: null });

expect(
screen.queryByClassName('AddonDescription-version-notes'),
).not.toBeInTheDocument();
});

it('passes the expected contentId to ShowMoreCard', async () => {
expect(
await testContentId({
addonProp: 'id',
addonPropValue: addon.id + 1,
cardClassName: 'AddonDescription-version-notes',
}),
).toBeTruthy();
});

it('shows the version string', () => {
const version = 'v1.4.5';
renderWithVersion({ version });

expect(screen.getByText('Release notes for v1.4.5')).toBeInTheDocument();
});

it('shows the release notes', () => {
const releaseNotes = 'Fixed some stuff';
renderWithVersion({
release_notes: createLocalizedString(releaseNotes),
});

expect(screen.getByText(releaseNotes)).toBeInTheDocument();
});

it('allows some HTML tags', () => {
const releaseNotes = '<b>lots</b> <i>of</i> <blink>bug fixes</blink>';
renderWithVersion({
release_notes: createLocalizedString(releaseNotes),
});

const notesCard = screen.getByClassName('AddonDescription-version-notes');

expect(
screen.getByTextAcrossTags('lots of bug fixes'),
).toBeInTheDocument();
expect(within(notesCard).getByTagName('b')).toHaveTextContent('lots');
expect(within(notesCard).getByTagName('i')).toHaveTextContent('of');
});

it('allows some ul-li tags', () => {
const releaseNotes = '<b>The List</b><ul><li>one</li><li>two</li></ul>';
renderWithVersion({
release_notes: createLocalizedString(releaseNotes),
});

const notesCard = screen.getByClassName('AddonDescription-version-notes');

expect(
within(notesCard).getByTextAcrossTags('The Listonetwo'),
).toBeInTheDocument();
expect(within(notesCard).getByRole('list')).toBeInTheDocument();
expect(within(notesCard).getAllByRole('listitem')[0]).toHaveTextContent(
'one',
);
expect(within(notesCard).getAllByRole('listitem')[1]).toHaveTextContent(
'two',
);
});
});

it('renders the site identifier as a data attribute', () => {
renderWithAddon();

Expand Down