From 383dbcd42097c887b2cab3047cd83b710f8721fb Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 17 May 2026 19:11:33 +0000 Subject: [PATCH] Phase 7 test setup: PWA config, sample pages, test_phase.py wiring - config.yml: pwa: yes, navigation: sidebar, offline-message - home.md: Phase 7 test instructions - about.md, docs.md: sample pages for offline cache testing - test_phase.py: all phases point to claude/* branches; EXTRA_FILES for 5 and 7 - version bump to 0.3.9 https://claude.ai/code/session_01UP8Wo2CKPNhvvTkzX48CWF --- app/config.yml | 10 ++++- app/pages/about.md | 8 ++++ app/pages/docs.md | 8 ++++ app/pages/home.md | 109 +++++++-------------------------------------- test_phase.py | 15 +++++-- 5 files changed, 52 insertions(+), 98 deletions(-) create mode 100644 app/pages/about.md create mode 100644 app/pages/docs.md diff --git a/app/config.yml b/app/config.yml index d4f01c7..e7b3179 100644 --- a/app/config.yml +++ b/app/config.yml @@ -20,10 +20,16 @@ # ────────────────────────────────── # Site identity # ────────────────────────────────── -sitename: MD-CMS New Site -navigation: topbar # sidebar | topbar +sitename: MD-CMS Phase 7 Test +navigation: sidebar # sidebar | topbar theme: theme.yml # presentational config — edit theme.yml to customise colours, fonts, and layout +pwa: yes +pwa-name: MD-CMS Phase 7 Test +pwa-shortname: MDCMS Test +pwa-colour: "#2563EB" +offline-message: "This page is not available offline. Connect to the internet and reload." + # homepage: pages/home.md # override the default landing page # sitedescription: A short description for meta tags diff --git a/app/pages/about.md b/app/pages/about.md new file mode 100644 index 0000000..77812fc --- /dev/null +++ b/app/pages/about.md @@ -0,0 +1,8 @@ +--- +title: About +sort: 200 +--- + +# About + +This is a sample page for Phase 7 PWA testing. Navigate here from the sidebar, then go offline and reload — this page should still be available from the service worker cache. diff --git a/app/pages/docs.md b/app/pages/docs.md new file mode 100644 index 0000000..4f26c2d --- /dev/null +++ b/app/pages/docs.md @@ -0,0 +1,8 @@ +--- +title: Docs +sort: 300 +--- + +# Docs + +Another sample page for Phase 7 PWA testing. Visit this page while online, then go offline — it should remain accessible from the cache. diff --git a/app/pages/home.md b/app/pages/home.md index 3ed6b63..d3a115e 100644 --- a/app/pages/home.md +++ b/app/pages/home.md @@ -3,101 +3,24 @@ title: Home sort: 100 --- -# Phase 4 — Callout Tags +# Phase 7 — PWA Test -Check each callout below. Each should show a coloured left border, an icon, a bold title in the accent colour, and a rendered body. +This page verifies the service worker and manifest generated by `mdcms build` when `pwa: yes` is set in `config.yml`. ---- +## Test procedure -## Basic types +1. Run `python3 mdcms.py build --path app/` — confirm `manifest.json` and `service-worker.js` appear in `app/` +2. Load `http://localhost:8800` — service worker registers on first load +3. Navigate to the **About** and **Docs** pages so they are fetched and cached +4. Stop the HTTP server (`Ctrl+C` in its terminal) +5. Reload — site should load fully from the service worker cache +6. Navigate between pages — all should work offline +7. Check that a page not yet visited shows the offline message -```mdcms callout-info -title: Information -This is an **info** callout. Supports *italic*, `code`, and lists: +## What to look for -- Item one -- Item two -``` - -```mdcms callout-warning -title: Warning -Something needs your attention. This is a **warning** callout. -``` - -```mdcms callout-success -title: Success -The operation completed successfully. This is a **success** callout. -``` - -```mdcms callout-error -title: Error -Something went wrong. This is an **error** callout. -``` - ---- - -## No title - -```mdcms callout-info -No title key here. The title row should not appear at all — just the body. -``` - ---- - -## Markdown body - -```mdcms callout-warning -title: Rich body -- List item one -- List item two - -A paragraph with `inline code` and a [link](https://example.com). -``` - ---- - -## Custom icon override - -```mdcms callout-info -title: Info with warning icon -icon: warning -This info callout uses the warning icon instead of the default info icon. -``` - ---- - -## Config-defined message (message: key) - -The callout below uses `message: aitranslation` to pull its title and body from the `callouts:` block in `config.yml`. The type (`warning`) also comes from the config entry, not the tag name. - -```mdcms callout-info -message: aitranslation -``` - ---- - -## message: overrides inline content - -When `message:` is present, any inline `title:` or body text is ignored. A warning should appear in the browser console. - -```mdcms callout-info -message: aitranslation -title: This title should be ignored -This body text should also be ignored. Check the console for a warning. -``` - ---- - -## Missing icon - -This callout uses a non-existent icon name. A broken image should appear where the icon would be. - -```mdcms callout-info -title: Custom icon that does not exist -icon: nonexistent_icon -The icon to the left of this title should show as a broken image. -``` - ---- - -Toggle dark mode and check all four callout types still look correct. +- `manifest.json` and `service-worker.js` exist after build +- DevTools → Application → Service Workers: status **activated and running** +- DevTools → Application → Cache Storage: cache named `mdcms-xxxxxxxx` with all files listed +- Site loads fully with server stopped +- Offline message (`config.yml: offline-message`) appears for uncached pages diff --git a/test_phase.py b/test_phase.py index 9104574..534a728 100644 --- a/test_phase.py +++ b/test_phase.py @@ -28,9 +28,9 @@ PHASES = { 2: ("v0.4_phase2", "Icon system — local SVGs, no Google Fonts"), 3: ("v0.4_phase3", "Asset validation in mdcms build"), 4: ("claude/debug-api-errors-gd730", "Callout tags"), - 5: ("v0.4_phase5", "Table of contents tag"), - 6: ("v0.4_phase6", "Offline / fetch-deps"), - 7: ("v0.4_phase7", "PWA — service worker and manifest"), + 5: ("claude/toc-tag-phase5", "Table of contents tag"), + 6: ("claude/fetch-deps-phase6", "Offline / fetch-deps"), + 7: ("claude/pwa-phase7", "PWA — service worker and manifest"), } VERIFY = { @@ -108,6 +108,15 @@ EXTRA_FILES = { "app/config.yml", # has callouts: block for message: key test "app/pages/home.md", # has Phase 4 callout test cases ], + 5: [ + "app/pages/home.md", # has Phase 5 TOC test case + ], + 7: [ + "app/config.yml", # pwa: yes, sidebar nav, offline-message + "app/pages/home.md", # Phase 7 test instructions + "app/pages/about.md", # sample page to cache and test offline + "app/pages/docs.md", # sample page to cache and test offline + ], }