2021-01-29 00:20:46 +05:30
|
|
|
import setHighlightClass from '~/search/highlight_blob_search_result';
|
2020-04-22 19:07:51 +05:30
|
|
|
|
|
|
|
const fixture = 'search/blob_search_result.html';
|
2021-03-11 19:13:27 +05:30
|
|
|
const searchKeyword = 'Send'; // spec/frontend/fixtures/search.rb#79
|
2020-04-22 19:07:51 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
describe('search/highlight_blob_search_result', () => {
|
2020-04-22 19:07:51 +05:30
|
|
|
beforeEach(() => loadFixtures(fixture));
|
|
|
|
|
|
|
|
it('highlights lines with search term occurrence', () => {
|
2021-03-11 19:13:27 +05:30
|
|
|
setHighlightClass(searchKeyword);
|
2020-04-22 19:07:51 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
expect(document.querySelectorAll('.blob-result .hll').length).toBe(4);
|
2020-04-22 19:07:51 +05:30
|
|
|
});
|
|
|
|
});
|