diff --git a/src/utils.js b/src/utils.js index 1ec3100..aa4af8a 100644 --- a/src/utils.js +++ b/src/utils.js @@ -18,8 +18,7 @@ .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, ''') - .replace(/\//g, '/') - .replace(/\t/g, ' '); + .replace(/\//g, '/'); }; Utils.prototype.startsWith = function(str, start) { diff --git a/test/line-by-line-tests.js b/test/line-by-line-tests.js index 45fef7d..529a71d 100644 --- a/test/line-by-line-tests.js +++ b/test/line-by-line-tests.js @@ -1,5 +1,4 @@ var assert = require('assert'); -var Utils = require('../src/utils.js').Utils; var LineByLinePrinter = require('../src/line-by-line-printer.js').LineByLinePrinter; @@ -109,11 +108,11 @@ describe('LineByLinePrinter', function() { assert.equal(expected, fileHtml); }); - it('should convert indents into non breakin spaces (one tab)', function() { + it('should preserve tabs', function() { var diffParser = require('../src/diff-parser.js').DiffParser; var lineByLinePrinter = new LineByLinePrinter({}); var fileHtml = lineByLinePrinter.makeLineHtml(false, - diffParser.LINE_TYPE.INSERTS, '', 30, Utils.escape('\ttest'), '+'); + diffParser.LINE_TYPE.INSERTS, '', 30, '\ttest', '+'); fileHtml = fileHtml.replace(/\n\n+/g, '\n'); var expected = '\n' + ' \n' + @@ -124,7 +123,7 @@ describe('LineByLinePrinter', function() { ' \n' + '
\n' + ' +\n' + - ' test\n' + + ' \ttest\n' + '
\n' + ' \n' + ''; diff --git a/test/utils-tests.js b/test/utils-tests.js index 90b478b..fec64a9 100644 --- a/test/utils-tests.js +++ b/test/utils-tests.js @@ -18,7 +18,7 @@ describe('Utils', function() { }); it('should escape a string with multiple problematic characters', function() { var result = Utils.escape('\tlink text'); - var expected = '<a href="#"> link text</a>'; + var expected = '<a href="#">\tlink text</a>'; assert.equal(expected, result); }); });