Improve formatting features in the editor (#7104)

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Alexander Stephan
2022-03-16 09:46:07 +00:00
committed by GitHub
co-authored by Michael Telatynski
parent cbf5fbf870
commit 26e6f8deca
8 changed files with 427 additions and 59 deletions
+17
View File
@@ -104,4 +104,21 @@ describe('editor/range', function() {
range.trim();
expect(range.parts[0].text).toBe("abc");
});
// test for edge case when the selection just consists of whitespace
it('range trim just whitespace', () => {
const renderer = createRenderer();
const pc = createPartCreator();
const whitespace = " \n \n\n";
const model = new EditorModel([
pc.plain(whitespace),
], pc, renderer);
const range = model.startRange(
model.positionForOffset(0, false),
model.getPositionAtEnd(),
);
expect(range.text).toBe(whitespace);
range.trim();
expect(range.text).toBe("");
});
});