Terminplaner: Hinweistexte nach Recherche, Storno nur bei Preis
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
722c686690
commit
6ec8885bfd
11 files changed
+230
-21
No files matched your search
@@ -215,6 +215,39 @@ test('Farbparitaet: Widget und Farbvorschlag des Servers (einbauanleitung.js) wa
|
||||
assert.equal(anzahl, 4096)
|
||||
})
|
||||
|
||||
// ---------------------------------------------------------------- Stornobedingungen nur bei Leistungen mit Preis (TP2 F11)
|
||||
|
||||
/** Die reine Funktion stornoGilt des Skripts (zwischen den Marken @storno-anfang und @storno-ende) einzeln ausfuehren. */
|
||||
function stornoFunktion() {
|
||||
const m = /\/\/ @storno-anfang[^\n]*\n([\s\S]*?)\/\/ @storno-ende/.exec(QUELLE)
|
||||
assert.ok(m, 'Marken @storno-anfang/@storno-ende fehlen')
|
||||
return vm.runInNewContext(`${m[1]}; stornoGilt`, {})
|
||||
}
|
||||
|
||||
test('widget_storno_je_leistung: Box, Haken und Pruefung der Stornobedingungen haengen am Preis der gewaehlten Leistung', () => {
|
||||
const stornoGilt = stornoFunktion()
|
||||
const storno = { text: 'Absage bis 24 Stunden vorher.', version: '2026-10-02-1' }
|
||||
// nur mit Stornotext des Betriebs UND einer Leistung mit Preis (l.preis ist der Preistext des Servers, '' ohne Preis)
|
||||
assert.equal(stornoGilt(storno, { id: 's1', preis: '45,00 €' }), true)
|
||||
assert.equal(stornoGilt(storno, { id: 's1', preis: 'ab 45,00 €' }), true)
|
||||
assert.equal(stornoGilt(storno, { id: 's2', preis: '' }), false, 'kostenlos: weder Box noch Haken noch Pruefung')
|
||||
assert.equal(stornoGilt(storno, { id: 's2' }), false)
|
||||
assert.equal(stornoGilt(storno, { id: 's2', preis: null }), false)
|
||||
assert.equal(stornoGilt(storno, null), false)
|
||||
assert.equal(stornoGilt(storno, undefined), false)
|
||||
assert.equal(stornoGilt(null, { id: 's1', preis: '45,00 €' }), false, 'kein Stornotext beim Betrieb')
|
||||
assert.equal(stornoGilt(undefined, { id: 's1', preis: '45,00 €' }), false)
|
||||
// im Zusammenfassungs-Schritt: Box, Haken und Pruefung fragen alle stornoGilt(…, l) – nie mehr nur c.storno
|
||||
assert.match(OHNE_KOMMENTARE, /var stornoAn = stornoGilt\(c\.storno, l\)/)
|
||||
assert.match(OHNE_KOMMENTARE, /if \(stornoAn && istText\(c\.storno\.text\)\) \{\s*sb\.appendChild\(el\('h3', '', 'Stornobedingungen'\)\)/, 'Box nur mit Stornotext und Preis')
|
||||
assert.match(OHNE_KOMMENTARE, /if \(\(stornoAn && istText\(c\.storno\.text\)\) \|\| agbUrl\) \{/, 'der AGB-Link bleibt unabhaengig vom Preis')
|
||||
assert.match(OHNE_KOMMENTARE, /if \(stornoAn\) form\.appendChild\(haken\(refs, 'storno', c\.texte\.storno, dd\.storno, true,/)
|
||||
assert.match(OHNE_KOMMENTARE, /if \(stornoAn && !dd\.storno\) f\.storno = /)
|
||||
assert.doesNotMatch(OHNE_KOMMENTARE, /if \(c\.storno\)|if \(c\.storno &&|c\.storno && !dd\.storno/, 'kein Haken und keine Pruefung allein nach c.storno')
|
||||
// gesendet wird der Haken nur, wenn er gezeigt wurde
|
||||
assert.match(OHNE_KOMMENTARE, /zustimmungen: \{ storno: stornoGilt\(S\.cfg\.storno, aktuelleLeistung\(\)\) && !!dd\.storno, vorzeitig: !!dd\.vorzeitig \}/)
|
||||
})
|
||||
|
||||
// ---------------------------------------------------------------- Demo und Einbauanleitung
|
||||
|
||||
test('Demo-Seite: noindex, Ausweichtext, Skript per defer, beide Modi', () => {
|
||||
|
||||
Reference in new issue
Block a user