From 580b09abb160f86e6cce9a81e4e5b63d1aecadea Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Mon, 11 Apr 2016 15:29:39 +0200 Subject: [PATCH] babel-code-frame: Add test for code with tabs --- packages/babel-code-frame/test/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/babel-code-frame/test/index.js b/packages/babel-code-frame/test/index.js index 6027130307..910c1aad5a 100644 --- a/packages/babel-code-frame/test/index.js +++ b/packages/babel-code-frame/test/index.js @@ -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})