summaryrefslogtreecommitdiff
path: root/test/test-options-util.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-07-06 19:43:53 -0400
committerGitHub <noreply@github.com>2021-07-06 19:43:53 -0400
commite88d63fc6d251bc298eb721fee1cbb9f5f4b752e (patch)
treef24b38bd421da53f84ab6b47ddff3c6492d44087 /test/test-options-util.js
parente15513208584764526e2348ca7796ea665925086 (diff)
Template renderer media updates (#1802)
* Add TemplateRendererMediaProvider to abstract media-related functionality * Update representation of injected media * Update templates * Update upgrade file * Update tests * Update test data * Force media to be an object * Update test data
Diffstat (limited to 'test/test-options-util.js')
-rw-r--r--test/test-options-util.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/test-options-util.js b/test/test-options-util.js
index 986ba040..b942c66f 100644
--- a/test/test-options-util.js
+++ b/test/test-options-util.js
@@ -952,6 +952,54 @@ async function testFieldTemplatesUpdate(extDir) {
{{~else~}}
<ul>{{#each glossary}}<li>{{#formatGlossary ../dictionary}}{{{.}}}{{/formatGlossary}}</li>{{/each}}</ul>
{{~/if~}}`.trimStart()
+ },
+ // hasMedia/getMedia update
+ {
+ oldVersion: 12,
+ newVersion: 13,
+ old: `
+{{#*inline "audio"}}
+ {{~#if definition.audioFileName~}}
+ [sound:{{definition.audioFileName}}]
+ {{~/if~}}
+{{/inline}}
+
+{{#*inline "screenshot"}}
+ <img src="{{definition.screenshotFileName}}" />
+{{/inline}}
+
+{{#*inline "clipboard-image"}}
+ {{~#if definition.clipboardImageFileName~}}
+ <img src="{{definition.clipboardImageFileName}}" />
+ {{~/if~}}
+{{/inline}}
+
+{{#*inline "clipboard-text"}}
+ {{~#if definition.clipboardText~}}{{definition.clipboardText}}{{~/if~}}
+{{/inline}}`.trimStart(),
+
+ expected: `
+{{#*inline "audio"}}
+ {{~#if (hasMedia "audio")~}}
+ [sound:{{#getMedia "audio" format="fileName"}}{{/getMedia}}]
+ {{~/if~}}
+{{/inline}}
+
+{{#*inline "screenshot"}}
+ {{~#if (hasMedia "screenshot")~}}
+ <img src="{{#getMedia "screenshot" format="fileName"}}{{/getMedia}}" />
+ {{~/if~}}
+{{/inline}}
+
+{{#*inline "clipboard-image"}}
+ {{~#if (hasMedia "clipboardImage")~}}
+ <img src="{{#getMedia "clipboardImage" format="fileName"}}{{/getMedia}}" />
+ {{~/if~}}
+{{/inline}}
+
+{{#*inline "clipboard-text"}}
+ {{~#if (hasMedia "clipboardText")}}{{#getMedia "clipboardText" format="text"}}{{/getMedia}}{{/if~}}
+{{/inline}}`.trimStart()
}
];