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

utils_spec.js « source_viewer « components « vue_shared « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 937c3b26c67861b6786c2a74de6f43671494da4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { wrapLines } from '~/vue_shared/components/source_viewer/utils';

describe('Wrap lines', () => {
  it.each`
    input                                              | output
    ${'line 1'}                                        | ${'<span id="LC1" class="line">line 1</span>'}
    ${'line 1\nline 2'}                                | ${`<span id="LC1" class="line">line 1</span>\n<span id="LC2" class="line">line 2</span>`}
    ${'<span class="hljs-code">line 1\nline 2</span>'} | ${`<span id="LC1" class="hljs-code">line 1\n<span id="LC2" class="line">line 2</span></span>`}
    ${'<span class="hljs-code">```bash'}               | ${'<span id="LC1" class="hljs-code">```bash'}
  `('returns lines wrapped in spans containing line numbers', ({ input, output }) => {
    expect(wrapLines(input)).toBe(output);
  });
});