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
13 changes: 4 additions & 9 deletions dotcom-rendering/src/model/enhanceTableOfContents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,15 @@ describe('Enhance Table of Contents', () => {
]);
});

it('will not return a toc if the are fewer than 3 h2s', () => {
it('will not return a toc if there are no h2s', () => {
const input: Block[] = [
{
...blockMetaData,
elements: [
{
_type: 'model.dotcomrendering.pageElements.SubheadingBlockElement',
elementId: 'h2One',
html: '<h2>This is the h2 text</h2>',
},
{
_type: 'model.dotcomrendering.pageElements.SubheadingBlockElement',
elementId: 'h2Two',
html: '<h2>This is the h2 text</h2>',
_type: 'model.dotcomrendering.pageElements.TextBlockElement',
elementId: 'text',
html: 'Text',
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion dotcom-rendering/src/model/enhanceTableOfContents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@ export const enhanceTableOfContents = (
}
}

return tocItems.length >= 3 ? tocItems : undefined;
return tocItems.length >= 1 ? tocItems : undefined;
};
Loading