diff options
Diffstat (limited to 'test/snapshot/linkTemplate.js')
-rw-r--r-- | test/snapshot/linkTemplate.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/test/snapshot/linkTemplate.js b/test/snapshot/linkTemplate.js new file mode 100644 index 0000000..300065e --- /dev/null +++ b/test/snapshot/linkTemplate.js @@ -0,0 +1,63 @@ +import t from 'tap'; +import * as html from '#html'; +import {testContentFunctions} from '#test-lib'; + +testContentFunctions(t, 'linkTemplate (snapshot)', async (t, evaluate) => { + await evaluate.load(); + + evaluate.snapshot('fill many slots', { + name: 'linkTemplate', + + slots: { + 'href': 'https://hsmusic.wiki/media/cool file.pdf', + 'hash': 'fooey', + 'attributes': {class: 'dog', id: 'cat1'}, + 'content': 'My Cool Link', + }, + }); + + evaluate.snapshot('fill path slot & provide appendIndexHTML', { + name: 'linkTemplate', + + extraDependencies: { + to: (...path) => '/c*lzone/' + path.join('/') + '/', + appendIndexHTML: true, + }, + + slots: { + path: ['myCoolPath', 'ham', 'pineapple', 'tomato'], + content: 'delish', + }, + }); + + evaluate.snapshot('special characters in path argument', { + name: 'linkTemplate', + slots: { + path: [ + 'media.albumAdditionalFile', + 'homestuck-vol-1', + 'Showtime (Piano Refrain) - #xXxAwesomeSheetMusick?rxXx#.pdf', + ], + content: `Damn, that's some good sheet music`, + }, + }); + + evaluate.snapshot('missing content', { + name: 'linkTemplate', + slots: {href: 'banana'}, + }); + + evaluate.snapshot('link in content', { + name: 'linkTemplate', + slots: { + hash: 'the-more-ye-know', + content: [ + `Oh geez oh heck`, + html.tag('a', {href: 'dogs'}, `There's a link in here!!`), + `But here's <b>a normal tag.</b>`, + html.tag('div', `Gotta keep them normal tags.`), + html.tag('div', `But not... <a href="#">NESTED LINKS, OOO.</a>`), + ], + }, + }); +}); |