Fix #1205 Also remove markdown from title when the note only has one line

Includes a few more unit tests for this method
This commit is contained in:
Stefan Niedermann 2021-05-12 15:24:07 +02:00
parent 303f335fac
commit 3bf57cd285
3 changed files with 6 additions and 2 deletions

View file

@ -117,7 +117,7 @@ public class NoteUtil {
line = removeMarkdown(lines[currentLine]); line = removeMarkdown(lines[currentLine]);
} }
} else { } else {
line = content; line = removeMarkdown(content);
} }
return line; return line;
} }

View file

@ -35,6 +35,9 @@ public class NoteUtilTest extends TestCase {
assertEquals("Test", NoteUtil.getLineWithoutMarkdown("\nTest", 0)); assertEquals("Test", NoteUtil.getLineWithoutMarkdown("\nTest", 0));
assertEquals("Foo", NoteUtil.getLineWithoutMarkdown("Foo\nBar", 0)); assertEquals("Foo", NoteUtil.getLineWithoutMarkdown("Foo\nBar", 0));
assertEquals("Bar", NoteUtil.getLineWithoutMarkdown("Foo\nBar", 1)); assertEquals("Bar", NoteUtil.getLineWithoutMarkdown("Foo\nBar", 1));
assertEquals("Foo", NoteUtil.getLineWithoutMarkdown("* Foo\n* Bar", 0));
assertEquals("Bar", NoteUtil.getLineWithoutMarkdown("- Foo\nBar", 1));
assertEquals("Foo", NoteUtil.getLineWithoutMarkdown("# Foo", 0));
} }
@Test @Test

View file

@ -1 +1,2 @@
- ⚙️ Enhancing toggling of existing punctuation in the editor (#1193) - by @Jimmy-7664 - ⚙️ Enhancing toggling of existing punctuation in the editor (#1193) - by @Jimmy-7664
- 🐞 Also remove markdown from title when the note only has one line (#1205)