@ryusei/code
Version:
<div align="center"> <a href="https://code.ryuseijs.com"> <img alt="RyuseiCode" src="https://code.ryuseijs.com/images/svg/logo.svg" width="70"> </a>
30 lines (23 loc) • 856 B
text/typescript
import { init } from '../../../../test';
describe( 'Lines#insert()', () => {
const Editor = init();
const { lines } = Editor.Components.Code;
test( 'can insert a line at the specified row.', () => {
lines.sync( 0, `1\n2\n3` );
lines.insert( 1 );
expect( lines[ 0 ].text ).toBe( '1' );
expect( lines[ 1 ].text ).toBe( '' );
expect( lines[ 2 ].text ).toBe( '2' );
expect( lines[ 3 ].text ).toBe( '3' );
} );
test( 'can insert lines at the specified row.', () => {
lines.sync( 0, `1\n2\n3` );
lines.insert( 1, 3 );
expect( lines[ 0 ].text ).toBe( '1' );
expect( lines[ 1 ].text ).toBe( '' );
expect( lines[ 2 ].text ).toBe( '' );
expect( lines[ 3 ].text ).toBe( '' );
expect( lines[ 4 ].text ).toBe( '2' );
expect( lines[ 5 ].text ).toBe( '3' );
} );
} );