1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-30 10:36:35 +02:00
joplin/packages/editor/CodeMirror/utils/formatting/tabsToSpaces.test.ts

20 lines
603 B
TypeScript
Raw Normal View History

import { indentUnit } from '@codemirror/language';
import { EditorSelection, EditorState } from '@codemirror/state';
import tabsToSpaces from './tabsToSpaces';
describe('tabsToSpaces', () => {
it('should convert tabs to spaces based on indentUnit', () => {
const state: EditorState = EditorState.create({
doc: 'This is a test.',
selection: EditorSelection.cursor(0),
extensions: [
indentUnit.of(' '),
],
});
expect(tabsToSpaces(state, '\t')).toBe(' ');
expect(tabsToSpaces(state, '\t ')).toBe(' ');
expect(tabsToSpaces(state, ' \t ')).toBe(' ');
});
});