feat: add BaseLayout with SEO head tags and theme init script
Canonical/hreflang/OG tags derived from the locale dictionary, plus a pre-paint script applying data-theme from localStorage or system preference.
This commit is contained in:
@@ -457,14 +457,16 @@ describe('BaseLayout SEO tags and theming', () => {
|
||||
expect(en).toContain('prefers-color-scheme: light');
|
||||
});
|
||||
|
||||
it('links the global stylesheet', () => {
|
||||
it('applies the global stylesheet (inlined or linked)', () => {
|
||||
const en = readFileSync('dist/en/index.html', 'utf-8');
|
||||
expect(en).toMatch(/<link rel="stylesheet"[^>]*href="[^"]+\.css"/);
|
||||
const hasInlineStyle = /<style>[\s\S]*--accent[\s\S]*<\/style>/.test(en);
|
||||
const hasStylesheetLink = /<link rel="stylesheet"[^>]*href="[^"]+\.css"/.test(en);
|
||||
expect(hasInlineStyle || hasStylesheetLink).toBe(true);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Note: from this task on, tests call `npm run build` themselves via `beforeAll`, so `npm run test` alone is sufficient going forward.
|
||||
Note: from this task on, tests call `npm run build` themselves via `beforeAll`, so `npm run test` alone is sufficient going forward. Astro inlines small stylesheets into a `<style>` tag during build rather than emitting an external `<link>` — the test accepts either form.
|
||||
|
||||
- [ ] **Step 2: Run the test and confirm it fails**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user