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

init_delete_tag_modal_spec.js « tags « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 537df4fac52336af187810fb411f41e9ec3b56f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Vue from 'vue';
import { resetHTMLFixture, setHTMLFixture } from 'helpers/fixtures';
import initDeleteTagModal from '../../../app/assets/javascripts/tags/init_delete_tag_modal';

describe('initDeleteTagModal', () => {
  beforeEach(() => {
    setHTMLFixture('<div class="js-delete-tag-modal"></div>');
  });

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

  it('should mount the delete tag modal', () => {
    expect(initDeleteTagModal()).toBeInstanceOf(Vue);
    expect(document.querySelector('.js-delete-tag-modal')).toBeNull();
  });

  it('should return false if the mounting element is missing', () => {
    document.querySelector('.js-delete-tag-modal').remove();
    expect(initDeleteTagModal()).toBe(false);
  });
});