babel-code-frame: Add test for code with tabs

This commit is contained in:
Simon Lydell
2016-04-11 15:29:39 +02:00
parent 3cb9c90c31
commit 580b09abb1

View File

@@ -93,6 +93,20 @@ suite("babel-code-frame", function () {
].join("\n"));
});
test("tabs", function () {
const rawLines = [
"\tclass Foo {",
"\t \t\t constructor\t(\t)",
"\t};",
].join('\n');
assert.equal(codeFrame(rawLines, 2, 25), [
" 1 | \tclass Foo {",
"> 2 | \t \t\t constructor\t(\t)",
" | \t \t\t \t \t ^",
" 3 | \t};",
].join('\n'));
});
test("opts.highlightCode", function () {
const rawLines = "console.log('babel')";
const result = codeFrame(rawLines, 1, 9, {highlightCode: true})