news.js: Variablen-Defaults ohne Spezifitaet, Combo-Umbruch, Bildmaße absichern

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
knsoandClaude Opus 5.5 committed 2026-09-30 17:19:40 +00:00
1 parent 035d1d5517
commit 0e0776b406
3 files changed
+43 -15

No files matched your search

+21
View File
@@ -183,6 +183,27 @@ await check('ohne_titel_keine_ueberschrift', async (page) => {
assert((await page.locator('.wkn-sig').count()) === 0, 'Signatur ohne Attribut')
})
await check('seiten_css_ueberschreibt_variablen', async (page) => {
await mockApi(page, { total: 1 })
await page.route('**/embed/news-demo.html', async (route) => {
const r = await route.fetch()
await route.fulfill({ response: r, body: (await r.text()).replace('</head>', '<style>[data-webklar-news]{--wkn-frame:rgb(10, 20, 30)}</style></head>') })
})
await page.goto(DEMO)
await page.locator('.wkn-pin').first().waitFor()
const c = await page.evaluate(() => getComputedStyle(document.querySelector('.wkn-board')).borderTopColor)
assert(c === 'rgb(10, 20, 30)', 'Rahmenfarbe nicht ueberschrieben: ' + c)
})
await check('combo_notiz_nie_schmal', async (page) => {
await mockApi(page, { total: 6 })
await page.goto(DEMO)
await page.locator('.wkn-pin').first().waitFor()
const w = await page.evaluate(() => [...document.querySelectorAll('.wkn-combo')].map((c) => ({ card: c.clientWidth, note: c.querySelector('.wkn-note').clientWidth, stacked: getComputedStyle(c.querySelector('.wkn-combo-in')).gridTemplateColumns.split(' ').length === 1 })))
assert(w.length > 0, 'kein Combo')
for (const x of w) assert(x.stacked ? true : x.note >= 140, 'Notiz zu schmal: ' + JSON.stringify(x))
})
// Screenshots
for (const [label, viewport] of [['desktop', { width: 1280, height: 900 }], ['phone', { width: 390, height: 844 }]]) {
for (const n of [1, 8]) {