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

shortcuts_dashboard_navigation_spec.js « javascripts « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7cb201e01d8981956db2fbc022058a9afe06a00e (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 findAndFollowLink from '~/shortcuts_dashboard_navigation';

describe('findAndFollowLink', () => {
  it('visits a link when the selector exists', () => {
    const href = '/some/path';
    const visitUrl = spyOnDependency(findAndFollowLink, 'visitUrl');

    setFixtures(`<a class="my-shortcut" href="${href}">link</a>`);

    findAndFollowLink('.my-shortcut');

    expect(visitUrl).toHaveBeenCalledWith(href);
  });

  it('does not throw an exception when the selector does not exist', () => {
    const visitUrl = spyOnDependency(findAndFollowLink, 'visitUrl');

    // this should not throw an exception
    findAndFollowLink('.this-selector-does-not-exist');

    expect(visitUrl).not.toHaveBeenCalled();
  });
});