Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-30 12:08:04 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-30 12:08:04 +0300
commit5c229c2ebe3304a58afd1d40418410a8c3723ea5 (patch)
treef6c0e2cff171825ce027b5a30225e05dcdbad59d /spec/frontend/lib
parente05c9eaaa97aca4cd530f72652cb22dfb7305732 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib')
-rw-r--r--spec/frontend/lib/utils/dom_utils_spec.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/dom_utils_spec.js b/spec/frontend/lib/utils/dom_utils_spec.js
index d6bac935970..172f8972653 100644
--- a/spec/frontend/lib/utils/dom_utils_spec.js
+++ b/spec/frontend/lib/utils/dom_utils_spec.js
@@ -10,6 +10,7 @@ import {
getParents,
getParentByTagName,
setAttributes,
+ replaceCommentsWith,
} from '~/lib/utils/dom_utils';
const TEST_MARGIN = 5;
@@ -263,4 +264,21 @@ describe('DOM Utils', () => {
expect(getContentWrapperHeight('.does-not-exist')).toBe('');
});
});
+
+ describe('replaceCommentsWith', () => {
+ let div;
+ beforeEach(() => {
+ div = document.createElement('div');
+ });
+
+ it('replaces the comments in a DOM node with an element', () => {
+ div.innerHTML = '<h1> hi there <!-- some comment --> <p> <!-- another comment -->';
+
+ replaceCommentsWith(div, 'comment');
+
+ expect(div.innerHTML).toBe(
+ '<h1> hi there <comment> some comment </comment> <p> <comment> another comment </comment></p></h1>',
+ );
+ });
+ });
});