generatePreviousNextLinks.js 942 B

123456789101112131415161718192021222324252627282930313233343536
  1. import t from 'tap';
  2. import * as html from '#html';
  3. import {testContentFunctions} from '#test-lib';
  4. testContentFunctions(t, 'generatePreviousNextLinks (snapshot)', async (t, evaluate) => {
  5. await evaluate.load();
  6. const quickSnapshot = (message, slots) =>
  7. evaluate.snapshot(message, {
  8. name: 'generatePreviousNextLinks',
  9. slots,
  10. postprocess: template => template.content.join('\n'),
  11. });
  12. quickSnapshot('basic behavior', {
  13. previousLink: evaluate.stubTemplate('previous'),
  14. nextLink: evaluate.stubTemplate('next'),
  15. });
  16. quickSnapshot('previous missing', {
  17. nextLink: evaluate.stubTemplate('next'),
  18. });
  19. quickSnapshot('next missing', {
  20. previousLink: evaluate.stubTemplate('previous'),
  21. });
  22. quickSnapshot('neither link present', {});
  23. quickSnapshot('disable id', {
  24. previousLink: evaluate.stubTemplate('previous'),
  25. nextLink: evaluate.stubTemplate('next'),
  26. id: false,
  27. });
  28. });