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

setup_root_element_spec.js « gitlab_web_ide « lib « ide « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 011f2564cecfc7616e3c2aa176ad7d0216d96ad0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
import { setupRootElement } from '~/ide/lib/gitlab_web_ide/setup_root_element';

describe('~/ide/lib/gitlab_web_ide/setup_root_element', () => {
  beforeEach(() => {
    setHTMLFixture(`
    <div id="ide-test-root" class="js-not-a-real-class">
      <span>We are loading lots of stuff...</span>
    </div>
    `);
  });

  afterEach(() => {
    resetHTMLFixture();
  });

  const findIDERoot = () => document.getElementById('ide-test-root');

  it('has no children, has original ID, and classes', () => {
    const result = setupRootElement(findIDERoot());

    // why: Assert that the return element matches the new one found in the dom
    //      (implying a el.replaceWith...)
    expect(result).toBe(findIDERoot());
    expect(result).toMatchInlineSnapshot(`
      <div
        class="gl--flex-center gl-h-full gl-relative"
        id="reference-0"
      />
    `);
  });
});