Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
6ae4485274
commit
aa0e3dcce3
|
@ -26,6 +26,12 @@ rules:
|
|||
- _links
|
||||
import/no-unresolved:
|
||||
- error
|
||||
- ignore:
|
||||
# In FOSS, these import paths are rewritten using
|
||||
# NormalModuleReplacementPlugin, which import/no-unresolved doesn't
|
||||
# consider. See
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89831.
|
||||
- '^(ee|jh)_component/'
|
||||
# Disabled for now, to make the airbnb-base 12.1.0 -> 13.1.0 update smoother
|
||||
no-else-return:
|
||||
- error
|
||||
|
@ -108,8 +114,6 @@ rules:
|
|||
message: 'Migrate to GlSkeletonLoader, or import GlDeprecatedSkeletonLoading.'
|
||||
# See https://gitlab.com/gitlab-org/gitlab/-/issues/360551
|
||||
vue/multi-word-component-names: off
|
||||
unicorn/prefer-dom-node-dataset:
|
||||
- error
|
||||
overrides:
|
||||
- files:
|
||||
- '{,ee/,jh/}spec/frontend*/**/*'
|
||||
|
|
|
@ -55,8 +55,8 @@ export function renderKroki(krokiImages) {
|
|||
|
||||
// A single Kroki image is processed multiple times for some reason,
|
||||
// so this condition ensures we only create one alert per Kroki image
|
||||
if (!Object.hasOwn(parent.dataset, 'krokiProcessed')) {
|
||||
parent.dataset.krokiProcessed = 'true';
|
||||
if (!parent.hasAttribute('data-kroki-processed')) {
|
||||
parent.setAttribute('data-kroki-processed', 'true');
|
||||
parent.after(createAlert(krokiImage));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -112,7 +112,7 @@ class SafeMathRenderer {
|
|||
|
||||
try {
|
||||
displayContainer.innerHTML = this.katex.renderToString(text, {
|
||||
displayMode: el.dataset.mathStyle === 'display',
|
||||
displayMode: el.getAttribute('data-math-style') === 'display',
|
||||
throwOnError: true,
|
||||
maxSize: 20,
|
||||
maxExpand: 20,
|
||||
|
@ -145,7 +145,7 @@ class SafeMathRenderer {
|
|||
this.elements.forEach((el) => {
|
||||
const placeholder = document.createElement('span');
|
||||
placeholder.style.display = 'none';
|
||||
placeholder.dataset.mathStyle = el.dataset.mathStyle;
|
||||
placeholder.setAttribute('data-math-style', el.getAttribute('data-math-style'));
|
||||
placeholder.textContent = el.textContent;
|
||||
el.parentNode.replaceChild(placeholder, el);
|
||||
this.queue.push(placeholder);
|
||||
|
|
|
@ -9,11 +9,10 @@ const updateLineNumbersOnBlobPermalinks = (linksToUpdate) => {
|
|||
|
||||
[].concat(Array.prototype.slice.call(linksToUpdate)).forEach((permalinkButton) => {
|
||||
const baseHref =
|
||||
permalinkButton.dataset.originalHref ||
|
||||
permalinkButton.getAttribute('data-original-href') ||
|
||||
(() => {
|
||||
const href = permalinkButton.getAttribute('href');
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
permalinkButton.dataset.originalHref = href;
|
||||
permalinkButton.setAttribute('data-original-href', href);
|
||||
return href;
|
||||
})();
|
||||
permalinkButton.setAttribute('href', `${baseHref}${hashUrlString}`);
|
||||
|
|
|
@ -36,19 +36,19 @@ const loadRichBlobViewer = (type) => {
|
|||
|
||||
const loadViewer = (viewerParam) => {
|
||||
const viewer = viewerParam;
|
||||
const { url } = viewer.dataset;
|
||||
const url = viewer.getAttribute('data-url');
|
||||
|
||||
if (!url || viewer.dataset.loaded || viewer.dataset.loading) {
|
||||
if (!url || viewer.getAttribute('data-loaded') || viewer.getAttribute('data-loading')) {
|
||||
return Promise.resolve(viewer);
|
||||
}
|
||||
|
||||
viewer.dataset.loading = 'true';
|
||||
viewer.setAttribute('data-loading', 'true');
|
||||
|
||||
return axios.get(url).then(({ data }) => {
|
||||
viewer.innerHTML = data.html;
|
||||
|
||||
window.requestIdleCallback(() => {
|
||||
delete viewer.dataset.loading;
|
||||
viewer.removeAttribute('data-loading');
|
||||
});
|
||||
|
||||
return viewer;
|
||||
|
@ -108,7 +108,7 @@ export class BlobViewer {
|
|||
|
||||
switchToInitialViewer() {
|
||||
const initialViewer = this.$fileHolder[0].querySelector('.blob-viewer:not(.hidden)');
|
||||
let initialViewerName = initialViewer.dataset.type;
|
||||
let initialViewerName = initialViewer.getAttribute('data-type');
|
||||
|
||||
if (this.switcher && window.location.hash.indexOf('#L') === 0) {
|
||||
initialViewerName = 'simple';
|
||||
|
@ -138,12 +138,12 @@ export class BlobViewer {
|
|||
|
||||
e.preventDefault();
|
||||
|
||||
this.switchToViewer(target.dataset.viewer);
|
||||
this.switchToViewer(target.getAttribute('data-viewer'));
|
||||
}
|
||||
|
||||
toggleCopyButtonState() {
|
||||
if (!this.copySourceBtn) return;
|
||||
if (this.simpleViewer.dataset.loaded) {
|
||||
if (this.simpleViewer.getAttribute('data-loaded')) {
|
||||
this.copySourceBtnTooltip.setAttribute('title', __('Copy file contents'));
|
||||
this.copySourceBtn.classList.remove('disabled');
|
||||
} else if (this.activeViewer === this.simpleViewer) {
|
||||
|
@ -199,8 +199,7 @@ export class BlobViewer {
|
|||
this.$fileHolder.trigger('highlight:line');
|
||||
handleLocationHash();
|
||||
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
viewer.dataset.loaded = 'true';
|
||||
viewer.setAttribute('data-loaded', 'true');
|
||||
this.toggleCopyButtonState();
|
||||
eventHub.$emit('showBlobInteractionZones', viewer.dataset.path);
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@ export const addTooltipToEl = (el) => {
|
|||
|
||||
if (textEl && textEl.scrollWidth > textEl.offsetWidth) {
|
||||
el.setAttribute('title', el.textContent);
|
||||
el.dataset.container = 'body';
|
||||
el.setAttribute('data-container', 'body');
|
||||
el.classList.add('has-tooltip');
|
||||
}
|
||||
};
|
||||
|
|
|
@ -32,8 +32,8 @@ export const addInteractionClass = ({ path, d, wrapTextNodes }) => {
|
|||
});
|
||||
|
||||
if (el && !isTextNode(el)) {
|
||||
el.dataset.charIndex = d.start_char;
|
||||
el.dataset.lineIndex = d.start_line;
|
||||
el.setAttribute('data-char-index', d.start_char);
|
||||
el.setAttribute('data-line-index', d.start_line);
|
||||
el.classList.add('cursor-pointer', 'code-navigation', 'js-code-navigation');
|
||||
el.closest('.line').classList.add('code-navigation-line');
|
||||
}
|
||||
|
|
|
@ -107,10 +107,10 @@ function createLink(data, selected, options, index) {
|
|||
}
|
||||
|
||||
if (options.trackSuggestionClickedLabel) {
|
||||
link.dataset.trackAction = 'click_text';
|
||||
link.dataset.trackLabel = options.trackSuggestionClickedLabel;
|
||||
link.dataset.trackValue = index;
|
||||
link.dataset.trackProperty = slugify(data.category || 'no-category');
|
||||
link.setAttribute('data-track-action', 'click_text');
|
||||
link.setAttribute('data-track-label', options.trackSuggestionClickedLabel);
|
||||
link.setAttribute('data-track-value', index);
|
||||
link.setAttribute('data-track-property', slugify(data.category || 'no-category'));
|
||||
}
|
||||
|
||||
link.classList.toggle('is-active', selected);
|
||||
|
|
|
@ -26,7 +26,7 @@ export default class Diff {
|
|||
FilesCommentButton.init($diffFile);
|
||||
|
||||
const firstFile = $('.files').first().get(0);
|
||||
const canCreateNote = firstFile && Object.hasOwn(firstFile.dataset, 'canCreateNote');
|
||||
const canCreateNote = firstFile && firstFile.hasAttribute('data-can-create-note');
|
||||
$diffFile.each((index, file) => initImageDiffHelper.initImageDiff(file, canCreateNote));
|
||||
|
||||
if (!isBound) {
|
||||
|
|
|
@ -197,10 +197,10 @@ export default class AvailableDropdownMappings {
|
|||
}
|
||||
|
||||
getGroupId() {
|
||||
return this.filteredSearchInput.dataset.groupId || '';
|
||||
return this.filteredSearchInput.getAttribute('data-group-id') || '';
|
||||
}
|
||||
|
||||
getProjectId() {
|
||||
return this.filteredSearchInput.dataset.projectId || '';
|
||||
return this.filteredSearchInput.getAttribute('data-project-id') || '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,9 +25,9 @@ export default class DropdownHint extends FilteredSearchDropdown {
|
|||
const { selected } = e.detail;
|
||||
|
||||
if (selected.tagName === 'LI') {
|
||||
if (Object.hasOwn(selected.dataset, 'value')) {
|
||||
if (selected.hasAttribute('data-value')) {
|
||||
this.dismissDropdown();
|
||||
} else if (selected.dataset.action === 'submit') {
|
||||
} else if (selected.getAttribute('data-action') === 'submit') {
|
||||
this.dismissDropdown();
|
||||
this.dispatchFormSubmitEvent();
|
||||
} else {
|
||||
|
|
|
@ -23,7 +23,7 @@ export default class DropdownOperator extends FilteredSearchDropdown {
|
|||
const { selected } = e.detail;
|
||||
|
||||
if (selected.tagName === 'LI') {
|
||||
if (Object.hasOwn(selected.dataset, 'value')) {
|
||||
if (selected.hasAttribute('data-value')) {
|
||||
const name = FilteredSearchVisualTokens.getLastTokenPartial();
|
||||
const operator = selected.dataset.value;
|
||||
|
||||
|
|
|
@ -31,11 +31,11 @@ export default class DropdownUser extends DropdownAjaxFilter {
|
|||
}
|
||||
|
||||
getGroupId() {
|
||||
return this.input.dataset.groupId;
|
||||
return this.input.getAttribute('data-group-id');
|
||||
}
|
||||
|
||||
getProjectId() {
|
||||
return this.input.dataset.projectId;
|
||||
return this.input.getAttribute('data-project-id');
|
||||
}
|
||||
|
||||
projectOrGroupId() {
|
||||
|
|
|
@ -87,7 +87,6 @@ export default class DropdownUtils {
|
|||
}
|
||||
|
||||
static setDataValueIfSelected(filter, operator, selected) {
|
||||
// eslint-disable-next-line unicorn/prefer-dom-node-dataset
|
||||
const dataValue = selected.getAttribute('data-value');
|
||||
|
||||
if (dataValue) {
|
||||
|
@ -97,7 +96,6 @@ export default class DropdownUtils {
|
|||
tokenValue: dataValue,
|
||||
clicked: true,
|
||||
options: {
|
||||
// eslint-disable-next-line unicorn/prefer-dom-node-dataset
|
||||
capitalizeTokenValue: selected.hasAttribute('data-capitalize'),
|
||||
},
|
||||
});
|
||||
|
|
|
@ -165,8 +165,8 @@ class DropDown {
|
|||
images.forEach((image) => {
|
||||
const img = image;
|
||||
|
||||
img.src = img.dataset.src;
|
||||
delete img.dataset.src;
|
||||
img.src = img.getAttribute('data-src');
|
||||
img.removeAttribute('data-src');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -814,7 +814,7 @@ export default class FilteredSearchManager {
|
|||
getUsernameParams() {
|
||||
const usernamesById = {};
|
||||
try {
|
||||
const attribute = this.filteredSearchInput.dataset.usernameParams;
|
||||
const attribute = this.filteredSearchInput.getAttribute('data-username-params');
|
||||
JSON.parse(attribute).forEach((user) => {
|
||||
usernamesById[user.id] = user.username;
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@ export function setPositionDataAttribute(el, options) {
|
|||
|
||||
const positionObject = { ...JSON.parse(position), x, y, width, height };
|
||||
|
||||
el.dataset.position = JSON.stringify(positionObject);
|
||||
el.setAttribute('data-position', JSON.stringify(positionObject));
|
||||
}
|
||||
|
||||
export function updateDiscussionAvatarBadgeNumber(discussionEl, newBadgeNumber) {
|
||||
|
|
|
@ -82,7 +82,10 @@ export default class CreateMergeRequestDropdown {
|
|||
this.init();
|
||||
|
||||
if (isConfidentialIssue()) {
|
||||
this.createMergeRequestButton.dataset.dropdownTrigger = '#create-merge-request-dropdown';
|
||||
this.createMergeRequestButton.setAttribute(
|
||||
'data-dropdown-trigger',
|
||||
'#create-merge-request-dropdown',
|
||||
);
|
||||
initConfidentialMergeRequest();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -378,7 +378,7 @@ export default {
|
|||
},
|
||||
setActiveTask(el) {
|
||||
const { parentElement } = el;
|
||||
const lineNumbers = parentElement.dataset.sourcepos.match(/\b\d+(?=:)/g);
|
||||
const lineNumbers = parentElement.getAttribute('data-sourcepos').match(/\b\d+(?=:)/g);
|
||||
this.activeTask = {
|
||||
title: parentElement.innerText,
|
||||
lineNumberStart: lineNumbers[0],
|
||||
|
|
|
@ -127,7 +127,7 @@ export default class LazyLoader {
|
|||
|
||||
// Loading Images which are in the current viewport or close to them
|
||||
this.lazyImages = this.lazyImages.filter((selectedImage) => {
|
||||
if (selectedImage.dataset.src) {
|
||||
if (selectedImage.getAttribute('data-src')) {
|
||||
const imgBoundRect = selectedImage.getBoundingClientRect();
|
||||
const imgTop = scrollTop + imgBoundRect.top;
|
||||
const imgBound = imgTop + imgBoundRect.height;
|
||||
|
@ -156,17 +156,16 @@ export default class LazyLoader {
|
|||
}
|
||||
|
||||
static loadImage(img) {
|
||||
if (img.dataset.src) {
|
||||
if (img.getAttribute('data-src')) {
|
||||
img.setAttribute('loading', 'lazy');
|
||||
let imgUrl = img.dataset.src;
|
||||
let imgUrl = img.getAttribute('data-src');
|
||||
// Only adding width + height for avatars for now
|
||||
if (imgUrl.indexOf('/avatar/') > -1 && imgUrl.indexOf('?') === -1) {
|
||||
const targetWidth = img.getAttribute('width') || img.width;
|
||||
imgUrl += `?width=${targetWidth}`;
|
||||
}
|
||||
img.setAttribute('src', imgUrl);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
delete img.dataset.src;
|
||||
img.removeAttribute('data-src');
|
||||
img.classList.remove('lazy');
|
||||
img.classList.add('js-lazy-loaded');
|
||||
img.classList.add('qa-js-lazy-loaded');
|
||||
|
|
|
@ -56,7 +56,7 @@ export function confirmAction(
|
|||
export function confirmViaGlModal(message, element) {
|
||||
const primaryBtnConfig = {};
|
||||
|
||||
const { confirmBtnVariant } = element.dataset;
|
||||
const confirmBtnVariant = element.getAttribute('data-confirm-btn-variant');
|
||||
|
||||
if (confirmBtnVariant) {
|
||||
primaryBtnConfig.primaryBtnVariant = confirmBtnVariant;
|
||||
|
|
|
@ -41,7 +41,7 @@ export default {
|
|||
const dropdownToggle = this.$refs.glDropdown.$el.querySelector('.dropdown-toggle');
|
||||
|
||||
if (dropdownToggle) {
|
||||
dropdownToggle.dataset.qaSelector = 'access_level_dropdown';
|
||||
dropdownToggle.setAttribute('data-qa-selector', 'access_level_dropdown');
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function onSidebarLinkClick() {
|
||||
const setDataTrackAction = (element, action) => {
|
||||
element.dataset.trackAction = action;
|
||||
element.setAttribute('data-track-action', action);
|
||||
};
|
||||
|
||||
const setDataTrackExtra = (element, value) => {
|
||||
|
@ -12,10 +12,10 @@ function onSidebarLinkClick() {
|
|||
? SIDEBAR_COLLAPSED
|
||||
: SIDEBAR_EXPANDED;
|
||||
|
||||
element.dataset.trackExtra = JSON.stringify({
|
||||
sidebar_display: sidebarCollapsed,
|
||||
menu_display: value,
|
||||
});
|
||||
element.setAttribute(
|
||||
'data-track-extra',
|
||||
JSON.stringify({ sidebar_display: sidebarCollapsed, menu_display: value }),
|
||||
);
|
||||
};
|
||||
|
||||
const EXPANDED = 'Expanded';
|
||||
|
|
|
@ -298,7 +298,7 @@ export default class ActivityCalendar {
|
|||
.querySelector(this.activitiesContainer)
|
||||
.querySelectorAll('.js-localtime')
|
||||
.forEach((el) => {
|
||||
el.setAttribute('title', formatDate(el.dataset.datetime));
|
||||
el.setAttribute('title', formatDate(el.getAttribute('data-datetime')));
|
||||
});
|
||||
})
|
||||
.catch(() =>
|
||||
|
|
|
@ -57,7 +57,7 @@ export default {
|
|||
|
||||
if (authorParam) {
|
||||
commitsSearchInput.setAttribute('disabled', true);
|
||||
commitsSearchInput.dataset.toggle = 'tooltip';
|
||||
commitsSearchInput.setAttribute('data-toggle', 'tooltip');
|
||||
commitsSearchInput.setAttribute('title', tooltipMessage);
|
||||
this.currentAuthor = authorParam;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ function mountAssigneesComponentDeprecated(mediator) {
|
|||
issuableIid: String(iid),
|
||||
projectPath: fullPath,
|
||||
field: el.dataset.field,
|
||||
signedIn: Object.hasOwn(el.dataset, 'signedIn'),
|
||||
signedIn: el.hasAttribute('data-signed-in'),
|
||||
issuableType:
|
||||
isInIssuePage() || isInIncidentPage() || isInDesignPage()
|
||||
? IssuableType.Issue
|
||||
|
@ -149,7 +149,7 @@ function mountAssigneesComponent() {
|
|||
},
|
||||
provide: {
|
||||
canUpdate: editable,
|
||||
directlyInviteMembers: Object.hasOwn(el.dataset, 'directlyInviteMembers'),
|
||||
directlyInviteMembers: el.hasAttribute('data-directly-invite-members'),
|
||||
},
|
||||
render: (createElement) =>
|
||||
createElement('sidebar-assignees-widget', {
|
||||
|
|
|
@ -39,7 +39,7 @@ export default () => {
|
|||
return createElement(TerraformList, {
|
||||
props: {
|
||||
emptyStateImage,
|
||||
terraformAdmin: Object.hasOwn(el.dataset, 'terraformAdmin'),
|
||||
terraformAdmin: el.hasAttribute('data-terraform-admin'),
|
||||
},
|
||||
});
|
||||
},
|
||||
|
|
|
@ -33,7 +33,7 @@ export default {
|
|||
this.fetchFreshItems();
|
||||
|
||||
const body = document.querySelector('body');
|
||||
const { namespaceId } = body.dataset;
|
||||
const namespaceId = body.getAttribute('data-namespace-id');
|
||||
|
||||
this.track('click_whats_new_drawer', { label: 'namespace_id', value: namespaceId });
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export const STORAGE_KEY = 'display-whats-new-notification';
|
||||
|
||||
export const getVersionDigest = (appEl) => appEl.dataset.versionDigest;
|
||||
export const getVersionDigest = (appEl) => appEl.getAttribute('data-version-digest');
|
||||
|
||||
export const setNotification = (appEl) => {
|
||||
const versionDigest = getVersionDigest(appEl);
|
||||
|
|
|
@ -13,16 +13,16 @@ export default function initVueMRPage() {
|
|||
const diffsAppProjectPath = 'testproject';
|
||||
const mrEl = document.createElement('div');
|
||||
mrEl.className = 'merge-request fixture-mr';
|
||||
mrEl.dataset.mrAction = 'diffs';
|
||||
mrEl.setAttribute('data-mr-action', 'diffs');
|
||||
mrTestEl.appendChild(mrEl);
|
||||
|
||||
const mrDiscussionsEl = document.createElement('div');
|
||||
mrDiscussionsEl.id = 'js-vue-mr-discussions';
|
||||
mrDiscussionsEl.dataset.currentUserData = JSON.stringify(userDataMock);
|
||||
mrDiscussionsEl.dataset.noteableData = JSON.stringify(noteableDataMock);
|
||||
mrDiscussionsEl.dataset.notesData = JSON.stringify(notesDataMock);
|
||||
mrDiscussionsEl.dataset.noteableType = 'merge-request';
|
||||
mrDiscussionsEl.dataset.isLocked = 'false';
|
||||
mrDiscussionsEl.setAttribute('data-current-user-data', JSON.stringify(userDataMock));
|
||||
mrDiscussionsEl.setAttribute('data-noteable-data', JSON.stringify(noteableDataMock));
|
||||
mrDiscussionsEl.setAttribute('data-notes-data', JSON.stringify(notesDataMock));
|
||||
mrDiscussionsEl.setAttribute('data-noteable-type', 'merge-request');
|
||||
mrDiscussionsEl.setAttribute('data-is-locked', 'false');
|
||||
mrTestEl.appendChild(mrDiscussionsEl);
|
||||
|
||||
const discussionCounterEl = document.createElement('div');
|
||||
|
@ -31,9 +31,9 @@ export default function initVueMRPage() {
|
|||
|
||||
const diffsAppEl = document.createElement('div');
|
||||
diffsAppEl.id = 'js-diffs-app';
|
||||
diffsAppEl.dataset.endpoint = diffsAppEndpoint;
|
||||
diffsAppEl.dataset.projectPath = diffsAppProjectPath;
|
||||
diffsAppEl.dataset.currentUserData = JSON.stringify(userDataMock);
|
||||
diffsAppEl.setAttribute('data-endpoint', diffsAppEndpoint);
|
||||
diffsAppEl.setAttribute('data-project-path', diffsAppProjectPath);
|
||||
diffsAppEl.setAttribute('data-current-user-data', JSON.stringify(userDataMock));
|
||||
mrTestEl.appendChild(diffsAppEl);
|
||||
|
||||
const mock = new MockAdapter(axios);
|
||||
|
|
|
@ -9,7 +9,7 @@ export const toHaveSpriteIcon = (element, iconName) => {
|
|||
|
||||
const iconReferences = [].slice.apply(element.querySelectorAll('svg use'));
|
||||
const matchingIcon = iconReferences.find(
|
||||
(reference) => reference.parentNode.dataset.testid === `${iconName}-icon`,
|
||||
(reference) => reference.parentNode.getAttribute('data-testid') === `${iconName}-icon`,
|
||||
);
|
||||
|
||||
const pass = Boolean(matchingIcon);
|
||||
|
|
|
@ -12,8 +12,8 @@ describe('initAdminUsersApp', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
el = document.createElement('div');
|
||||
el.dataset.users = JSON.stringify(users);
|
||||
el.dataset.paths = JSON.stringify(paths);
|
||||
el.setAttribute('data-users', JSON.stringify(users));
|
||||
el.setAttribute('data-paths', JSON.stringify(paths));
|
||||
|
||||
wrapper = createWrapper(initAdminUsersApp(el));
|
||||
});
|
||||
|
@ -40,8 +40,8 @@ describe('initAdminUserActions', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
el = document.createElement('div');
|
||||
el.dataset.user = JSON.stringify(user);
|
||||
el.dataset.paths = JSON.stringify(paths);
|
||||
el.setAttribute('data-user', JSON.stringify(user));
|
||||
el.setAttribute('data-paths', JSON.stringify(paths));
|
||||
|
||||
wrapper = createWrapper(initAdminUserActions(el));
|
||||
});
|
||||
|
|
|
@ -15,8 +15,8 @@ describe('initRecoveryCodes', () => {
|
|||
beforeEach(() => {
|
||||
el = document.createElement('div');
|
||||
el.setAttribute('class', 'js-2fa-recovery-codes');
|
||||
el.dataset.codes = codesJsonString;
|
||||
el.dataset.profileAccountPath = profileAccountPath;
|
||||
el.setAttribute('data-codes', codesJsonString);
|
||||
el.setAttribute('data-profile-account-path', profileAccountPath);
|
||||
document.body.appendChild(el);
|
||||
|
||||
wrapper = createWrapper(initRecoveryCodes());
|
||||
|
|
|
@ -11,7 +11,7 @@ function createComponent() {
|
|||
}
|
||||
|
||||
async function setLoaded(loaded) {
|
||||
document.querySelector('.blob-viewer').dataset.loaded = loaded;
|
||||
document.querySelector('.blob-viewer').setAttribute('data-loaded', loaded);
|
||||
|
||||
await nextTick();
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ describe('Markdown table of contents component', () => {
|
|||
it('does not show dropdown when viewing non-rich content', async () => {
|
||||
createComponent();
|
||||
|
||||
document.querySelector('.blob-viewer').dataset.type = 'simple';
|
||||
document.querySelector('.blob-viewer').setAttribute('data-type', 'simple');
|
||||
|
||||
await setLoaded(true);
|
||||
|
||||
|
|
|
@ -80,9 +80,9 @@ describe('Blob viewer', () => {
|
|||
return asyncClick()
|
||||
.then(() => asyncClick())
|
||||
.then(() => {
|
||||
expect(document.querySelector('.blob-viewer[data-type="simple"]').dataset.loaded).toBe(
|
||||
'true',
|
||||
);
|
||||
expect(
|
||||
document.querySelector('.blob-viewer[data-type="simple"]').getAttribute('data-loaded'),
|
||||
).toBe('true');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@ describe('LockPopovers', () => {
|
|||
};
|
||||
|
||||
if (lockedByApplicationSetting) {
|
||||
popoverMountEl.dataset.popoverData = JSON.stringify(popoverData);
|
||||
popoverMountEl.setAttribute('data-popover-data', JSON.stringify(popoverData));
|
||||
} else if (lockedByAncestor) {
|
||||
popoverMountEl.dataset.popoverData = JSON.stringify({
|
||||
...popoverData,
|
||||
ancestor_namespace: mockNamespace,
|
||||
});
|
||||
popoverMountEl.setAttribute(
|
||||
'data-popover-data',
|
||||
JSON.stringify({ ...popoverData, ancestor_namespace: mockNamespace }),
|
||||
);
|
||||
}
|
||||
|
||||
document.body.appendChild(popoverMountEl);
|
||||
|
|
|
@ -195,8 +195,8 @@ describe('Code navigation actions', () => {
|
|||
|
||||
it('commits SET_CURRENT_DEFINITION with LSIF data', () => {
|
||||
target.classList.add('js-code-navigation');
|
||||
target.dataset.lineIndex = '0';
|
||||
target.dataset.charIndex = '0';
|
||||
target.setAttribute('data-line-index', '0');
|
||||
target.setAttribute('data-char-index', '0');
|
||||
|
||||
return testAction(
|
||||
actions.showDefinition,
|
||||
|
@ -218,8 +218,8 @@ describe('Code navigation actions', () => {
|
|||
|
||||
it('adds hll class to target element', () => {
|
||||
target.classList.add('js-code-navigation');
|
||||
target.dataset.lineIndex = '0';
|
||||
target.dataset.charIndex = '0';
|
||||
target.setAttribute('data-line-index', '0');
|
||||
target.setAttribute('data-char-index', '0');
|
||||
|
||||
return testAction(
|
||||
actions.showDefinition,
|
||||
|
@ -243,8 +243,8 @@ describe('Code navigation actions', () => {
|
|||
|
||||
it('caches current target element', () => {
|
||||
target.classList.add('js-code-navigation');
|
||||
target.dataset.lineIndex = '0';
|
||||
target.dataset.charIndex = '0';
|
||||
target.setAttribute('data-line-index', '0');
|
||||
target.setAttribute('data-char-index', '0');
|
||||
|
||||
return testAction(
|
||||
actions.showDefinition,
|
||||
|
|
|
@ -31,9 +31,9 @@ describe('ConfirmModal', () => {
|
|||
buttons.forEach((x) => {
|
||||
const button = document.createElement('button');
|
||||
button.setAttribute('class', 'js-confirm-modal-button');
|
||||
button.dataset.path = x.path;
|
||||
button.dataset.method = x.method;
|
||||
button.dataset.modalAttributes = JSON.stringify(x.modalAttributes);
|
||||
button.setAttribute('data-path', x.path);
|
||||
button.setAttribute('data-method', x.method);
|
||||
button.setAttribute('data-modal-attributes', JSON.stringify(x.modalAttributes));
|
||||
button.innerHTML = 'Action';
|
||||
buttonContainer.appendChild(button);
|
||||
});
|
||||
|
|
|
@ -59,10 +59,9 @@ describe('waitForCSSLoaded', () => {
|
|||
<link href="two.css" data-startupcss="loading">
|
||||
`);
|
||||
const events = waitForCSSLoaded(mockedCallback);
|
||||
document.querySelectorAll('[data-startupcss="loading"]').forEach((elem) => {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
elem.dataset.startupcss = 'loaded';
|
||||
});
|
||||
document
|
||||
.querySelectorAll('[data-startupcss="loading"]')
|
||||
.forEach((elem) => elem.setAttribute('data-startupcss', 'loaded'));
|
||||
document.dispatchEvent(new CustomEvent('CSSStartupLinkLoaded'));
|
||||
await events;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ describe('CreateMergeRequestDropdown', () => {
|
|||
});
|
||||
|
||||
it('enables when can create confidential issue', () => {
|
||||
document.querySelector('.js-create-mr').dataset.isConfidential = 'true';
|
||||
document.querySelector('.js-create-mr').setAttribute('data-is-confidential', 'true');
|
||||
confidentialState.selectedProject = { name: 'test' };
|
||||
|
||||
dropdown.enable();
|
||||
|
@ -93,7 +93,7 @@ describe('CreateMergeRequestDropdown', () => {
|
|||
});
|
||||
|
||||
it('does not enable when can not create confidential issue', () => {
|
||||
document.querySelector('.js-create-mr').dataset.isConfidential = 'true';
|
||||
document.querySelector('.js-create-mr').setAttribute('data-is-confidential', 'true');
|
||||
|
||||
dropdown.enable();
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@ describe('DeleteLabelModal', () => {
|
|||
buttons.forEach((x) => {
|
||||
const button = document.createElement('button');
|
||||
button.setAttribute('class', 'js-delete-label-modal-button');
|
||||
button.dataset.labelName = x.labelName;
|
||||
button.dataset.destroyPath = x.destroyPath;
|
||||
button.setAttribute('data-label-name', x.labelName);
|
||||
button.setAttribute('data-destroy-path', x.destroyPath);
|
||||
|
||||
if (x.subjectName) {
|
||||
button.dataset.subjectName = x.subjectName;
|
||||
button.setAttribute('data-subject-name', x.subjectName);
|
||||
}
|
||||
|
||||
button.innerHTML = 'Action';
|
||||
|
|
|
@ -27,7 +27,7 @@ describe('LazyLoader', () => {
|
|||
const createLazyLoadImage = () => {
|
||||
const newImg = document.createElement('img');
|
||||
newImg.className = 'lazy';
|
||||
newImg.dataset.src = TEST_PATH;
|
||||
newImg.setAttribute('data-src', TEST_PATH);
|
||||
|
||||
document.body.appendChild(newImg);
|
||||
triggerChildMutation();
|
||||
|
@ -108,7 +108,7 @@ describe('LazyLoader', () => {
|
|||
|
||||
expect(LazyLoader.loadImage).toHaveBeenCalledWith(img);
|
||||
expect(img.getAttribute('src')).toBe(TEST_PATH);
|
||||
expect(img.dataset.src).toBeUndefined();
|
||||
expect(img.getAttribute('data-src')).toBe(null);
|
||||
expect(img).toHaveClass('js-lazy-loaded');
|
||||
});
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('initMembersApp', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
el = document.createElement('div');
|
||||
el.dataset.membersData = dataAttribute;
|
||||
el.setAttribute('data-members-data', dataAttribute);
|
||||
|
||||
window.gon = { current_user_id: 123 };
|
||||
});
|
||||
|
|
|
@ -256,7 +256,7 @@ describe('Members Utils', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
el = document.createElement('div');
|
||||
el.dataset.membersData = dataAttribute;
|
||||
el.setAttribute('data-members-data', dataAttribute);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
|
@ -78,8 +78,8 @@ describe('Markdown component', () => {
|
|||
});
|
||||
|
||||
await nextTick();
|
||||
expect(findLink().dataset.remote).toBeUndefined();
|
||||
expect(findLink().dataset.type).toBeUndefined();
|
||||
expect(findLink().getAttribute('data-remote')).toBe(null);
|
||||
expect(findLink().getAttribute('data-type')).toBe(null);
|
||||
});
|
||||
|
||||
describe('When parsing images', () => {
|
||||
|
|
|
@ -404,13 +404,13 @@ describe('Actions Notes Store', () => {
|
|||
beforeEach(() => {
|
||||
axiosMock.onDelete(endpoint).replyOnce(200, {});
|
||||
|
||||
document.body.dataset.page = '';
|
||||
document.body.setAttribute('data-page', '');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
axiosMock.restore();
|
||||
|
||||
document.body.dataset.page = '';
|
||||
document.body.setAttribute('data-page', '');
|
||||
});
|
||||
|
||||
it('commits DELETE_NOTE and dispatches updateMergeRequestWidget', () => {
|
||||
|
@ -440,7 +440,7 @@ describe('Actions Notes Store', () => {
|
|||
it('dispatches removeDiscussionsFromDiff on merge request page', () => {
|
||||
const note = { path: endpoint, id: 1 };
|
||||
|
||||
document.body.dataset.page = 'projects:merge_requests:show';
|
||||
document.body.setAttribute('data-page', 'projects:merge_requests:show');
|
||||
|
||||
return testAction(
|
||||
actions.removeNote,
|
||||
|
@ -473,13 +473,13 @@ describe('Actions Notes Store', () => {
|
|||
beforeEach(() => {
|
||||
axiosMock.onDelete(endpoint).replyOnce(200, {});
|
||||
|
||||
document.body.dataset.page = '';
|
||||
document.body.setAttribute('data-page', '');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
axiosMock.restore();
|
||||
|
||||
document.body.dataset.page = '';
|
||||
document.body.setAttribute('data-page', '');
|
||||
});
|
||||
|
||||
it('dispatches removeNote', () => {
|
||||
|
|
|
@ -17,11 +17,11 @@ describe('performance bar wrapper', () => {
|
|||
performance.getEntriesByType = jest.fn().mockReturnValue([]);
|
||||
|
||||
peekWrapper.setAttribute('id', 'js-peek');
|
||||
peekWrapper.dataset.env = 'development';
|
||||
peekWrapper.dataset.requestId = '123';
|
||||
peekWrapper.dataset.peekUrl = '/-/peek/results';
|
||||
peekWrapper.dataset.statsUrl = 'https://log.gprd.gitlab.net/app/dashboards#/view/';
|
||||
peekWrapper.dataset.profileUrl = '?lineprofiler=true';
|
||||
peekWrapper.setAttribute('data-env', 'development');
|
||||
peekWrapper.setAttribute('data-request-id', '123');
|
||||
peekWrapper.setAttribute('data-peek-url', '/-/peek/results');
|
||||
peekWrapper.setAttribute('data-stats-url', 'https://log.gprd.gitlab.net/app/dashboards#/view/');
|
||||
peekWrapper.setAttribute('data-profile-url', '?lineprofiler=true');
|
||||
|
||||
mock = new MockAdapter(axios);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ describe('Search autocomplete dropdown', () => {
|
|||
};
|
||||
|
||||
const disableProjectIssues = () => {
|
||||
document.querySelector('.js-search-project-options').dataset.issuesDisabled = true;
|
||||
document.querySelector('.js-search-project-options').setAttribute('data-issues-disabled', true);
|
||||
};
|
||||
|
||||
// Mock `gl` object in window for dashboard specific page. App code will need it.
|
||||
|
|
|
@ -22,7 +22,7 @@ describe('User Popovers', () => {
|
|||
const link = document.createElement('a');
|
||||
|
||||
link.classList.add('js-user-link');
|
||||
link.dataset.user = '1';
|
||||
link.setAttribute('data-user', '1');
|
||||
|
||||
return link;
|
||||
};
|
||||
|
|
|
@ -95,10 +95,10 @@ export const setAssignees = (...users) => {
|
|||
const input = document.createElement('input');
|
||||
input.name = 'merge_request[assignee_ids][]';
|
||||
input.value = user.id.toString();
|
||||
input.dataset.avatarUrl = user.avatar_url;
|
||||
input.dataset.name = user.name;
|
||||
input.dataset.username = user.username;
|
||||
input.dataset.canMerge = user.can_merge;
|
||||
input.setAttribute('data-avatar-url', user.avatar_url);
|
||||
input.setAttribute('data-name', user.name);
|
||||
input.setAttribute('data-username', user.username);
|
||||
input.setAttribute('data-can-merge', user.can_merge);
|
||||
return input;
|
||||
}),
|
||||
);
|
||||
|
|
|
@ -193,7 +193,9 @@ describe('MRWidgetMerged', () => {
|
|||
|
||||
it('shows button to copy commit SHA to clipboard', () => {
|
||||
expect(selectors.copyMergeShaButton).not.toBe(null);
|
||||
expect(selectors.copyMergeShaButton.dataset.clipboardText).toBe(vm.mr.mergeCommitSha);
|
||||
expect(selectors.copyMergeShaButton.getAttribute('data-clipboard-text')).toBe(
|
||||
vm.mr.mergeCommitSha,
|
||||
);
|
||||
});
|
||||
|
||||
it('hides button to copy commit SHA if SHA does not exist', async () => {
|
||||
|
|
|
@ -424,7 +424,7 @@ describe('MrWidgetOptions', () => {
|
|||
beforeEach(() => {
|
||||
const favicon = document.createElement('link');
|
||||
favicon.setAttribute('id', 'favicon');
|
||||
favicon.dataset.originalHref = faviconDataUrl;
|
||||
favicon.setAttribute('data-original-href', faviconDataUrl);
|
||||
document.body.appendChild(favicon);
|
||||
|
||||
faviconElement = document.getElementById('favicon');
|
||||
|
|
|
@ -46,14 +46,14 @@ export const findMonacoDiffEditor = () =>
|
|||
|
||||
export const findAndSetEditorValue = async (value) => {
|
||||
const editor = await findMonacoEditor();
|
||||
const { uri } = editor.dataset;
|
||||
const uri = editor.getAttribute('data-uri');
|
||||
|
||||
monacoEditor.getModel(uri).setValue(value);
|
||||
};
|
||||
|
||||
export const getEditorValue = async () => {
|
||||
const editor = await findMonacoEditor();
|
||||
const { uri } = editor.dataset;
|
||||
const uri = editor.getAttribute('data-uri');
|
||||
|
||||
return monacoEditor.getModel(uri).getValue();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue