diff --git a/components/landing/TableOfContents.tsx b/components/landing/TableOfContents.tsx index d82d2945eaa0..633f37bb1ff5 100644 --- a/components/landing/TableOfContents.tsx +++ b/components/landing/TableOfContents.tsx @@ -1,9 +1,7 @@ -import { useRouter } from 'next/router' import cx from 'classnames' import { ActionList } from '@primer/react' import { Link } from 'components/Link' -import { BumpLink } from 'components/ui/BumpLink' import type { TocItem } from 'components/context/ProductLandingContext' type Props = { @@ -12,22 +10,43 @@ type Props = { } export const TableOfContents = (props: Props) => { const { items, variant = 'expanded' } = props - const router = useRouter() + + const actionItems = (items || []).filter((item) => typeof item !== 'undefined') return ( )} - - - ) : ( - -
- {title}}> - {intro && ( -

- )} - -

+
) })} - + + )} ) } diff --git a/components/landing/TocLanding.tsx b/components/landing/TocLanding.tsx index 3fb37a568237..fa9898c2f9d1 100644 --- a/components/landing/TocLanding.tsx +++ b/components/landing/TocLanding.tsx @@ -78,7 +78,7 @@ export const TocLanding = () => {
-
+
{featuredLinks.gettingStarted && featuredLinks.popular && (
diff --git a/tests/rendering/server.js b/tests/rendering/server.js index 6f3f5cf6dfcb..cb2d22b96e23 100644 --- a/tests/rendering/server.js +++ b/tests/rendering/server.js @@ -718,13 +718,13 @@ describe('server', () => { expect($('[data-testid=table-of-contents] ul li a').length).toBeGreaterThan(5) }) - test('map topic renders with h2 links to articles', async () => { + test('map topic renders with links to articles', async () => { const $ = await getDOM( '/en/get-started/importing-your-projects-to-github/importing-source-code-to-github' ) expect( $( - 'a[href="/en/get-started/importing-your-projects-to-github/importing-source-code-to-github/about-github-importer"] h2' + 'li h2 a[href="/en/get-started/importing-your-projects-to-github/importing-source-code-to-github/about-github-importer"]' ).length ).toBe(1) }) @@ -733,15 +733,18 @@ describe('server', () => { const $ = await getDOM( '/en/get-started/importing-your-projects-to-github/importing-source-code-to-github' ) - const $bumpLinks = $('[data-testid=bump-link]') - expect($bumpLinks.length).toBeGreaterThan(3) + const $links = $('[data-testid=expanded-item]') + expect($links.length).toBeGreaterThan(3) }) test('map topic intros are parsed', async () => { const $ = await getDOM( '/en/get-started/importing-your-projects-to-github/importing-source-code-to-github' ) - const $intro = $('[data-testid=bump-link][href*="source-code-migration-tools"] > p') + const $parent = $('[data-testid=expanded-item] a[href*="source-code-migration-tools"]') + .parent() + .parent() + const $intro = $('p', $parent) expect($intro.length).toBe(1) expect($intro.html()).toContain('You can use external tools to move your projects to GitHub') })