You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/compiler/generate/utils/__test__.js

37 lines
722 B

8 years ago
import * as assert from 'assert';
import deindent from './deindent.js';
8 years ago
describe( 'deindent', () => {
it( 'deindents a simple string', () => {
const deindented = deindent`
deindent me please
`;
8 years ago
8 years ago
assert.equal( deindented, `deindent me please` );
});
8 years ago
8 years ago
it( 'deindents a multiline string', () => {
const deindented = deindent`
deindent me please
and me as well
`;
8 years ago
8 years ago
assert.equal( deindented, `deindent me please\nand me as well` );
});
8 years ago
8 years ago
it( 'preserves indentation of inserted values', () => {
const insert = deindent`
line one
line two
`;
8 years ago
8 years ago
const deindented = deindent`
before
${insert}
after
`;
8 years ago
8 years ago
assert.equal( deindented, `before\n\tline one\n\tline two\nafter` );
8 years ago
});
});