mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 03:19:11 +08:00
MarkdownToolbar: Bold: Add more tests
This commit is contained in:
@ -110,6 +110,8 @@ TextEditingValue modifyCurrentWord(
|
||||
var wordStartPos = text.lastIndexOf(' ', cursorPos == 0 ? 0 : cursorPos - 1);
|
||||
if (wordStartPos == -1) {
|
||||
wordStartPos = 0;
|
||||
} else {
|
||||
wordStartPos += 1;
|
||||
}
|
||||
|
||||
var wordEndPos = text.indexOf(' ', cursorPos);
|
||||
|
@ -146,4 +146,24 @@ void main() {
|
||||
char: '**',
|
||||
);
|
||||
});
|
||||
|
||||
test("Surrounds the middle word", () {
|
||||
_testWord(
|
||||
before: 'Hello Hydra Person',
|
||||
beforeOffset: 8,
|
||||
after: 'Hello **Hydra** Person',
|
||||
afterOffset: 13,
|
||||
char: '**',
|
||||
);
|
||||
});
|
||||
|
||||
test("Removes the middle word", () {
|
||||
_testWord(
|
||||
before: 'Hello **Hydra** Person',
|
||||
beforeOffset: 9,
|
||||
after: 'Hello Hydra Person',
|
||||
afterOffset: 11,
|
||||
char: '**',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user