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

20 lines
603 B
TypeScript

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(' ');
});
});