mirror of
https://github.com/gchq/CyberChef
synced 2025-12-15 07:43:22 +00:00
diff.mjs: Fixes tests and adds default flag
* Sets default flag to `false` for `showSubtraction` flag.
* Removes extra span for else case that was causing some tests to
fail. Moreover, the previous behavior was defined as that.
* Adds custom test for the showSubtraction option, both using the
`showAdded` and `showRemoved` flags.
This commit is contained in:
@@ -50,7 +50,7 @@ class Diff extends Operation {
|
||||
{
|
||||
"name": "Show subtraction",
|
||||
"type": "boolean",
|
||||
"value": true
|
||||
"value": false
|
||||
},
|
||||
{
|
||||
"name": "Ignore whitespace",
|
||||
@@ -123,7 +123,7 @@ class Diff extends Operation {
|
||||
} else if (diff[i].removed) {
|
||||
if (showRemoved) output += "<span class='hl3'>" + Utils.escapeHtml(diff[i].value) + "</span>";
|
||||
} else if (!showSubtraction) {
|
||||
output += Utils.escapeHtml(diff[i].value) + "</span>";
|
||||
output += Utils.escapeHtml(diff[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user