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

repo_prev_directory_spec.js « components « repo « javascripts « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 144ab838e7bc818d1b510c47eb035b35b6465e4e (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
import Vue from 'vue';
import repoPrevDirectory from '~/repo/components/repo_prev_directory.vue';

describe('RepoPrevDirectory', () => {
  function createComponent(propsData) {
    const RepoPrevDirectory = Vue.extend(repoPrevDirectory);

    return new RepoPrevDirectory({
      propsData,
    }).$mount();
  }

  it('renders a prev dir link', () => {
    const prevUrl = 'prevUrl';
    const vm = createComponent({
      prevUrl,
    });
    const link = vm.$el.querySelector('a');

    spyOn(vm, 'linkClicked');

    expect(link.href).toMatch(`/${prevUrl}`);
    expect(link.textContent).toEqual('..');

    link.click();

    expect(vm.linkClicked).toHaveBeenCalledWith(prevUrl);
  });
});