mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(landing): restore homepage view tracking (#6260)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @vitest-environment node
|
||||
*/
|
||||
import { renderToStaticMarkup } from 'react-dom/server'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
|
||||
vi.mock('@sim/emcn', () => ({
|
||||
cn: (...values: Array<string | false | null | undefined>) => values.filter(Boolean).join(' '),
|
||||
}))
|
||||
|
||||
vi.mock('@/app/(landing)/components', () => ({
|
||||
Cta: () => null,
|
||||
Features: () => null,
|
||||
Hero: () => null,
|
||||
HomeStructuredData: () => null,
|
||||
Mothership: () => null,
|
||||
ProductDemo: () => null,
|
||||
}))
|
||||
|
||||
vi.mock('@/app/(landing)/components/landing-layout', () => ({
|
||||
LANDING_SECTION_RHYTHM: 'gap-test',
|
||||
}))
|
||||
|
||||
vi.mock('@/app/(landing)/landing-analytics', () => ({
|
||||
LandingAnalytics: () => <span>landing-analytics-marker</span>,
|
||||
}))
|
||||
|
||||
import Landing from '@/app/(landing)/landing'
|
||||
|
||||
describe('Landing', () => {
|
||||
it('mounts the landing page analytics tracker exactly once', () => {
|
||||
const markup = renderToStaticMarkup(<Landing />)
|
||||
|
||||
expect(markup.match(/landing-analytics-marker/g)).toHaveLength(1)
|
||||
})
|
||||
})
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
ProductDemo,
|
||||
} from '@/app/(landing)/components'
|
||||
import { LANDING_SECTION_RHYTHM } from '@/app/(landing)/components/landing-layout'
|
||||
import { LandingAnalytics } from '@/app/(landing)/landing-analytics'
|
||||
|
||||
/**
|
||||
* Landing page root - owns the section order and the `<main>` content region.
|
||||
@@ -26,6 +27,7 @@ import { LANDING_SECTION_RHYTHM } from '@/app/(landing)/components/landing-layou
|
||||
export default function Landing() {
|
||||
return (
|
||||
<main id='main-content' className={cn('flex flex-col', LANDING_SECTION_RHYTHM)}>
|
||||
<LandingAnalytics />
|
||||
<HomeStructuredData />
|
||||
<Hero />
|
||||
<ProductDemo />
|
||||
|
||||
Reference in New Issue
Block a user