diff --git a/plugin-designs/country-posters/scripts/check-poster-section.mjs b/plugin-designs/country-posters/scripts/check-poster-section.mjs index b432f21c7..6e823dfce 100644 --- a/plugin-designs/country-posters/scripts/check-poster-section.mjs +++ b/plugin-designs/country-posters/scripts/check-poster-section.mjs @@ -101,6 +101,22 @@ async function arms({ types, country, element, sectionSrc, viewSrc, cs }) { const local = new Set(['sec', 'z', 'item', 'n', 's', 'v', 'el', 'true', 'false', 'null', 'String', 'Number', '$event', 'in', 'label', 'zIndex']) const missing = [...used].filter((x) => !local.has(x) && !injected.has(x)) if (missing.length) fails.push(`E: PosterSection.vue uses names it does not inject: ${missing.join(', ')}`) + // G: a phone cannot print a desktop-only large sheet THROUGH THE TYPE — the same rule as country-poster-wall.vue, + // mirrored in countryPosterType so the delegating regions list and any block it too. The only + // desktop-only large sheet is India's (withheld today), so the fixture is a NON-withheld India (indiaState => not + // withheld => largeSheet.desktopOnly). POISON: drop the phone rule and records() resolves / unsupported() is null. + { + const savedNav = globalThis.navigator + globalThis.navigator = { userAgent: 'iPhone', maxTouchPoints: 0 } + try { + const act = country.actions({ assetsBase: () => '', apiBase: () => '', lang: () => 'en', profileConfig: null, t: (k) => k }) + const bigIndia = { id: 'country-ind-x', iso3: 'IND', indiaState: true, label: 'India', count: 855 } + if (act.unsupported(bigIndia) !== 'poster.phoneLimitAll') fails.push(`G: on a phone, unsupported() of a desktop-only large sheet should read poster.phoneLimitAll, got ${JSON.stringify(act.unsupported(bigIndia))}`) + let why = '' + try { await act.records(bigIndia); why = 'resolved' } catch (e) { why = e && (e.i18nKey || e.message) } + if (why !== 'poster.phoneLimitAll') fails.push(`G: on a phone, records() of a desktop-only large sheet should reject poster.phoneLimitAll, got ${JSON.stringify(why)}`) + } finally { if (savedNav === undefined) delete globalThis.navigator; else globalThis.navigator = savedNav } + } return fails } @@ -136,7 +152,7 @@ try { } else { const f = await arms(real) if (f.length) { f.forEach((x) => console.log('FAIL ' + x)); code = 1 } - else console.log(`PASS check:poster-section — the 'country' type; ${DXL.length} DX Life scopes cover every country once (and their other spellings); India withheld by default; the element's attributes; PosterSection injects every name it uses`) + else console.log(`PASS check:poster-section — the 'country' type; ${DXL.length} DX Life scopes cover every country once (and their other spellings); India withheld by default; a phone blocks a desktop-only large sheet (poster.phoneLimitAll); the element's attributes; PosterSection injects every name it uses`) } } finally { await server.close() } process.exit(code)