mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Added test case for when regex and case sensitive are both selected
This commit is contained in:
@@ -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'});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user