Files
Webklar-Kundenbereich/test/support/knHuelle.js
T
2026-10-16 15:48:54 +00:00

24 lines
810 B
JavaScript

// Testhilfen der Kundenansicht-Hülle (P1): Quelltext aus public/neu/ lesen, ohne Browser.
import { existsSync, readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import path from 'node:path'
const NEU = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'public', 'neu')
// Die Handy-Abfrage steht im CSS genau so (und in JS einmal als HANDY_ABFRAGE in leiste.js).
export const HANDY = '@media (max-width: 880px), (pointer: coarse) and (max-height: 500px)'
export function lies(datei) {
return readFileSync(path.join(NEU, datei), 'utf8')
}
export function da(datei) {
return existsSync(path.join(NEU, datei))
}
// Text ab der ersten Handy-Abfrage, sonst ''.
export function handyTeil(css) {
const i = css.indexOf(HANDY)
return i === -1 ? '' : css.slice(i)
}