FAQ ยท Mesh-Hunter
+
+
+
diff --git a/landing/landing.test.js b/landing/landing.test.js
index d56a2397..d1e2c1ca 100644
--- a/landing/landing.test.js
+++ b/landing/landing.test.js
@@ -48,39 +48,187 @@ describe('landing pages', () => {
})
})
-describe('the hero shot', () => {
- const svg = read('hero.svg')
+// The site fetches nothing from another host (the v7 redesign). The display
+// face is served from here for that reason, so a stylesheet or font that
+// quietly points at a CDN would break the rule the fonts/ folder exists for.
+describe('self-contained', () => {
+ const css = readFileSync(new URL('./style.css', import.meta.url), 'utf8').replace(/\/\*[\s\S]*?\*\//g, '')
+
+ it.each(pages)('%s loads its stylesheet and icon from this site', (f) => {
+ const links = [...read(f).matchAll(/]*\bhref="([^"]+)"/g)].map((m) => m[1])
+ expect(links.length).toBeGreaterThan(0)
+ expect(links.filter((u) => /^(https?:)?\/\//i.test(u))).toEqual([])
+ })
+
+ it('points every url() in the stylesheet at a file that exists here', () => {
+ const urls = [...css.matchAll(/url\(\s*['"]?([^'")]+)/g)].map((m) => m[1])
+ expect(urls.length, 'no url() to check').toBeGreaterThan(0)
+ for (const u of urls) {
+ expect(u, `${u} is not local`).not.toMatch(/^(https?:)?\/\//i)
+ expect(() => readFileSync(new URL(`./${u.replace(/^\//, '')}`, import.meta.url)), `${u} does not exist`).not.toThrow()
+ }
+ expect(css).not.toMatch(/@import/)
+ })
+})
+
+// AGENTS.md ยง7: colours come from the --ch-* tokens. Three box-shadows carried
+// a raw rgba() (review of #731), and a shadow is where the next one would go:
+// it reads as an effect, not as a colour.
+describe('colours', () => {
+ const css = readFileSync(new URL('./style.css', import.meta.url), 'utf8').replace(/\/\*[\s\S]*?\*\//g, '')
+ const tokens = [...css.matchAll(/--ch-[a-z0-9-]+\s*:\s*[^;]+;/g)]
+ const rules = css.replace(/--ch-[a-z0-9-]+\s*:\s*[^;]+;/g, '')
+
+ it('finds the token block, so stripping it strips something', () => {
+ expect(tokens.length).toBeGreaterThan(20)
+ })
+
+ it('writes no colour value outside the token block', () => {
+ expect(rules.match(/#[0-9a-f]{3,8}\b|rgba?\([^)]*\)|hsla?\([^)]*\)/gi) || []).toEqual([])
+ })
+})
+
+// The four surfaces as tabs above one shot. The markup is what a reader
+// without the script gets, so it has to be right on its own: one tab
+// selected, its panel shown, the others hidden, and each tab naming a panel
+// that exists.
+describe('the tour', () => {
+ const html = read('index.html')
+ const tabs = [...html.matchAll(/