diff --git a/src/core/operations/Diff.mjs b/src/core/operations/Diff.mjs index 921369e8..84107245 100644 --- a/src/core/operations/Diff.mjs +++ b/src/core/operations/Diff.mjs @@ -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 += "" + Utils.escapeHtml(diff[i].value) + ""; } else if (!showSubtraction) { - output += Utils.escapeHtml(diff[i].value) + ""; + output += Utils.escapeHtml(diff[i].value); } } diff --git a/tests/operations/tests/StrUtils.mjs b/tests/operations/tests/StrUtils.mjs index 9098d2f1..c78b6b23 100644 --- a/tests/operations/tests/StrUtils.mjs +++ b/tests/operations/tests/StrUtils.mjs @@ -15,7 +15,29 @@ TestRegister.addTests([ recipeConfig: [ { "op": "Diff", - "args": ["\\n\\n", "Character", true, true, false] + "args": ["\\n\\n", "Character", true, true, false, false] + } + ], + }, + { + name: "Diff added with subtraction, basic usage", + input: "testing23\n\ntesting123", + expectedOutput: "1", + recipeConfig: [ + { + "op": "Diff", + "args": ["\\n\\n", "Character", true, true, true, false] + } + ], + }, + { + name: "Diff removed with subtraction, basic usage", + input: "testing123\n\ntesting3", + expectedOutput: "12", + recipeConfig: [ + { + "op": "Diff", + "args": ["\\n\\n", "Character", true, true, true, false] } ], },