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