linkContribution.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. {artist: {
  11. name: 'Clark Powell',
  12. directory: 'clark-powell',
  13. urls: ['https://soundcloud.com/plazmataz'],
  14. }, annotation: null},
  15. ]},
  16. {args: [
  17. {artist: {
  18. name: 'Grounder & Scratch',
  19. directory: 'the-big-baddies',
  20. urls: [],
  21. }, annotation: 'Snooping'},
  22. ]},
  23. {args: [
  24. {artist: {
  25. name: 'Toby Fox',
  26. directory: 'toby-fox',
  27. urls: ['https://tobyfox.bandcamp.com/', 'https://toby.fox/'],
  28. }, annotation: 'Arrangement'},
  29. ]},
  30. ],
  31. slots,
  32. });
  33. quickSnapshot('showContribution & showIcons (inline)', {
  34. showContribution: true,
  35. showIcons: true,
  36. iconMode: 'inline',
  37. });
  38. quickSnapshot('showContribution & showIcons (tooltip)', {
  39. showContribution: true,
  40. showIcons: true,
  41. iconMode: 'tooltip',
  42. });
  43. quickSnapshot('only showContribution', {
  44. showContribution: true,
  45. });
  46. quickSnapshot('only showIcons (inline)', {
  47. showIcons: true,
  48. iconMode: 'inline',
  49. });
  50. quickSnapshot('only showIcons (tooltip)', {
  51. showContribution: true,
  52. showIcons: true,
  53. iconMode: 'tooltip',
  54. });
  55. quickSnapshot('no accents', {});
  56. evaluate.snapshot('loads of links (inline)', {
  57. name: 'linkContribution',
  58. args: [
  59. {artist: {name: 'Lorem Ipsum Lover', directory: 'lorem-ipsum-lover', urls: [
  60. 'https://loremipsum.io',
  61. 'https://loremipsum.io/generator/',
  62. 'https://loremipsum.io/#meaning',
  63. 'https://loremipsum.io/#usage-and-examples',
  64. 'https://loremipsum.io/#controversy',
  65. 'https://loremipsum.io/#when-to-use-lorem-ipsum',
  66. 'https://loremipsum.io/#lorem-ipsum-all-the-things',
  67. 'https://loremipsum.io/#original-source',
  68. ]}, annotation: null},
  69. ],
  70. slots: {showIcons: true},
  71. });
  72. evaluate.snapshot('loads of links (tooltip)', {
  73. name: 'linkContribution',
  74. args: [
  75. {artist: {name: 'Lorem Ipsum Lover', directory: 'lorem-ipsum-lover', urls: [
  76. 'https://loremipsum.io',
  77. 'https://loremipsum.io/generator/',
  78. 'https://loremipsum.io/#meaning',
  79. 'https://loremipsum.io/#usage-and-examples',
  80. 'https://loremipsum.io/#controversy',
  81. 'https://loremipsum.io/#when-to-use-lorem-ipsum',
  82. 'https://loremipsum.io/#lorem-ipsum-all-the-things',
  83. 'https://loremipsum.io/#original-source',
  84. ]}, annotation: null},
  85. ],
  86. slots: {showIcons: true, iconMode: 'tooltip'},
  87. });
  88. quickSnapshot('no preventWrapping', {
  89. showContribution: true,
  90. showIcons: true,
  91. preventWrapping: false,
  92. });
  93. });