Skip to content

Commit d3fa9e5

Browse files
committed
fix and add one more unit test #738
1 parent 510b041 commit d3fa9e5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

__tests__/terminal.spec.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -1411,6 +1411,14 @@ describe('Terminal utils', function() {
14111411
var output = $.terminal.split_equal(text, 100, true);
14121412
expect(output).toEqual([$.terminal.normalize(text)]);
14131413
});
1414+
it('should retain leading spaces', function() {
1415+
var text = `This
1416+
is
1417+
a
1418+
test`;
1419+
var output = $.terminal.split_equal(text, 100, true);
1420+
expect(output).toEqual(text.split('\n'));
1421+
});
14141422
});
14151423
describe('Cycle', function() {
14161424
describe('create', function() {
@@ -5879,7 +5887,7 @@ describe('Terminal plugin', function() {
58795887
term.clear().echo(line, {keepWords: true});
58805888
expect(output()).toEqual(lines);
58815889
});
5882-
it('should strip whitespace', function() {
5890+
it('should strip traling whitespace', function() {
58835891
var words = ['lorem', 'ipsum', 'dolor', 'sit', 'amet'];
58845892
var input = [];
58855893
var i;
@@ -5891,7 +5899,7 @@ describe('Terminal plugin', function() {
58915899
for (i = 80; i < 200; i+=10) {
58925900
term.option('numChars', i);
58935901
output().forEach(function(line) {
5894-
expect(line.match(/^\s+|\s+$/)).toBeFalsy();
5902+
expect(line.match(/\s+$/)).toBeFalsy();
58955903
});
58965904
}
58975905
term.option('numChars', numChars);

0 commit comments

Comments
 (0)