« get me outta code hell

html: drastically simplify template/slot system - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-04-08 16:54:39 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-04-08 16:54:39 -0300
commit776abf8d697716902692f357c6f179c1e681369f (patch)
treea75e7f63ffc13121c3c08f1f78c10bc883b4d4e1 /test
parent0cbfa8c1b70080c7ec4eb352902cf76f8ef30fcf (diff)
html: drastically simplify template/slot system
Diffstat (limited to 'test')
-rw-r--r--test/snapshot/generateAdditionalFilesList.js4
-rw-r--r--test/unit/util/html.js17
2 files changed, 7 insertions, 14 deletions
diff --git a/test/snapshot/generateAdditionalFilesList.js b/test/snapshot/generateAdditionalFilesList.js
index ce876d8d..0c27ad19 100644
--- a/test/snapshot/generateAdditionalFilesList.js
+++ b/test/snapshot/generateAdditionalFilesList.js
@@ -42,7 +42,7 @@ testContentFunctions(t, 'generateAdditionalFilesList (snapshot)', async (t, eval
       ],
     ],
     postprocess: template => template
-      .slot('additionalFileLinks', {
+      .slot('fileLinks', {
         'sburbwp_1280x1024.jpg': 'link to 1280x1024',
         'sburbwp_1440x900.jpg': 'link to 1440x900',
         'sburbwp_1920x1080.jpg': null,
@@ -50,7 +50,7 @@ testContentFunctions(t, 'generateAdditionalFilesList (snapshot)', async (t, eval
         'Homestuck_Vol4_alt2.jpg': null,
         'Homestuck_Vol4_alt3.jpg': 'link to alt3',
       })
-      .slot('additionalFileSizes', {
+      .slot('fileSizes', {
         'sburbwp_1280x1024.jpg': 2500,
         'sburbwp_1440x900.jpg': null,
         'sburbwp_1920x1080.jpg': null,
diff --git a/test/unit/util/html.js b/test/unit/util/html.js
index 9925d2da..045dad91 100644
--- a/test/unit/util/html.js
+++ b/test/unit/util/html.js
@@ -1,10 +1,10 @@
 import t from 'tap';
 
 import * as html from '../../../src/util/html.js';
-const {Tag, Attributes, Template, Slot} = html;
+const {Tag, Attributes, Template} = html;
 
 t.test(`html.tag`, t => {
-  t.plan(16);
+  t.plan(14);
 
   const tag1 =
     html.tag('div',
@@ -26,10 +26,8 @@ t.test(`html.tag`, t => {
   t.equal(tag2.content[1], 'children');
 
   const genericTag = html.tag('div');
-  let genericSlot;
-  const genericTemplate = html.template(slot => {
-    genericSlot = slot('title');
-    return html.blank();
+  const genericTemplate = html.template({
+    content: () => html.blank(),
   });
 
   // 9-10: tag treated as content, not attributes
@@ -42,12 +40,7 @@ t.test(`html.tag`, t => {
   t.equal(tag4.content.length, 1);
   t.equal(tag4.content[0], genericTemplate);
 
-  // 13-14: slot treated as content, not attributes
-  const tag5 = html.tag('div', genericSlot);
-  t.equal(tag5.content.length, 1);
-  t.equal(tag5.content[0], genericSlot);
-
-  // 15-16: deep flattening support
+  // 13-14: deep flattening support
   const tag6 =
     html.tag('div', [
       true &&