« get me outta code hell

Merge branch 'data-steps' of github.com:hsmusic/hsmusic-wiki into data-steps - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/unit
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-06-12 15:54:24 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-12 15:54:24 -0300
commit630af0a345f3be6c3e4aa3300ce138e48ed5ae91 (patch)
tree91cc3c76cebf93bf1042e89c05bc8f8d8442aff9 /test/unit
parent0e150bbdf4c384bd2eee6fe3e06ab7b4eb3563da (diff)
parent05df0a1199dca320e0c8b92d210e6ab6e9676dfb (diff)
Merge branch 'data-steps' of github.com:hsmusic/hsmusic-wiki into data-steps
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/util/html.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/unit/util/html.js b/test/unit/util/html.js
index 82f96b48..01a510ec 100644
--- a/test/unit/util/html.js
+++ b/test/unit/util/html.js
@@ -904,3 +904,31 @@ t.test(`Template - slot value errors`, t => {
       `arrayOfHTML length: 0`,
     ]).toString());
 });
+
+t.test(`Stationery`, t => {
+  t.plan(3);
+
+  // 1-3: basic behavior
+
+  const stationery1 = new html.Stationery({
+    slots: {
+      slot1: {type: 'string', default: 'apricot'},
+      slot2: {type: 'string', default: 'disaster'},
+    },
+
+    content: ({slot1, slot2}) => html.tag('span', `${slot1} ${slot2}`),
+  });
+
+  const template1 = stationery1.template();
+  const template2 = stationery1.template();
+
+  template2.setSlots({slot1: 'aquaduct', slot2: 'dichotomy'});
+
+  const template3 = stationery1.template();
+
+  template3.setSlots({slot2: 'vinaigrette'});
+
+  t.equal(template1.toString(), `<span>apricot disaster</span>`);
+  t.equal(template2.toString(), `<span>aquaduct dichotomy</span>`);
+  t.equal(template3.toString(), `<span>apricot vinaigrette</span>`);
+});