« get me outta code hell

content, test: remove generatePreviousNextLinks - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-10-22 13:57:09 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-11-02 22:25:48 -0300
commitc24956785120cf0a3fd8897f10924d01d5c38ed9 (patch)
treee723b9f3faf9a58cb9aaf86cc000ba6cda16e407
parent6de2f25e926d385c6ec69e4518b56844db8a08c6 (diff)
content, test: remove generatePreviousNextLinks
-rw-r--r--src/content/dependencies/generatePreviousNextLinks.js57
-rw-r--r--tap-snapshots/test/snapshot/generatePreviousNextLinks.js.test.cjs28
-rw-r--r--test/snapshot/generatePreviousNextLinks.js35
3 files changed, 0 insertions, 120 deletions
diff --git a/src/content/dependencies/generatePreviousNextLinks.js b/src/content/dependencies/generatePreviousNextLinks.js
deleted file mode 100644
index d9f80849..00000000
--- a/src/content/dependencies/generatePreviousNextLinks.js
+++ /dev/null
@@ -1,57 +0,0 @@
-export default {
-  // Returns an array with the slotted previous and next links, prepared
-  // for inclusion in a page's navigation bar. Include with other links
-  // in the nav bar and then join them all as a unit list, for example.
-
-  contentDependencies: ['generateNextLink', 'generatePreviousLink'],
-  extraDependencies: ['html', 'language'],
-
-  relations: (relation) => ({
-    previousLink:
-      relation('generatePreviousLink'),
-
-    nextLink:
-      relation('generateNextLink'),
-  }),
-
-  slots: {
-    previousLink: {
-      type: 'html',
-      mutable: true,
-    },
-
-    nextLink: {
-      type: 'html',
-      mutable: true,
-    },
-
-    id: {
-      type: 'boolean',
-      default: true,
-    },
-  },
-
-  generate(relations, slots, {html, language}) {
-    const previousNext = [];
-
-    relations.previousLink.setSlots({
-      link: slots.previousLink,
-      id: slots.id,
-    });
-
-    relations.nextLink.setSlots({
-      link: slots.nextLink,
-      id: slots.id,
-    });
-
-    if (!html.isBlank(slots.previousLink)) {
-      previousNext.push(relations.previousLink);
-    }
-
-    if (!html.isBlank(slots.nextLink)) {
-      previousNext.push(relations.nextLink);
-    }
-
-    return previousNext;
-  },
-};
diff --git a/tap-snapshots/test/snapshot/generatePreviousNextLinks.js.test.cjs b/tap-snapshots/test/snapshot/generatePreviousNextLinks.js.test.cjs
deleted file mode 100644
index b2c4c647..00000000
--- a/tap-snapshots/test/snapshot/generatePreviousNextLinks.js.test.cjs
+++ /dev/null
@@ -1,28 +0,0 @@
-/* IMPORTANT
- * This snapshot file is auto-generated, but designed for humans.
- * It should be checked into source control and tracked carefully.
- * Re-generate by setting TAP_SNAPSHOT=1 and running tests.
- * Make sure to inspect the output below.  Do not ignore changes!
- */
-'use strict'
-exports[`test/snapshot/generatePreviousNextLinks.js > TAP > generatePreviousNextLinks (snapshot) > basic behavior 1`] = `
-previous: { tooltipStyle: 'browser', color: false, attributes: { id: 'previous-button' }, content: Tag (no name, 1 items) }
-next: { tooltipStyle: 'browser', color: false, attributes: { id: 'next-button' }, content: Tag (no name, 1 items) }
-`
-
-exports[`test/snapshot/generatePreviousNextLinks.js > TAP > generatePreviousNextLinks (snapshot) > disable id 1`] = `
-previous: { tooltipStyle: 'browser', color: false, attributes: { id: false }, content: Tag (no name, 1 items) }
-next: { tooltipStyle: 'browser', color: false, attributes: { id: false }, content: Tag (no name, 1 items) }
-`
-
-exports[`test/snapshot/generatePreviousNextLinks.js > TAP > generatePreviousNextLinks (snapshot) > neither link present 1`] = `
-
-`
-
-exports[`test/snapshot/generatePreviousNextLinks.js > TAP > generatePreviousNextLinks (snapshot) > next missing 1`] = `
-previous: { tooltipStyle: 'browser', color: false, attributes: { id: 'previous-button' }, content: Tag (no name, 1 items) }
-`
-
-exports[`test/snapshot/generatePreviousNextLinks.js > TAP > generatePreviousNextLinks (snapshot) > previous missing 1`] = `
-next: { tooltipStyle: 'browser', color: false, attributes: { id: 'next-button' }, content: Tag (no name, 1 items) }
-`
diff --git a/test/snapshot/generatePreviousNextLinks.js b/test/snapshot/generatePreviousNextLinks.js
deleted file mode 100644
index 0d952f59..00000000
--- a/test/snapshot/generatePreviousNextLinks.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import t from 'tap';
-import * as html from '#html';
-import {testContentFunctions} from '#test-lib';
-
-testContentFunctions(t, 'generatePreviousNextLinks (snapshot)', async (t, evaluate) => {
-  await evaluate.load();
-
-  const quickSnapshot = (message, slots) =>
-    evaluate.snapshot(message, {
-      name: 'generatePreviousNextLinks',
-      slots,
-      postprocess: template => template.content.join('\n'),
-    });
-
-  quickSnapshot('basic behavior', {
-    previousLink: evaluate.stubTemplate('previous'),
-    nextLink: evaluate.stubTemplate('next'),
-  });
-
-  quickSnapshot('previous missing', {
-    nextLink: evaluate.stubTemplate('next'),
-  });
-
-  quickSnapshot('next missing', {
-    previousLink: evaluate.stubTemplate('previous'),
-  });
-
-  quickSnapshot('neither link present', {});
-
-  quickSnapshot('disable id', {
-    previousLink: evaluate.stubTemplate('previous'),
-    nextLink: evaluate.stubTemplate('next'),
-    id: false,
-  });
-});