linkContribution.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import t from 'tap';
  2. import {testContentFunctions} from '#test-lib';
  3. testContentFunctions(t, 'linkContribution (snapshot)', async (t, evaluate) => {
  4. await evaluate.load();
  5. const quickSnapshot = (message, slots) =>
  6. evaluate.snapshot(message, {
  7. name: 'linkContribution',
  8. multiple: [
  9. {args: [
  10. {who: {
  11. name: 'Clark Powell',
  12. directory: 'clark-powell',
  13. urls: ['https://soundcloud.com/plazmataz'],
  14. }, what: null},
  15. ]},
  16. {args: [
  17. {who: {
  18. name: 'Grounder & Scratch',
  19. directory: 'the-big-baddies',
  20. urls: [],
  21. }, what: 'Snooping'},
  22. ]},
  23. {args: [
  24. {who: {
  25. name: 'Toby Fox',
  26. directory: 'toby-fox',
  27. urls: ['https://tobyfox.bandcamp.com/', 'https://toby.fox/'],
  28. }, what: 'Arrangement'},
  29. ]},
  30. ],
  31. slots,
  32. });
  33. quickSnapshot('showContribution & showIcons', {
  34. showContribution: true,
  35. showIcons: true,
  36. });
  37. quickSnapshot('only showContribution', {
  38. showContribution: true,
  39. });
  40. quickSnapshot('only showIcons', {
  41. showIcons: true,
  42. });
  43. quickSnapshot('no accents', {});
  44. evaluate.snapshot('loads of links', {
  45. name: 'linkContribution',
  46. args: [
  47. {who: {name: 'Lorem Ipsum Lover', directory: 'lorem-ipsum-lover', urls: [
  48. 'https://loremipsum.io',
  49. 'https://loremipsum.io/generator/',
  50. 'https://loremipsum.io/#meaning',
  51. 'https://loremipsum.io/#usage-and-examples',
  52. 'https://loremipsum.io/#controversy',
  53. 'https://loremipsum.io/#when-to-use-lorem-ipsum',
  54. 'https://loremipsum.io/#lorem-ipsum-all-the-things',
  55. 'https://loremipsum.io/#original-source',
  56. ]}, what: null},
  57. ],
  58. slots: {showIcons: true},
  59. });
  60. quickSnapshot('no preventWrapping', {
  61. showContribution: true,
  62. showIcons: true,
  63. preventWrapping: false,
  64. });
  65. });