Enable no-restricted-globals in JS files
This commit is contained in:
parent
72770e609d
commit
bce890820f
42 changed files with 55 additions and 53 deletions
|
@ -71,7 +71,5 @@ rules:
|
||||||
body: 1
|
body: 1
|
||||||
## Destructuring: https://eslint.org/docs/rules/prefer-destructuring
|
## Destructuring: https://eslint.org/docs/rules/prefer-destructuring
|
||||||
prefer-destructuring: off
|
prefer-destructuring: off
|
||||||
## no-restricted-globals: https://eslint.org/docs/rules/no-restricted-globals
|
|
||||||
no-restricted-globals: off
|
|
||||||
## no-multi-assign: https://eslint.org/docs/rules/no-multi-assign
|
## no-multi-assign: https://eslint.org/docs/rules/no-multi-assign
|
||||||
no-multi-assign: off
|
no-multi-assign: off
|
||||||
|
|
|
@ -70,7 +70,7 @@ export default class BlobViewer {
|
||||||
const initialViewer = this.$fileHolder[0].querySelector('.blob-viewer:not(.hidden)');
|
const initialViewer = this.$fileHolder[0].querySelector('.blob-viewer:not(.hidden)');
|
||||||
let initialViewerName = initialViewer.getAttribute('data-type');
|
let initialViewerName = initialViewer.getAttribute('data-type');
|
||||||
|
|
||||||
if (this.switcher && location.hash.indexOf('#L') === 0) {
|
if (this.switcher && window.location.hash.indexOf('#L') === 0) {
|
||||||
initialViewerName = 'simple';
|
initialViewerName = 'simple';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ gl.issueBoards.BoardDelete = Vue.extend({
|
||||||
deleteBoard () {
|
deleteBoard () {
|
||||||
$(this.$el).tooltip('hide');
|
$(this.$el).tooltip('hide');
|
||||||
|
|
||||||
if (confirm('Are you sure you want to delete this list?')) {
|
if (window.confirm('Are you sure you want to delete this list?')) {
|
||||||
this.list.destroy();
|
this.list.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,6 @@ gl.issueBoards.BoardsStore = {
|
||||||
return filteredList[0];
|
return filteredList[0];
|
||||||
},
|
},
|
||||||
updateFiltersUrl () {
|
updateFiltersUrl () {
|
||||||
history.pushState(null, null, `?${this.filter.path}`);
|
window.history.pushState(null, null, `?${this.filter.path}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,7 +45,7 @@ export default class CommitsList {
|
||||||
this.content.fadeTo('fast', 1.0);
|
this.content.fadeTo('fast', 1.0);
|
||||||
|
|
||||||
// Change url so if user reload a page - search results are saved
|
// Change url so if user reload a page - search results are saved
|
||||||
history.replaceState({
|
window.history.replaceState({
|
||||||
page: commitsUrl,
|
page: commitsUrl,
|
||||||
}, document.title, commitsUrl);
|
}, document.title, commitsUrl);
|
||||||
})
|
})
|
||||||
|
|
|
@ -98,7 +98,7 @@ export default {
|
||||||
},
|
},
|
||||||
disableKey(deployKey, callback) {
|
disableKey(deployKey, callback) {
|
||||||
// eslint-disable-next-line no-alert
|
// eslint-disable-next-line no-alert
|
||||||
if (confirm(s__('DeployKeys|You are going to remove this deploy key. Are you sure?'))) {
|
if (window.confirm(s__('DeployKeys|You are going to remove this deploy key. Are you sure?'))) {
|
||||||
this.service
|
this.service
|
||||||
.disableKey(deployKey.id)
|
.disableKey(deployKey.id)
|
||||||
.then(this.fetchKeys)
|
.then(this.fetchKeys)
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
methods: {
|
methods: {
|
||||||
onClick() {
|
onClick() {
|
||||||
// eslint-disable-next-line no-alert
|
// eslint-disable-next-line no-alert
|
||||||
if (confirm('Are you sure you want to stop this environment?')) {
|
if (window.confirm('Are you sure you want to stop this environment?')) {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
|
||||||
$(this.$el).tooltip('dispose');
|
$(this.$el).tooltip('dispose');
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import { computeDiff } from './diff';
|
import { computeDiff } from './diff';
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
self.addEventListener('message', (e) => {
|
self.addEventListener('message', (e) => {
|
||||||
const data = e.data;
|
const data = e.data;
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
self.postMessage({
|
self.postMessage({
|
||||||
path: data.path,
|
path: data.path,
|
||||||
changes: computeDiff(data.originalContent, data.newContent),
|
changes: computeDiff(data.originalContent, data.newContent),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { viewerInformationForPath } from '~/vue_shared/components/content_viewer/lib/viewer_utils';
|
import { viewerInformationForPath } from '~/vue_shared/components/content_viewer/lib/viewer_utils';
|
||||||
import { decorateData, sortTree } from '../utils';
|
import { decorateData, sortTree } from '../utils';
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
self.addEventListener('message', e => {
|
self.addEventListener('message', e => {
|
||||||
const { data, projectId, branchId, tempFile = false, content = '', base64 = false } = e.data;
|
const { data, projectId, branchId, tempFile = false, content = '', base64 = false } = e.data;
|
||||||
|
|
||||||
|
@ -89,6 +90,7 @@ self.addEventListener('message', e => {
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
self.postMessage({
|
self.postMessage({
|
||||||
entries,
|
entries,
|
||||||
treeList: sortTree(treeList),
|
treeList: sortTree(treeList),
|
||||||
|
|
|
@ -226,7 +226,7 @@
|
||||||
.then(res => res.data)
|
.then(res => res.data)
|
||||||
.then(data => this.checkForSpam(data))
|
.then(data => this.checkForSpam(data))
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (location.pathname !== data.web_url) {
|
if (window.location.pathname !== data.web_url) {
|
||||||
visitUrl(data.web_url);
|
visitUrl(data.web_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
},
|
},
|
||||||
deleteIssuable() {
|
deleteIssuable() {
|
||||||
// eslint-disable-next-line no-alert
|
// eslint-disable-next-line no-alert
|
||||||
if (confirm('Issue will be removed! Are you sure?')) {
|
if (window.confirm('Issue will be removed! Are you sure?')) {
|
||||||
this.deleteLoading = true;
|
this.deleteLoading = true;
|
||||||
|
|
||||||
eventHub.$emit('delete.issuable');
|
eventHub.$emit('delete.issuable');
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
currentPath() {
|
currentPath() {
|
||||||
return location.pathname;
|
return window.location.pathname;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,8 +44,8 @@ export default class LazyLoader {
|
||||||
requestAnimationFrame(() => this.checkElementsInView());
|
requestAnimationFrame(() => this.checkElementsInView());
|
||||||
}
|
}
|
||||||
checkElementsInView() {
|
checkElementsInView() {
|
||||||
const scrollTop = pageYOffset;
|
const scrollTop = window.pageYOffset;
|
||||||
const visHeight = scrollTop + innerHeight + SCROLL_THRESHOLD;
|
const visHeight = scrollTop + window.innerHeight + SCROLL_THRESHOLD;
|
||||||
|
|
||||||
// Loading Images which are in the current viewport or close to them
|
// Loading Images which are in the current viewport or close to them
|
||||||
this.lazyImages = this.lazyImages.filter((selectedImage) => {
|
this.lazyImages = this.lazyImages.filter((selectedImage) => {
|
||||||
|
|
|
@ -93,7 +93,7 @@ export default class LinkedTabs {
|
||||||
|
|
||||||
const newState = `${copySource}${this.currentLocation.search}${this.currentLocation.hash}`;
|
const newState = `${copySource}${this.currentLocation.search}${this.currentLocation.hash}`;
|
||||||
|
|
||||||
history.replaceState({
|
window.history.replaceState({
|
||||||
url: newState,
|
url: newState,
|
||||||
}, document.title, newState);
|
}, document.title, newState);
|
||||||
return newState;
|
return newState;
|
||||||
|
|
|
@ -12,7 +12,7 @@ export function formatRelevantDigits(number) {
|
||||||
let digitsLeft = '';
|
let digitsLeft = '';
|
||||||
let relevantDigits = 0;
|
let relevantDigits = 0;
|
||||||
let formattedNumber = '';
|
let formattedNumber = '';
|
||||||
if (!isNaN(Number(number))) {
|
if (!Number.isNaN(Number(number))) {
|
||||||
digitsLeft = number.toString().split('.')[0];
|
digitsLeft = number.toString().split('.')[0];
|
||||||
switch (digitsLeft.length) {
|
switch (digitsLeft.length) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -35,7 +35,7 @@ const LineHighlighter = function(options = {}) {
|
||||||
options.highlightLineClass = options.highlightLineClass || 'hll';
|
options.highlightLineClass = options.highlightLineClass || 'hll';
|
||||||
options.fileHolderSelector = options.fileHolderSelector || '.file-holder';
|
options.fileHolderSelector = options.fileHolderSelector || '.file-holder';
|
||||||
options.scrollFileHolder = options.scrollFileHolder || false;
|
options.scrollFileHolder = options.scrollFileHolder || false;
|
||||||
options.hash = options.hash || location.hash;
|
options.hash = options.hash || window.location.hash;
|
||||||
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this._hash = options.hash;
|
this._hash = options.hash;
|
||||||
|
@ -170,7 +170,7 @@ LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) {
|
||||||
//
|
//
|
||||||
// This method is stubbed in tests.
|
// This method is stubbed in tests.
|
||||||
LineHighlighter.prototype.__setLocationHash__ = function(value) {
|
LineHighlighter.prototype.__setLocationHash__ = function(value) {
|
||||||
return history.pushState({
|
return window.history.pushState({
|
||||||
url: value
|
url: value
|
||||||
// We're using pushState instead of assigning location.hash directly to
|
// We're using pushState instead of assigning location.hash directly to
|
||||||
// prevent the page from scrolling on the hashchange event
|
// prevent the page from scrolling on the hashchange event
|
||||||
|
|
|
@ -18,13 +18,13 @@ export default class Milestone {
|
||||||
return $('a[data-toggle="tab"]').on('show.bs.tab', (e) => {
|
return $('a[data-toggle="tab"]').on('show.bs.tab', (e) => {
|
||||||
const $target = $(e.target);
|
const $target = $(e.target);
|
||||||
|
|
||||||
location.hash = $target.attr('href');
|
window.location.hash = $target.attr('href');
|
||||||
this.loadTab($target);
|
this.loadTab($target);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line class-methods-use-this
|
// eslint-disable-next-line class-methods-use-this
|
||||||
loadInitialTab() {
|
loadInitialTab() {
|
||||||
const $target = $(`.js-milestone-tabs a[href="${location.hash}"]`);
|
const $target = $(`.js-milestone-tabs a[href="${window.location.hash}"]`);
|
||||||
|
|
||||||
if ($target.length) {
|
if ($target.length) {
|
||||||
$target.tab('show');
|
$target.tab('show');
|
||||||
|
|
|
@ -97,7 +97,7 @@ export default {
|
||||||
? this.deploymentFlagData.seriesIndex
|
? this.deploymentFlagData.seriesIndex
|
||||||
: indexFromCoordinates;
|
: indexFromCoordinates;
|
||||||
const value = series.values[index] && series.values[index].value;
|
const value = series.values[index] && series.values[index].value;
|
||||||
if (isNaN(value)) {
|
if (Number.isNaN(value)) {
|
||||||
return '-';
|
return '-';
|
||||||
}
|
}
|
||||||
return `${formatRelevantDigits(value)}${this.unitOfDisplay}`;
|
return `${formatRelevantDigits(value)}${this.unitOfDisplay}`;
|
||||||
|
|
|
@ -73,7 +73,7 @@ function queryTimeSeries(query, graphWidth, graphHeight, graphHeightOffset, xDom
|
||||||
timeSeriesScaleX.ticks(d3.timeMinute, 60);
|
timeSeriesScaleX.ticks(d3.timeMinute, 60);
|
||||||
timeSeriesScaleY.domain(yDom);
|
timeSeriesScaleY.domain(yDom);
|
||||||
|
|
||||||
const defined = d => !isNaN(d.value) && d.value != null;
|
const defined = d => !Number.isNaN(d.value) && d.value != null;
|
||||||
|
|
||||||
const lineFunction = d3
|
const lineFunction = d3
|
||||||
.line()
|
.line()
|
||||||
|
|
|
@ -315,7 +315,7 @@ export default class Notes {
|
||||||
if (discussionNoteForm.length) {
|
if (discussionNoteForm.length) {
|
||||||
if ($textarea.val() !== '') {
|
if ($textarea.val() !== '') {
|
||||||
if (
|
if (
|
||||||
!confirm('Are you sure you want to cancel creating this comment?')
|
!window.confirm('Are you sure you want to cancel creating this comment?')
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ export default class Notes {
|
||||||
newText = $textarea.val();
|
newText = $textarea.val();
|
||||||
if (originalText !== newText) {
|
if (originalText !== newText) {
|
||||||
if (
|
if (
|
||||||
!confirm('Are you sure you want to cancel editing this comment?')
|
!window.confirm('Are you sure you want to cancel editing this comment?')
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ export default {
|
||||||
const msg = 'Are you sure you want to cancel creating this comment?';
|
const msg = 'Are you sure you want to cancel creating this comment?';
|
||||||
|
|
||||||
// eslint-disable-next-line no-alert
|
// eslint-disable-next-line no-alert
|
||||||
if (!confirm(msg)) {
|
if (!window.confirm(msg)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ export default {
|
||||||
},
|
},
|
||||||
deleteHandler() {
|
deleteHandler() {
|
||||||
// eslint-disable-next-line no-alert
|
// eslint-disable-next-line no-alert
|
||||||
if (confirm('Are you sure you want to delete this comment?')) {
|
if (window.confirm('Are you sure you want to delete this comment?')) {
|
||||||
this.isDeleting = true;
|
this.isDeleting = true;
|
||||||
|
|
||||||
this.deleteNote(this.note)
|
this.deleteNote(this.note)
|
||||||
|
@ -129,7 +129,7 @@ export default {
|
||||||
formCancelHandler(shouldConfirm, isDirty) {
|
formCancelHandler(shouldConfirm, isDirty) {
|
||||||
if (shouldConfirm && isDirty) {
|
if (shouldConfirm && isDirty) {
|
||||||
// eslint-disable-next-line no-alert
|
// eslint-disable-next-line no-alert
|
||||||
if (!confirm('Are you sure you want to cancel editing this comment?'))
|
if (!window.confirm('Are you sure you want to cancel editing this comment?'))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$refs.noteBody.resetAutoSave();
|
this.$refs.noteBody.resetAutoSave();
|
||||||
|
|
|
@ -187,7 +187,7 @@ export default class UserTabs {
|
||||||
let newState = source;
|
let newState = source;
|
||||||
newState = newState.replace(/\/+$/, '');
|
newState = newState.replace(/\/+$/, '');
|
||||||
newState += this.windowLocation.search + this.windowLocation.hash;
|
newState += this.windowLocation.search + this.windowLocation.hash;
|
||||||
history.replaceState(
|
window.history.replaceState(
|
||||||
{
|
{
|
||||||
url: newState,
|
url: newState,
|
||||||
},
|
},
|
||||||
|
|
|
@ -150,7 +150,7 @@ export default class ProjectFindFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
goToTree() {
|
goToTree() {
|
||||||
return location.href = this.options.treeUrl;
|
return window.location.href = this.options.treeUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
goToBlob() {
|
goToBlob() {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { visitUrl } from './lib/utils/url_utility';
|
||||||
|
|
||||||
export default function projectImport() {
|
export default function projectImport() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
visitUrl(location.href);
|
visitUrl(window.location.href);
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -438,7 +438,7 @@ export default class SearchAutocomplete {
|
||||||
}
|
}
|
||||||
|
|
||||||
onClick(item, $el, e) {
|
onClick(item, $el, e) {
|
||||||
if (location.pathname.indexOf(item.url) !== -1) {
|
if (window.location.pathname.indexOf(item.url) !== -1) {
|
||||||
if (!e.metaKey) e.preventDefault();
|
if (!e.metaKey) e.preventDefault();
|
||||||
if (!this.badgePresent) {
|
if (!this.badgePresent) {
|
||||||
if (item.category === 'Projects') {
|
if (item.category === 'Projects') {
|
||||||
|
|
|
@ -42,8 +42,8 @@ export default function initSettingsPanels() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (location.hash) {
|
if (window.location.hash) {
|
||||||
const $target = $(location.hash);
|
const $target = $(window.location.hash);
|
||||||
if ($target.length && $target.hasClass('settings')) {
|
if ($target.length && $target.hasClass('settings')) {
|
||||||
expandSection($target);
|
expandSection($target);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@ export default class ShortcutsFindFile extends ShortcutsNavigation {
|
||||||
element === this.projectFindFile.inputElement[0] &&
|
element === this.projectFindFile.inputElement[0] &&
|
||||||
(combo === 'up' || combo === 'down' || combo === 'esc' || combo === 'enter')
|
(combo === 'up' || combo === 'down' || combo === 'esc' || combo === 'enter')
|
||||||
) {
|
) {
|
||||||
// when press up/down key in textbox, cusor prevent to move to home/end
|
// when press up/down key in textbox, cursor prevent to move to home/end
|
||||||
event.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ export default {
|
||||||
updateConfidentialAttribute(confidential) {
|
updateConfidentialAttribute(confidential) {
|
||||||
this.service
|
this.service
|
||||||
.update('issue', { confidential })
|
.update('issue', { confidential })
|
||||||
.then(() => location.reload())
|
.then(() => window.location.reload())
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
Flash(
|
Flash(
|
||||||
__(
|
__(
|
||||||
|
|
|
@ -76,7 +76,7 @@ export default {
|
||||||
.update(this.issuableType, {
|
.update(this.issuableType, {
|
||||||
discussion_locked: locked,
|
discussion_locked: locked,
|
||||||
})
|
})
|
||||||
.then(() => location.reload())
|
.then(() => window.location.reload())
|
||||||
.catch(() =>
|
.catch(() =>
|
||||||
Flash(
|
Flash(
|
||||||
this.__(
|
this.__(
|
||||||
|
|
|
@ -80,7 +80,7 @@ export default class SidebarMediator {
|
||||||
return this.service.moveIssue(this.store.moveToProjectId)
|
return this.service.moveIssue(this.store.moveToProjectId)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (location.pathname !== data.web_url) {
|
if (window.location.pathname !== data.web_url) {
|
||||||
visitUrl(data.web_url);
|
visitUrl(data.web_url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export default () => {
|
export default () => {
|
||||||
const { protocol, host, pathname } = location;
|
const { protocol, host, pathname } = window.location;
|
||||||
const shareBtn = document.querySelector('.js-share-btn');
|
const shareBtn = document.querySelector('.js-share-btn');
|
||||||
const embedBtn = document.querySelector('.js-embed-btn');
|
const embedBtn = document.querySelector('.js-embed-btn');
|
||||||
const snippetUrlArea = document.querySelector('.js-snippet-url-area');
|
const snippetUrlArea = document.querySelector('.js-snippet-url-area');
|
||||||
|
|
|
@ -32,7 +32,7 @@ describe('Blob viewer', () => {
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
mock.restore();
|
mock.restore();
|
||||||
location.hash = '';
|
window.location.hash = '';
|
||||||
});
|
});
|
||||||
|
|
||||||
it('loads source file after switching views', (done) => {
|
it('loads source file after switching views', (done) => {
|
||||||
|
@ -49,7 +49,7 @@ describe('Blob viewer', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('loads source file when line number is in hash', (done) => {
|
it('loads source file when line number is in hash', (done) => {
|
||||||
location.hash = '#L1';
|
window.location.hash = '#L1';
|
||||||
|
|
||||||
new BlobViewer();
|
new BlobViewer();
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import LinkedTabs from '~/lib/utils/bootstrap_linked_tabs';
|
||||||
|
|
||||||
describe('on click', () => {
|
describe('on click', () => {
|
||||||
it('should change the url according to the clicked tab', () => {
|
it('should change the url according to the clicked tab', () => {
|
||||||
const historySpy = spyOn(history, 'replaceState').and.callFake(() => {});
|
const historySpy = spyOn(window.history, 'replaceState').and.callFake(() => {});
|
||||||
|
|
||||||
const linkedTabs = new LinkedTabs({
|
const linkedTabs = new LinkedTabs({
|
||||||
action: 'show',
|
action: 'show',
|
||||||
|
|
|
@ -56,7 +56,7 @@ describe('Commits List', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
commitsList.searchField.val('');
|
commitsList.searchField.val('');
|
||||||
|
|
||||||
spyOn(history, 'replaceState').and.stub();
|
spyOn(window.history, 'replaceState').and.stub();
|
||||||
mock = new MockAdapter(axios);
|
mock = new MockAdapter(axios);
|
||||||
|
|
||||||
mock.onGet('/h5bp/html5-boilerplate/commits/master').reply(200, {
|
mock.onGet('/h5bp/html5-boilerplate/commits/master').reply(200, {
|
||||||
|
|
|
@ -220,7 +220,7 @@ describe('Environment', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
component = mountComponent(EnvironmentsComponent, mockData);
|
component = mountComponent(EnvironmentsComponent, mockData);
|
||||||
spyOn(history, 'pushState').and.stub();
|
spyOn(window.history, 'pushState').and.stub();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('updateContent', () => {
|
describe('updateContent', () => {
|
||||||
|
|
|
@ -177,7 +177,7 @@ describe('Environments Folder View', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
component = mountComponent(Component, mockData);
|
component = mountComponent(Component, mockData);
|
||||||
spyOn(history, 'pushState').and.stub();
|
spyOn(window.history, 'pushState').and.stub();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('updateContent', () => {
|
describe('updateContent', () => {
|
||||||
|
|
|
@ -166,12 +166,12 @@ describe('IDE store file actions', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('resets location.hash for line highlighting', done => {
|
it('resets location.hash for line highlighting', done => {
|
||||||
location.hash = 'test';
|
window.location.hash = 'test';
|
||||||
|
|
||||||
store
|
store
|
||||||
.dispatch('setFileActive', localFile.path)
|
.dispatch('setFileActive', localFile.path)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(location.hash).not.toBe('test');
|
expect(window.location.hash).not.toBe('test');
|
||||||
|
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
|
|
|
@ -145,7 +145,7 @@ describe('Issuable output', () => {
|
||||||
resolve({
|
resolve({
|
||||||
data: {
|
data: {
|
||||||
confidential: false,
|
confidential: false,
|
||||||
web_url: location.pathname,
|
web_url: window.location.pathname,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@ -177,7 +177,7 @@ describe('Issuable output', () => {
|
||||||
spyOn(vm.service, 'updateIssuable').and.callFake(() => new Promise((resolve) => {
|
spyOn(vm.service, 'updateIssuable').and.callFake(() => new Promise((resolve) => {
|
||||||
resolve({
|
resolve({
|
||||||
data: {
|
data: {
|
||||||
web_url: location.pathname,
|
web_url: window.location.pathname,
|
||||||
confidential: vm.isConfidential,
|
confidential: vm.isConfidential,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,13 +40,13 @@ describe('common_utils', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should decode params', () => {
|
it('should decode params', () => {
|
||||||
history.pushState('', '', '?label_name%5B%5D=test');
|
window.history.pushState('', '', '?label_name%5B%5D=test');
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
commonUtils.getUrlParamsArray()[0],
|
commonUtils.getUrlParamsArray()[0],
|
||||||
).toBe('label_name[]=test');
|
).toBe('label_name[]=test');
|
||||||
|
|
||||||
history.pushState('', '', '?');
|
window.history.pushState('', '', '?');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -427,7 +427,7 @@ describe('Pipelines', () => {
|
||||||
|
|
||||||
describe('methods', () => {
|
describe('methods', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOn(history, 'pushState').and.stub();
|
spyOn(window.history, 'pushState').and.stub();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('updateContent', () => {
|
describe('updateContent', () => {
|
||||||
|
|
|
@ -9,11 +9,11 @@ describe('Settings Panels', () => {
|
||||||
|
|
||||||
describe('initSettingsPane', () => {
|
describe('initSettingsPane', () => {
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
location.hash = '';
|
window.location.hash = '';
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should expand linked hash fragment panel', () => {
|
it('should expand linked hash fragment panel', () => {
|
||||||
location.hash = '#autodevops-settings';
|
window.location.hash = '#autodevops-settings';
|
||||||
|
|
||||||
const pipelineSettingsPanel = document.querySelector('#autodevops-settings');
|
const pipelineSettingsPanel = document.querySelector('#autodevops-settings');
|
||||||
// Our test environment automatically expands everything so we need to clear that out first
|
// Our test environment automatically expands everything so we need to clear that out first
|
||||||
|
|
Loading…
Reference in a new issue