2020-10-28 18:08:52 +00:00
|
|
|
import setHighlightClass from '~/search/highlight_blob_search_result';
|
2020-03-23 09:09:42 +00:00
|
|
|
|
|
|
|
const fixture = 'search/blob_search_result.html';
|
2021-01-22 09:08:53 +00:00
|
|
|
const searchKeyword = 'Send'; // spec/frontend/fixtures/search.rb#79
|
2020-03-23 09:09:42 +00:00
|
|
|
|
2020-10-28 18:08:52 +00:00
|
|
|
describe('search/highlight_blob_search_result', () => {
|
2020-03-23 09:09:42 +00:00
|
|
|
preloadFixtures(fixture);
|
|
|
|
|
|
|
|
beforeEach(() => loadFixtures(fixture));
|
|
|
|
|
|
|
|
it('highlights lines with search term occurrence', () => {
|
2021-01-22 09:08:53 +00:00
|
|
|
setHighlightClass(searchKeyword);
|
2020-03-23 09:09:42 +00:00
|
|
|
|
2020-10-28 18:08:52 +00:00
|
|
|
expect(document.querySelectorAll('.blob-result .hll').length).toBe(4);
|
2020-03-23 09:09:42 +00:00
|
|
|
});
|
|
|
|
});
|