generatePreviousNextLinks.js 977 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import t from 'tap';
  2. import {testContentFunctions} from '../lib/content-function.js';
  3. import * as html from '../../src/util/html.js';
  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. });