« get me outta code hell

test: transformContent: escaping tests (snapshot) - 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-02-17 21:10:11 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-02-17 21:10:11 -0400
commit5deabd42ad8ca2fc049a4ccb24a7892b0dcc7356 (patch)
tree8c7f5b9293db7473b3e1af6941447a0298731831
parent08657e2d05c5a375112222cd0aa6bc291bca542d (diff)
test: transformContent: escaping tests (snapshot)
-rw-r--r--tap-snapshots/test/snapshot/transformContent.js.test.cjs17
-rw-r--r--test/snapshot/transformContent.js17
2 files changed, 34 insertions, 0 deletions
diff --git a/tap-snapshots/test/snapshot/transformContent.js.test.cjs b/tap-snapshots/test/snapshot/transformContent.js.test.cjs
index 8dfa7b0f..8d29d967 100644
--- a/tap-snapshots/test/snapshot/transformContent.js.test.cjs
+++ b/tap-snapshots/test/snapshot/transformContent.js.test.cjs
@@ -5,11 +5,28 @@
  * Make sure to inspect the output below.  Do not ignore changes!
  */
 'use strict'
+exports[`test/snapshot/transformContent.js > TAP > transformContent (snapshot) > basic markdown 1`] = `
+<p>Hello <em>world!</em> This is <strong>SO COOL.</strong></p>
+`
+
 exports[`test/snapshot/transformContent.js > TAP > transformContent (snapshot) > dates 1`] = `
 <p><time datetime="Thu, 13 Apr 2023 00:00:00 GMT">4/12/2023</time> Yep!</p>
 <p>Very nice: <time datetime="Fri, 25 Oct 2413 03:00:00 GMT">10/25/2413</time></p>
 `
 
+exports[`test/snapshot/transformContent.js > TAP > transformContent (snapshot) > escape end of tag 1`] = `
+<p>My favorite album is <a style="--primary-color: #123456" href="to-localized.album/cool-album">[Tactical Omission]</a>.</p>
+<p>Your favorite album is <a style="--primary-color: #123456" href="to-localized.album/cool-album">[Tactical Wha-Huh-Now</a>].</p>
+`
+
+exports[`test/snapshot/transformContent.js > TAP > transformContent (snapshot) > escape entire tag 1`] = `
+<p>[[album:cool-album|spooky]] <a style="--primary-color: #123456" href="to-localized.album/cool-album">scary</a></p>
+`
+
+exports[`test/snapshot/transformContent.js > TAP > transformContent (snapshot) > escape markdown 1`] = `
+<p>What will it be, <em>ye fool?</em> *arr*</p>
+`
+
 exports[`test/snapshot/transformContent.js > TAP > transformContent (snapshot) > hanging indent list 1`] = `
 <p>Hello!</p>
 <ul>
diff --git a/test/snapshot/transformContent.js b/test/snapshot/transformContent.js
index 740d94df..87e337e4 100644
--- a/test/snapshot/transformContent.js
+++ b/test/snapshot/transformContent.js
@@ -109,6 +109,23 @@ testContentFunctions(t, 'transformContent (snapshot)', async (t, evaluate) => {
       `Neat listing: [[string:listingPage.listAlbums.byDate.title]]`);
 
   quickSnapshot(
+    'basic markdown',
+      `Hello *world!* This is **SO COOL.**`);
+
+  quickSnapshot(
+    'escape entire tag',
+      `\\[[album:cool-album|spooky]] [[album:cool-album|scary]]`);
+
+  quickSnapshot(
+    'escape end of tag',
+      `My favorite album is [[album:cool-album|[Tactical Omission\\]]].\n` +
+      `Your favorite album is [[album:cool-album|[Tactical Wha-Huh-Now]]].`);
+
+  quickSnapshot(
+    'escape markdown',
+      `What will it be, *ye fool?* \\*arr*`);
+
+  quickSnapshot(
     'lyrics - basic line breaks',
       `Hey, ho\n` +
       `And away we go\n` +