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

versions_menu_helper.js « helpers « components « default « frontend « spec - gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5842880e7805dc88863cdbec3c7407163ba477d6 (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
/**
 * Creates a mock browser window object with a given path.
 * @param {String} pathname
 */
export const setWindowPath = (pathname) => {
  const location = {
    ...window.location,
    pathname,
  };
  Object.defineProperty(window, 'location', {
    writable: true,
    value: location,
  });
};

/**
 * Creates a mock gitlab-docs-version metatag.
 * @param {String} pathname
 */
export const setVersionMetatag = (version) => {
  const meta = document.createElement('meta');
  meta.setAttribute('name', 'gitlab-docs-version');
  meta.setAttribute('content', version);
  document.head.appendChild(meta);
};