redesign the homepage
Build & Deploy / Build & Push Docker Image (push) Failing after 47s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / API Unit Tests (push) Failing after 5m4s
Test / Marketplace Unit Tests (push) Failing after 4m55s
Test / Admin Unit Tests (push) Successful in 9m37s
Test / Dashboard Unit Tests (push) Successful in 9m37s
Test / API Integration Tests (push) Successful in 9m54s
Build & Deploy / Build & Push Docker Image (push) Failing after 47s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / API Unit Tests (push) Failing after 5m4s
Test / Marketplace Unit Tests (push) Failing after 4m55s
Test / Admin Unit Tests (push) Successful in 9m37s
Test / Dashboard Unit Tests (push) Successful in 9m37s
Test / API Integration Tests (push) Successful in 9m54s
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import React, { isValidElement } from 'react'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
|
||||
vi.mock('./PublicNavbar', () => ({ default: function MockPublicNavbar() { return React.createElement('mock-navbar') } }))
|
||||
vi.mock('./PublicFooter', () => ({ default: function MockPublicFooter() { return React.createElement('mock-footer') } }))
|
||||
|
||||
import PublicPageLayout from './PublicPageLayout'
|
||||
|
||||
function childTypes(node: React.ReactElement): string[] {
|
||||
return React.Children.toArray(node.props.children).filter(isValidElement).map((child) => {
|
||||
const type = child.type as any
|
||||
return typeof type === 'string' ? type : type.displayName ?? type.name ?? 'anonymous'
|
||||
})
|
||||
}
|
||||
|
||||
describe('PublicPageLayout', () => {
|
||||
it('provides reusable public chrome for sign-in and account creation pages', () => {
|
||||
const layout = PublicPageLayout({ children: React.createElement('main') })
|
||||
|
||||
expect(childTypes(layout)).toEqual(['MockPublicNavbar', 'div', 'MockPublicFooter'])
|
||||
expect(layout.props['data-public-page-layout']).toBe('true')
|
||||
})
|
||||
|
||||
it('allows either public chrome region to be disabled independently', () => {
|
||||
const layout = PublicPageLayout({
|
||||
children: React.createElement('main'),
|
||||
showNavbar: false,
|
||||
showFooter: true,
|
||||
})
|
||||
|
||||
expect(childTypes(layout)).toEqual(['div', 'MockPublicFooter'])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user