« get me outta code hell

linkTemplate.js « snapshot « test - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/snapshot/linkTemplate.js
blob: bef0935cffff22a2226242a7664564cc14b2d024 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import t from 'tap';
import {testContentFunctions} from '../lib/content-function.js';

testContentFunctions(t, 'linkTemplate (snapshot)', async (t, evaluate) => {
  await evaluate.load();

  evaluate.snapshot('fill many slots', {
    name: 'linkTemplate',

    extraDependencies: {
      getColors: c => ({primary: c + 'ff', dim: c + '77'}),
    },

    slots: {
      'color': '#123456',
      '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'],
    },
  });
});