Added UI tests for all HTML operations

This commit is contained in:
n1474335 2023-03-08 17:44:51 +00:00
parent 36aafb9246
commit 7eda2fd4a6
6 changed files with 131 additions and 55 deletions

View file

@ -24,7 +24,7 @@ class TranslateDateTimeFormat extends Operation {
this.description = "Parses a datetime string in one format and re-writes it in another.<br><br>Run with no input to see the relevant format string examples.";
this.infoURL = "https://momentjs.com/docs/#/parsing/string-format/";
this.inputType = "string";
this.outputType = "string";
this.outputType = "html";
this.args = [
{
"name": "Built in formats",
@ -58,7 +58,7 @@ class TranslateDateTimeFormat extends Operation {
/**
* @param {string} input
* @param {Object[]} args
* @returns {string}
* @returns {html}
*/
run(input, args) {
const [inputFormat, inputTimezone, outputFormat, outputTimezone] = args.slice(1);
@ -71,7 +71,7 @@ class TranslateDateTimeFormat extends Operation {
return `Invalid format.\n\n${FORMAT_EXAMPLES}`;
}
return date.tz(outputTimezone).format(outputFormat);
return date.tz(outputTimezone).format(outputFormat.replace(/[<>]/g, ""));
}
}