Commit e3fb6945 authored by Zack Cuddy's avatar Zack Cuddy

Global Search - Replace css class

.blob-result was being used
for a stricly js related
function.

Since there is no CSS involved
anymore, we reanmed the class
to include .js.
parent a564138d
...@@ -2,7 +2,7 @@ export default (search = '') => { ...@@ -2,7 +2,7 @@ export default (search = '') => {
const highlightLineClass = 'hll'; const highlightLineClass = 'hll';
const contentBody = document.getElementById('content-body'); const contentBody = document.getElementById('content-body');
const searchTerm = search.toLowerCase(); const searchTerm = search.toLowerCase();
const blobs = contentBody.querySelectorAll('.blob-result'); const blobs = contentBody.querySelectorAll('.js-blob-result');
blobs.forEach((blob) => { blobs.forEach((blob) => {
const lines = blob.querySelectorAll('.line'); const lines = blob.querySelectorAll('.line');
......
.blob-result.gl-mt-3.gl-mb-5{ data: { qa_selector: 'result_item_content' } } .js-blob-result.gl-mt-3.gl-mb-5{ data: { qa_selector: 'result_item_content' } }
.file-holder.file-holder-top-border .file-holder.file-holder-top-border
.js-file-title.file-title{ data: { qa_selector: 'file_title_content' } } .js-file-title.file-title{ data: { qa_selector: 'file_title_content' } }
= link_to blob_link, data: {track_event: 'click_text', track_label: 'blob_path', track_property: 'search_result'} do = link_to blob_link, data: {track_event: 'click_text', track_label: 'blob_path', track_property: 'search_result'} do
......
...@@ -3,7 +3,7 @@ import setHighlightClass from '~/search/highlight_blob_search_result'; ...@@ -3,7 +3,7 @@ import setHighlightClass from '~/search/highlight_blob_search_result';
export default (searchTerm) => { export default (searchTerm) => {
const highlightLineClass = 'hll'; const highlightLineClass = 'hll';
const contentBody = document.getElementById('content-body'); const contentBody = document.getElementById('content-body');
const blobs = contentBody.querySelectorAll('.blob-result'); const blobs = contentBody.querySelectorAll('.js-blob-result');
// Supports Basic (backed by Gitaly) Search highlighting // Supports Basic (backed by Gitaly) Search highlighting
setHighlightClass(searchTerm); setHighlightClass(searchTerm);
......
...@@ -11,7 +11,7 @@ describe('ee/search/highlight_blob_search_result', () => { ...@@ -11,7 +11,7 @@ describe('ee/search/highlight_blob_search_result', () => {
setHighlightClass(searchKeyword); setHighlightClass(searchKeyword);
expect(document.querySelectorAll('.blob-result .hll').length).toBe(4); expect(document.querySelectorAll('.js-blob-result .hll').length).toBe(4);
}); });
// Advanced search support // Advanced search support
...@@ -20,6 +20,6 @@ describe('ee/search/highlight_blob_search_result', () => { ...@@ -20,6 +20,6 @@ describe('ee/search/highlight_blob_search_result', () => {
setHighlightClass(searchKeyword); setHighlightClass(searchKeyword);
expect(document.querySelectorAll('.blob-result .hll').length).toBe(3); expect(document.querySelectorAll('.js-blob-result .hll').length).toBe(3);
}); });
}); });
...@@ -9,6 +9,6 @@ describe('search/highlight_blob_search_result', () => { ...@@ -9,6 +9,6 @@ describe('search/highlight_blob_search_result', () => {
it('highlights lines with search term occurrence', () => { it('highlights lines with search term occurrence', () => {
setHighlightClass(searchKeyword); setHighlightClass(searchKeyword);
expect(document.querySelectorAll('.blob-result .hll').length).toBe(4); expect(document.querySelectorAll('.js-blob-result .hll').length).toBe(4);
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment