Added test case for when regex and case sensitive are both selected

This commit is contained in:
Alex Ross
2018-09-11 15:48:24 -07:00
parent ade3e0943c
commit 7d2bdacf77
+25
View File
@@ -134,5 +134,30 @@ describe('search addon', () => {
expect(hello1).eql(undefined);
expect(hello2).eql({col: 8, row: 2, term: 'Hello'});
});
it('should respect case sensitive + regex', function(): void {
search.apply(<any>MockTerminal);
const term = new MockTerminal({cols: 20, rows: 4});
term.core.write('hellohello\r\nHelloHello');
term.pushWriteData();
/**
* hellohello
* HelloHello
*/
const searchOptions = {
regex: true,
wholeWord: false,
caseSensitive: true
};
const hello0 = (term.searchHelper as any)._findInLine('Hello', 0, searchOptions);
const hello1 = (term.searchHelper as any)._findInLine('Hello$', 0, searchOptions);
const hello2 = (term.searchHelper as any)._findInLine('Hello', 1, searchOptions);
const hello3 = (term.searchHelper as any)._findInLine('Hello$', 1, searchOptions);
expect(hello0).eql(undefined);
expect(hello1).eql(undefined);
expect(hello2).eql({col: 0, row: 1, term: 'Hello'});
expect(hello3).eql({col: 5, row: 1, term: 'Hello'});
});
});
});