diff --git a/app/gui2/src/components/GraphEditor/GraphNodeComment.vue b/app/gui2/src/components/GraphEditor/GraphNodeComment.vue index 4b63f33966cb..1821f128049b 100644 --- a/app/gui2/src/components/GraphEditor/GraphNodeComment.vue +++ b/app/gui2/src/components/GraphEditor/GraphNodeComment.vue @@ -1,10 +1,9 @@ + diff --git a/app/gui2/src/components/GraphEditor/__tests__/comments.test.ts b/app/gui2/src/components/GraphEditor/__tests__/comments.test.ts new file mode 100644 index 000000000000..cca476b25894 --- /dev/null +++ b/app/gui2/src/components/GraphEditor/__tests__/comments.test.ts @@ -0,0 +1,21 @@ +import { cookedTextToRaw, rawTextToCooked } from '@/components/GraphEditor/GraphNodeComment.vue' +import { expect, test } from 'vitest' + +const cases = [ + { + raw: 'First paragraph\n\nSecond paragraph', + cooked: 'First paragraph\nSecond paragraph', + }, + { + raw: 'First line\ncontinues on second line', + cooked: 'First line continues on second line', + normalized: 'First line continues on second line', + }, +] +test.each(cases)('Interpreting comments', ({ raw, cooked }) => { + expect(rawTextToCooked(raw)).toBe(cooked) +}) +test.each(cases)('Lowering comments', (testCase) => { + const { raw, cooked } = testCase + expect(cookedTextToRaw(cooked)).toBe(testCase?.normalized ?? raw) +})