Compare commits

...

3 commits

Author SHA1 Message Date
1c3f2565c7 Updated test 2025-09-01 09:32:18 +08:00
4f71a20c67 Used new head component 2025-09-01 09:32:06 +08:00
9952654af1 Added head component 2025-09-01 09:31:47 +08:00
3 changed files with 24 additions and 11 deletions

View file

@ -0,0 +1,20 @@
interface Props {
title: string
name: string
description: string
}
export default (props: Props) => {
return (
<>
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover" />
<meta name="name" content={props.name} />
<meta name="description" content={props.description} />
<title>{props.title}</title>
</head>
</>
)
}

View file

@ -6,20 +6,13 @@ const websiteDescription = 'This is just a template.'
import Background from '../../fwt/components/Background/Background'
import OptimizeBackground from '../../fwt/components/Optimizer/OptimizeBackground'
import Head from '../../fwt/components/Head/Head'
---
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover" />
<meta name="name" content={websiteName} />
<meta name="description" content={websiteDescription} />
<title>{title}</title>
</head>
<Head title={title} name={websiteName} description={websiteDescription} />
<body id="body">
<!-- <OptimizeBackground /> -->
<Background color="#0c1b31" />
<slot />

View file

@ -3,7 +3,7 @@ import { test, expect } from '@playwright/test'
test('page loaded correctly', async ({ page }) => {
await page.goto('http://localhost:4321')
await expect(page).toHaveTitle('Home')
await expect(page).toHaveTitle('FWT')
const descriptionMeta = await page.getAttribute('meta[name="name"]', 'content')
expect(descriptionMeta).toBe('Template')
@ -23,5 +23,5 @@ test('header title is visible and contains correct text', async ({ page }) => {
await page.goto('http://localhost:4321')
const headerTitle = await page.textContent('h1')
expect(headerTitle).toBe('Main Page')
expect(headerTitle).toBe('Fast WebApp Template')
})