summaryrefslogtreecommitdiff
path: root/spec/frontend/vue_shared/components/source_viewer/plugins/wrap_bidi_chars_spec.js
blob: f40f8b2262724efc37665141976764534fb43348 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import wrapBidiChars from '~/vue_shared/components/source_viewer/plugins/wrap_bidi_chars';
import {
  BIDI_CHARS,
  BIDI_CHARS_CLASS_LIST,
  BIDI_CHAR_TOOLTIP,
} from '~/vue_shared/components/source_viewer/constants';

describe('Highlight.js plugin for wrapping BiDi characters', () => {
  it.each(BIDI_CHARS)('wraps %s BiDi char', (bidiChar) => {
    const inputValue = `// some content ${bidiChar} with BiDi chars`;
    const outputValue = `// some content <span class="${BIDI_CHARS_CLASS_LIST}" title="${BIDI_CHAR_TOOLTIP}">${bidiChar}</span>`;
    const hljsResultMock = { value: inputValue };

    wrapBidiChars(hljsResultMock);
    expect(hljsResultMock.value).toContain(outputValue);
  });
});