debian-mirror-gitlab/spec/frontend/search/highlight_blob_search_result_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
604 B
JavaScript
Raw Normal View History

2021-01-29 00:20:46 +05:30
import setHighlightClass from '~/search/highlight_blob_search_result';
2022-07-16 23:28:13 +05:30
import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
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', () => {
2022-07-16 23:28:13 +05:30
beforeEach(() => loadHTMLFixture(fixture));
afterEach(() => {
resetHTMLFixture();
});
2020-04-22 19:07:51 +05:30
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-11-11 11:23:49 +05:30
expect(document.querySelectorAll('.js-blob-result .hll').length).toBe(4);
2020-04-22 19:07:51 +05:30
});
});