Commit 35c8fd55 authored by Jacob Schatz's avatar Jacob Schatz

Update to jQuery 3.

parent 86c9c93d
...@@ -312,7 +312,7 @@ class AwardsHandler { ...@@ -312,7 +312,7 @@ class AwardsHandler {
} }
getAwardUrl() { getAwardUrl() {
return this.getVotesBlock().data('award-url'); return this.getVotesBlock().data('awardUrl');
} }
checkMutuality(votesBlock, emoji) { checkMutuality(votesBlock, emoji) {
......
...@@ -2,7 +2,7 @@ import Clipboard from 'clipboard'; ...@@ -2,7 +2,7 @@ import Clipboard from 'clipboard';
function showTooltip(target, title) { function showTooltip(target, title) {
const $target = $(target); const $target = $(target);
const originalTitle = $target.data('original-title'); const originalTitle = $target.data('originalTitle');
if (!$target.data('hideTooltip')) { if (!$target.data('hideTooltip')) {
$target $target
......
...@@ -43,7 +43,7 @@ $(document).on('keydown.quick_submit', '.js-quick-submit', (e) => { ...@@ -43,7 +43,7 @@ $(document).on('keydown.quick_submit', '.js-quick-submit', (e) => {
const $form = $(e.target).closest('form'); const $form = $(e.target).closest('form');
const $submitButton = $form.find('input[type=submit], button[type=submit]').first(); const $submitButton = $form.find('input[type=submit], button[type=submit]').first();
if (!$submitButton.attr('disabled')) { if (!$submitButton.prop('disabled')) {
$submitButton.trigger('click', [e]); $submitButton.trigger('click', [e]);
if (!isInIssuePage()) { if (!isInIssuePage()) {
......
...@@ -40,7 +40,7 @@ $.fn.requiresInput = function requiresInput() { ...@@ -40,7 +40,7 @@ $.fn.requiresInput = function requiresInput() {
// based on the option selected // based on the option selected
function hideOrShowHelpBlock(form) { function hideOrShowHelpBlock(form) {
const selected = $('.js-select-namespace option:selected'); const selected = $('.js-select-namespace option:selected');
if (selected.length && selected.data('options-parent') === 'groups') { if (selected.length && selected.data('optionsParent') === 'groups') {
form.find('.help-block').hide(); form.find('.help-block').hide();
} else if (selected.length) { } else if (selected.length) {
form.find('.help-block').show(); form.find('.help-block').show();
......
...@@ -10,10 +10,10 @@ $(() => { ...@@ -10,10 +10,10 @@ $(() => {
const deleteBlobForm = $('.js-delete-blob-form'); const deleteBlobForm = $('.js-delete-blob-form');
if (editBlobForm.length) { if (editBlobForm.length) {
const urlRoot = editBlobForm.data('relative-url-root'); const urlRoot = editBlobForm.data('relativeUrlRoot');
const assetsPath = editBlobForm.data('assets-prefix'); const assetsPath = editBlobForm.data('assetsPrefix');
const blobLanguage = editBlobForm.data('blob-language'); const blobLanguage = editBlobForm.data('blobLanguage');
const currentAction = $('.js-file-title').data('current-action'); const currentAction = $('.js-file-title').data('currentAction');
new EditBlob(`${urlRoot}${assetsPath}`, blobLanguage, currentAction); new EditBlob(`${urlRoot}${assetsPath}`, blobLanguage, currentAction);
new NewCommitForm(editBlobForm); new NewCommitForm(editBlobForm);
......
...@@ -59,7 +59,7 @@ export default class EditBlob { ...@@ -59,7 +59,7 @@ export default class EditBlob {
if (paneId === '#preview') { if (paneId === '#preview') {
this.$toggleButton.hide(); this.$toggleButton.hide();
axios.post(currentLink.data('preview-url'), { axios.post(currentLink.data('previewUrl'), {
content: this.editor.getValue(), content: this.editor.getValue(),
}) })
.then(({ data }) => { .then(({ data }) => {
......
...@@ -25,7 +25,7 @@ $(document).off('created.label').on('created.label', (e, label) => { ...@@ -25,7 +25,7 @@ $(document).off('created.label').on('created.label', (e, label) => {
gl.issueBoards.newListDropdownInit = () => { gl.issueBoards.newListDropdownInit = () => {
$('.js-new-board-list').each(function () { $('.js-new-board-list').each(function () {
const $this = $(this); const $this = $(this);
new CreateLabelDropdown($this.closest('.dropdown').find('.dropdown-new-label'), $this.data('namespace-path'), $this.data('project-path')); new CreateLabelDropdown($this.closest('.dropdown').find('.dropdown-new-label'), $this.data('namespacePath'), $this.data('projectPath'));
$this.glDropdown({ $this.glDropdown({
data(term, callback) { data(term, callback) {
......
...@@ -13,6 +13,6 @@ import 'bootstrap-sass/assets/javascripts/bootstrap/popover'; ...@@ -13,6 +13,6 @@ import 'bootstrap-sass/assets/javascripts/bootstrap/popover';
// custom jQuery functions // custom jQuery functions
$.fn.extend({ $.fn.extend({
disable() { return $(this).attr('disabled', 'disabled').addClass('disabled'); }, disable() { return $(this).prop('disabled', true).addClass('disabled'); },
enable() { return $(this).removeAttr('disabled').removeClass('disabled'); }, enable() { return $(this).prop('disabled', false).removeClass('disabled'); },
}); });
...@@ -13,7 +13,7 @@ export default class Compare { ...@@ -13,7 +13,7 @@ export default class Compare {
$dropdown = $(dropdown); $dropdown = $(dropdown);
return $dropdown.glDropdown({ return $dropdown.glDropdown({
selectable: true, selectable: true,
fieldName: $dropdown.data('field-name'), fieldName: $dropdown.data('fieldName'),
filterable: true, filterable: true,
id: function(obj, $el) { id: function(obj, $el) {
return $el.data('id'); return $el.data('id');
......
...@@ -9,7 +9,7 @@ export default function initCompareAutocomplete() { ...@@ -9,7 +9,7 @@ export default function initCompareAutocomplete() {
$dropdown = $(this); $dropdown = $(this);
selected = $dropdown.data('selected'); selected = $dropdown.data('selected');
const $dropdownContainer = $dropdown.closest('.dropdown'); const $dropdownContainer = $dropdown.closest('.dropdown');
const $fieldInput = $(`input[name="${$dropdown.data('field-name')}"]`, $dropdownContainer); const $fieldInput = $(`input[name="${$dropdown.data('fieldName')}"]`, $dropdownContainer);
const $filterInput = $('input[type="search"]', $dropdownContainer); const $filterInput = $('input[type="search"]', $dropdownContainer);
$dropdown.glDropdown({ $dropdown.glDropdown({
data: function(term, callback) { data: function(term, callback) {
...@@ -25,7 +25,7 @@ export default function initCompareAutocomplete() { ...@@ -25,7 +25,7 @@ export default function initCompareAutocomplete() {
selectable: true, selectable: true,
filterable: true, filterable: true,
filterRemote: true, filterRemote: true,
fieldName: $dropdown.data('field-name'), fieldName: $dropdown.data('fieldName'),
filterInput: 'input[type="search"]', filterInput: 'input[type="search"]',
renderRow: function(ref) { renderRow: function(ref) {
var link; var link;
......
...@@ -68,7 +68,7 @@ export default class Diff { ...@@ -68,7 +68,7 @@ export default class Diff {
} }
const file = $target.parents('.diff-file'); const file = $target.parents('.diff-file');
const link = file.data('blob-diff-path'); const link = file.data('blobDiffPath');
const view = file.data('view'); const view = file.data('view');
const params = { since, to, bottom, offset, unfold, view }; const params = { since, to, bottom, offset, unfold, view };
...@@ -121,7 +121,7 @@ export default class Diff { ...@@ -121,7 +121,7 @@ export default class Diff {
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
diffViewType() { diffViewType() {
return $('.inline-parallel-buttons a.active').data('view-type'); return $('.inline-parallel-buttons a.active').data('viewType');
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
lineNumbers(line) { lineNumbers(line) {
......
...@@ -17,9 +17,9 @@ class DueDateSelect { ...@@ -17,9 +17,9 @@ class DueDateSelect {
this.$value = $block.find('.value'); this.$value = $block.find('.value');
this.$valueContent = $block.find('.value-content'); this.$valueContent = $block.find('.value-content');
this.$sidebarValue = $('.js-due-date-sidebar-value', $block); this.$sidebarValue = $('.js-due-date-sidebar-value', $block);
this.fieldName = $dropdown.data('field-name'); this.fieldName = $dropdown.data('fieldName');
this.abilityName = $dropdown.data('ability-name'); this.abilityName = $dropdown.data('abilityName');
this.issueUpdateURL = $dropdown.data('issue-update'); this.issueUpdateURL = $dropdown.data('issueUpdate');
this.rawSelectedDate = null; this.rawSelectedDate = null;
this.displayedDate = null; this.displayedDate = null;
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
if (!this.userCanCreateNote) { if (!this.userCanCreateNote) {
// data-can-create-note is an empty string when true, otherwise undefined // data-can-create-note is an empty string when true, otherwise undefined
this.userCanCreateNote = $diffFile.closest(DIFF_CONTAINER_SELECTOR).data('can-create-note') === ''; this.userCanCreateNote = $diffFile.closest(DIFF_CONTAINER_SELECTOR).data('canCreateNote') === '';
} }
this.isParallelView = Cookies.get('diff_view') === 'parallel'; this.isParallelView = Cookies.get('diff_view') === 'parallel';
......
...@@ -485,7 +485,7 @@ GitLabDropdown = (function() { ...@@ -485,7 +485,7 @@ GitLabDropdown = (function() {
$target = $(e.target); $target = $(e.target);
if ($target && !$target.hasClass('dropdown-menu-close') && if ($target && !$target.hasClass('dropdown-menu-close') &&
!$target.hasClass('dropdown-menu-close-icon') && !$target.hasClass('dropdown-menu-close-icon') &&
!$target.data('is-link')) { !$target.data('isLink')) {
e.stopPropagation(); e.stopPropagation();
return false; return false;
} else { } else {
......
...@@ -12,7 +12,7 @@ export default class GLForm { ...@@ -12,7 +12,7 @@ export default class GLForm {
this.destroy(); this.destroy();
// Setup the form // Setup the form
this.setupForm(); this.setupForm();
this.form.data('gl-form', this); this.form.data('glForm', this);
} }
destroy() { destroy() {
...@@ -21,7 +21,7 @@ export default class GLForm { ...@@ -21,7 +21,7 @@ export default class GLForm {
if (this.autoComplete) { if (this.autoComplete) {
this.autoComplete.destroy(); this.autoComplete.destroy();
} }
this.form.data('gl-form', null); this.form.data('glForm', null);
} }
setupForm() { setupForm() {
......
...@@ -11,7 +11,7 @@ export default class GpgBadges { ...@@ -11,7 +11,7 @@ export default class GpgBadges {
badges.html('<i class="fa fa-spinner fa-spin"></i>'); badges.html('<i class="fa fa-spinner fa-spin"></i>');
const params = parseQueryStringIntoObject(form.serialize()); const params = parseQueryStringIntoObject(form.serialize());
return axios.get(form.data('signatures-path'), { params }) return axios.get(form.data('signaturesPath'), { params })
.then(({ data }) => { .then(({ data }) => {
data.signatures.forEach((signature) => { data.signatures.forEach((signature) => {
badges.filter(`[data-commit-sha="${signature.commit_sha}"]`).replaceWith(signature.html); badges.filter(`[data-commit-sha="${signature.commit_sha}"]`).replaceWith(signature.html);
......
...@@ -7,8 +7,8 @@ export default function groupsSelect() { ...@@ -7,8 +7,8 @@ export default function groupsSelect() {
window.GROUP_SELECT_PER_PAGE = 20; window.GROUP_SELECT_PER_PAGE = 20;
$('.ajax-groups-select').each(function setAjaxGroupsSelect2() { $('.ajax-groups-select').each(function setAjaxGroupsSelect2() {
const $select = $(this); const $select = $(this);
const allAvailable = $select.data('all-available'); const allAvailable = $select.data('allAvailable');
const skipGroups = $select.data('skip-groups') || []; const skipGroups = $select.data('skipGroups') || [];
$select.select2({ $select.select2({
placeholder: 'Search for a group', placeholder: 'Search for a group',
multiple: $select.hasClass('multiselect'), multiple: $select.hasClass('multiselect'),
......
...@@ -6,8 +6,8 @@ export default class IntegrationSettingsForm { ...@@ -6,8 +6,8 @@ export default class IntegrationSettingsForm {
this.$form = $(formSelector); this.$form = $(formSelector);
// Form Metadata // Form Metadata
this.canTestService = this.$form.data('can-test'); this.canTestService = this.$form.data('canTest');
this.testEndPoint = this.$form.data('test-url'); this.testEndPoint = this.$form.data('testUrl');
// Form Child Elements // Form Child Elements
this.$serviceToggle = this.$form.find('#service_active'); this.$serviceToggle = this.$form.find('#service_active');
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
taskListUpdateSuccess(data) { taskListUpdateSuccess(data) {
try { try {
this.checkForSpam(data); this.checkForSpam(data);
this.closeRecaptcha();
} catch (error) { } catch (error) {
if (error && error.name === 'SpamError') this.openRecaptcha(); if (error && error.name === 'SpamError') this.openRecaptcha();
} }
......
export default function issueStatusSelect() { export default function issueStatusSelect() {
$('.js-issue-status').each((i, el) => { $('.js-issue-status').each((i, el) => {
const fieldName = $(el).data('field-name'); const fieldName = $(el).data('fieldName');
return $(el).glDropdown({ return $(el).glDropdown({
selectable: true, selectable: true,
fieldName, fieldName,
......
...@@ -25,19 +25,19 @@ export default class LabelsSelect { ...@@ -25,19 +25,19 @@ export default class LabelsSelect {
$dropdown = $(dropdown); $dropdown = $(dropdown);
$dropdownContainer = $dropdown.closest('.labels-filter'); $dropdownContainer = $dropdown.closest('.labels-filter');
$toggleText = $dropdown.find('.dropdown-toggle-text'); $toggleText = $dropdown.find('.dropdown-toggle-text');
namespacePath = $dropdown.data('namespace-path'); namespacePath = $dropdown.data('namespacePath');
projectPath = $dropdown.data('project-path'); projectPath = $dropdown.data('projectPath');
labelUrl = $dropdown.data('labels'); labelUrl = $dropdown.data('labels');
issueUpdateURL = $dropdown.data('issueUpdate'); issueUpdateURL = $dropdown.data('issueUpdate');
selectedLabel = $dropdown.data('selected'); selectedLabel = $dropdown.data('selected');
if ((selectedLabel != null) && !$dropdown.hasClass('js-multiselect')) { if ((selectedLabel != null) && !$dropdown.hasClass('js-multiselect')) {
selectedLabel = selectedLabel.split(','); selectedLabel = selectedLabel.split(',');
} }
showNo = $dropdown.data('show-no'); showNo = $dropdown.data('showNo');
showAny = $dropdown.data('show-any'); showAny = $dropdown.data('showAny');
showMenuAbove = $dropdown.data('showMenuAbove'); showMenuAbove = $dropdown.data('showMenuAbove');
defaultLabel = $dropdown.data('default-label'); defaultLabel = $dropdown.data('defaultLabel');
abilityName = $dropdown.data('ability-name'); abilityName = $dropdown.data('abilityName');
$selectbox = $dropdown.closest('.selectbox'); $selectbox = $dropdown.closest('.selectbox');
$block = $selectbox.closest('.block'); $block = $selectbox.closest('.block');
$form = $dropdown.closest('form, .js-issuable-update'); $form = $dropdown.closest('form, .js-issuable-update');
...@@ -45,11 +45,11 @@ export default class LabelsSelect { ...@@ -45,11 +45,11 @@ export default class LabelsSelect {
$sidebarLabelTooltip = $block.find('.js-sidebar-labels-tooltip'); $sidebarLabelTooltip = $block.find('.js-sidebar-labels-tooltip');
$value = $block.find('.value'); $value = $block.find('.value');
$loading = $block.find('.block-loading').fadeOut(); $loading = $block.find('.block-loading').fadeOut();
fieldName = $dropdown.data('field-name'); fieldName = $dropdown.data('fieldName');
useId = $dropdown.is('.js-issuable-form-dropdown, .js-filter-bulk-update, .js-label-sidebar-dropdown'); useId = $dropdown.is('.js-issuable-form-dropdown, .js-filter-bulk-update, .js-label-sidebar-dropdown');
propertyName = useId ? 'id' : 'title'; propertyName = useId ? 'id' : 'title';
initialSelected = $selectbox initialSelected = $selectbox
.find('input[name="' + $dropdown.data('field-name') + '"]') .find('input[name="' + $dropdown.data('fieldName') + '"]')
.map(function () { .map(function () {
return this.value; return this.value;
}).get(); }).get();
...@@ -268,7 +268,7 @@ export default class LabelsSelect { ...@@ -268,7 +268,7 @@ export default class LabelsSelect {
return defaultLabel; return defaultLabel;
} }
}, },
fieldName: $dropdown.data('field-name'), fieldName: $dropdown.data('fieldName'),
id: function(label) { id: function(label) {
if (label.id <= 0) return label.title; if (label.id <= 0) return label.title;
......
...@@ -4,7 +4,7 @@ import initFlyOutNav from './fly_out_nav'; ...@@ -4,7 +4,7 @@ import initFlyOutNav from './fly_out_nav';
function hideEndFade($scrollingTabs) { function hideEndFade($scrollingTabs) {
$scrollingTabs.each(function scrollTabsLoop() { $scrollingTabs.each(function scrollTabsLoop() {
const $this = $(this); const $this = $(this);
$this.siblings('.fade-right').toggleClass('scrolling', $this.width() < $this.prop('scrollWidth')); $this.siblings('.fade-right').toggleClass('scrolling', Math.round($this.width()) < $this.prop('scrollWidth'));
}); });
} }
......
...@@ -138,7 +138,7 @@ textUtils.init = function(form) { ...@@ -138,7 +138,7 @@ textUtils.init = function(form) {
return $('.js-md', form).off('click').on('click', function() { return $('.js-md', form).off('click').on('click', function() {
var $this; var $this;
$this = $(this); $this = $(this);
return self.updateText($this.closest('.md-area').find('textarea'), $this.data('md-tag'), $this.data('md-block'), !$this.data('md-prepend')); return self.updateText($this.closest('.md-area').find('textarea'), $this.data('mdTag'), $this.data('mdBlock'), !$this.data('mdPrepend'));
}); });
}; };
......
...@@ -83,7 +83,7 @@ LineHighlighter.prototype.clickHandler = function(event) { ...@@ -83,7 +83,7 @@ LineHighlighter.prototype.clickHandler = function(event) {
var current, lineNumber, range; var current, lineNumber, range;
event.preventDefault(); event.preventDefault();
this.clearHighlight(); this.clearHighlight();
lineNumber = $(event.target).closest('a').data('line-number'); lineNumber = $(event.target).closest('a').data('lineNumber');
current = this.hashToRange(this._hash); current = this.hashToRange(this._hash);
if (!(current[0] && event.shiftKey)) { if (!(current[0] && event.shiftKey)) {
// If there's no current selection, or there is but Shift wasn't held, // If there's no current selection, or there is but Shift wasn't held,
......
...@@ -220,7 +220,7 @@ $(() => { ...@@ -220,7 +220,7 @@ $(() => {
$document.on('click', '.js-confirm-danger', (e) => { $document.on('click', '.js-confirm-danger', (e) => {
const btn = $(e.target); const btn = $(e.target);
const form = btn.closest('form'); const form = btn.closest('form');
const text = btn.data('confirm-danger-message'); const text = btn.data('confirmDangerMessage');
e.preventDefault(); e.preventDefault();
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
......
...@@ -19,7 +19,7 @@ export default class Members { ...@@ -19,7 +19,7 @@ export default class Members {
isSelectable(selected, $el) { isSelectable(selected, $el) {
return !$el.hasClass('is-active'); return !$el.hasClass('is-active');
}, },
fieldName: $btn.data('field-name'), fieldName: $btn.data('fieldName'),
id(selected, $el) { id(selected, $el) {
return $el.data('id'); return $el.data('id');
}, },
...@@ -51,7 +51,7 @@ export default class Members { ...@@ -51,7 +51,7 @@ export default class Members {
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
getMemberListItems($el) { getMemberListItems($el) {
const $memberListItem = $el.is('.member') ? $el : $(`#${$el.data('el-id')}`); const $memberListItem = $el.is('.member') ? $el : $(`#${$el.data('elId')}`);
return { return {
$memberListItem, $memberListItem,
......
...@@ -361,7 +361,7 @@ export default class MergeRequestTabs { ...@@ -361,7 +361,7 @@ export default class MergeRequestTabs {
} }
diffViewType() { diffViewType() {
return $('.inline-parallel-buttons a.active').data('view-type'); return $('.inline-parallel-buttons a.active').data('viewType');
} }
isDiffAction(action) { isDiffAction(action) {
......
...@@ -24,19 +24,19 @@ export default class MilestoneSelect { ...@@ -24,19 +24,19 @@ export default class MilestoneSelect {
$els.each((i, dropdown) => { $els.each((i, dropdown) => {
let collapsedSidebarLabelTemplate, milestoneLinkNoneTemplate, milestoneLinkTemplate, selectedMilestone, selectedMilestoneDefault; let collapsedSidebarLabelTemplate, milestoneLinkNoneTemplate, milestoneLinkTemplate, selectedMilestone, selectedMilestoneDefault;
const $dropdown = $(dropdown); const $dropdown = $(dropdown);
const projectId = $dropdown.data('project-id'); const projectId = $dropdown.data('projectId');
const milestonesUrl = $dropdown.data('milestones'); const milestonesUrl = $dropdown.data('milestones');
const issueUpdateURL = $dropdown.data('issueUpdate'); const issueUpdateURL = $dropdown.data('issueUpdate');
const showNo = $dropdown.data('show-no'); const showNo = $dropdown.data('showNo');
const showAny = $dropdown.data('show-any'); const showAny = $dropdown.data('showAny');
const showMenuAbove = $dropdown.data('showMenuAbove'); const showMenuAbove = $dropdown.data('showMenuAbove');
const showUpcoming = $dropdown.data('show-upcoming'); const showUpcoming = $dropdown.data('showUpcoming');
const showStarted = $dropdown.data('show-started'); const showStarted = $dropdown.data('showStarted');
const useId = $dropdown.data('use-id'); const useId = $dropdown.data('useId');
const defaultLabel = $dropdown.data('default-label'); const defaultLabel = $dropdown.data('defaultLabel');
const defaultNo = $dropdown.data('default-no'); const defaultNo = $dropdown.data('defaultNo');
const issuableId = $dropdown.data('issuable-id'); const issuableId = $dropdown.data('issuableId');
const abilityName = $dropdown.data('ability-name'); const abilityName = $dropdown.data('abilityName');
const $selectBox = $dropdown.closest('.selectbox'); const $selectBox = $dropdown.closest('.selectbox');
const $block = $selectBox.closest('.block'); const $block = $selectBox.closest('.block');
const $sidebarCollapsedValue = $block.find('.sidebar-collapsed-icon'); const $sidebarCollapsedValue = $block.find('.sidebar-collapsed-icon');
...@@ -114,7 +114,7 @@ export default class MilestoneSelect { ...@@ -114,7 +114,7 @@ export default class MilestoneSelect {
} }
}, },
defaultLabel: defaultLabel, defaultLabel: defaultLabel,
fieldName: $dropdown.data('field-name'), fieldName: $dropdown.data('fieldName'),
text: milestone => _.escape(milestone.title), text: milestone => _.escape(milestone.title),
id: (milestone) => { id: (milestone) => {
if (!useId && !$dropdown.is('.js-issuable-form-dropdown')) { if (!useId && !$dropdown.is('.js-issuable-form-dropdown')) {
...@@ -166,7 +166,7 @@ export default class MilestoneSelect { ...@@ -166,7 +166,7 @@ export default class MilestoneSelect {
} }
if (boardsStore) { if (boardsStore) {
boardsStore[$dropdown.data('field-name')] = selected.name; boardsStore[$dropdown.data('fieldName')] = selected.name;
e.preventDefault(); e.preventDefault();
} else if ($dropdown.hasClass('js-filter-submit') && (isIssueIndex || isMRIndex)) { } else if ($dropdown.hasClass('js-filter-submit') && (isIssueIndex || isMRIndex)) {
return Issuable.filterResults($dropdown.closest('form')); return Issuable.filterResults($dropdown.closest('form'));
......
...@@ -219,7 +219,7 @@ export default class Notes { ...@@ -219,7 +219,7 @@ export default class Notes {
} }
editNote = $textarea.closest('.note'); editNote = $textarea.closest('.note');
if (editNote.length) { if (editNote.length) {
originalText = $textarea.closest('form').data('original-note'); originalText = $textarea.closest('form').data('originalNote');
newText = $textarea.val(); newText = $textarea.val();
if (originalText !== newText) { if (originalText !== newText) {
if (!confirm('Are you sure you want to cancel editing this comment?')) { if (!confirm('Are you sure you want to cancel editing this comment?')) {
...@@ -609,9 +609,9 @@ export default class Notes { ...@@ -609,9 +609,9 @@ export default class Notes {
*/ */
addDiscussionNote($form, note, isNewDiffComment) { addDiscussionNote($form, note, isNewDiffComment) {
if ($form.attr('data-resolve-all') != null) { if ($form.attr('data-resolve-all') != null) {
var projectPath = $form.data('project-path'); var projectPath = $form.data('projectPath');
var discussionId = $form.data('discussion-id'); var discussionId = $form.data('discussionId');
var mergeRequestId = $form.data('noteable-iid'); var mergeRequestId = $form.data('noteableIid');
if (ResolveService != null) { if (ResolveService != null) {
ResolveService.toggleResolveForDiscussion(mergeRequestId, discussionId); ResolveService.toggleResolveForDiscussion(mergeRequestId, discussionId);
...@@ -751,7 +751,7 @@ export default class Notes { ...@@ -751,7 +751,7 @@ export default class Notes {
form.removeClass('current-note-edit-form'); form.removeClass('current-note-edit-form');
form.find('.js-finish-edit-warning').hide(); form.find('.js-finish-edit-warning').hide();
// Replace markdown textarea text with original note text. // Replace markdown textarea text with original note text.
return form.find('.js-note-text').val(form.find('form.edit-note').data('original-note')); return form.find('.js-note-text').val(form.find('form.edit-note').data('originalNote'));
} }
/** /**
...@@ -776,7 +776,7 @@ export default class Notes { ...@@ -776,7 +776,7 @@ export default class Notes {
var $note, $notes; var $note, $notes;
$note = $(el); $note = $(el);
$notes = $note.closest('.discussion-notes'); $notes = $note.closest('.discussion-notes');
const discussionId = $('.notes', $notes).data('discussion-id'); const discussionId = $('.notes', $notes).data('discussionId');
if (typeof gl.diffNotesCompileComponents !== 'undefined') { if (typeof gl.diffNotesCompileComponents !== 'undefined') {
if (gl.diffNoteApps[noteElId]) { if (gl.diffNoteApps[noteElId]) {
...@@ -897,7 +897,7 @@ export default class Notes { ...@@ -897,7 +897,7 @@ export default class Notes {
// DiffNote // DiffNote
form.find('#note_position').val(dataHolder.attr('data-position')); form.find('#note_position').val(dataHolder.attr('data-position'));
form.find('.js-note-discard').show().removeClass('js-note-discard').addClass('js-close-discussion-note-form').text(form.find('.js-close-discussion-note-form').data('cancel-text')); form.find('.js-note-discard').show().removeClass('js-note-discard').addClass('js-close-discussion-note-form').text(form.find('.js-close-discussion-note-form').data('cancelText'));
form.find('.js-note-target-close').remove(); form.find('.js-note-target-close').remove();
form.find('.js-note-new-discussion').remove(); form.find('.js-note-new-discussion').remove();
this.setupNoteForm(form); this.setupNoteForm(form);
...@@ -1037,7 +1037,7 @@ export default class Notes { ...@@ -1037,7 +1037,7 @@ export default class Notes {
removeDiscussionNoteForm(form) { removeDiscussionNoteForm(form) {
var glForm, row; var glForm, row;
row = form.closest('tr'); row = form.closest('tr');
glForm = form.data('gl-form'); glForm = form.data('glForm');
glForm.destroy(); glForm.destroy();
form.find('.js-note-text').data('autosave').reset(); form.find('.js-note-text').data('autosave').reset();
// show the reply button (will only work for replies) // show the reply button (will only work for replies)
...@@ -1122,8 +1122,8 @@ export default class Notes { ...@@ -1122,8 +1122,8 @@ export default class Notes {
return discardbtn.show(); return discardbtn.show();
} }
} else { } else {
reopentext = reopenbtn.data('original-text'); reopentext = reopenbtn.data('originalText');
closetext = closebtn.data('original-text'); closetext = closebtn.data('originalText');
if (reopenbtn.text() !== reopentext) { if (reopenbtn.text() !== reopentext) {
reopenbtn.text(reopentext); reopenbtn.text(reopentext);
} }
...@@ -1150,9 +1150,9 @@ export default class Notes { ...@@ -1150,9 +1150,9 @@ export default class Notes {
var $originalContentEl = $note.find('.original-note-content'); var $originalContentEl = $note.find('.original-note-content');
var originalContent = $originalContentEl.text().trim(); var originalContent = $originalContentEl.text().trim();
var postUrl = $originalContentEl.data('post-url'); var postUrl = $originalContentEl.data('postUrl');
var targetId = $originalContentEl.data('target-id'); var targetId = $originalContentEl.data('targetId');
var targetType = $originalContentEl.data('target-type'); var targetType = $originalContentEl.data('targetType');
this.glForm = new GLForm($editForm.find('form'), this.enableGFM); this.glForm = new GLForm($editForm.find('form'), this.enableGFM);
...@@ -1513,9 +1513,9 @@ export default class Notes { ...@@ -1513,9 +1513,9 @@ export default class Notes {
// If comment intends to resolve discussion, do the same. // If comment intends to resolve discussion, do the same.
if (isDiscussionResolve) { if (isDiscussionResolve) {
$form $form
.attr('data-discussion-id', $submitBtn.data('discussion-id')) .attr('data-discussion-id', $submitBtn.data('discussionId'))
.attr('data-resolve-all', 'true') .attr('data-resolve-all', 'true')
.attr('data-project-path', $submitBtn.data('project-path')); .attr('data-project-path', $submitBtn.data('projectPath'));
} }
// Show final note element on UI // Show final note element on UI
...@@ -1587,7 +1587,7 @@ export default class Notes { ...@@ -1587,7 +1587,7 @@ export default class Notes {
this.addNoteError($form); this.addNoteError($form);
}); });
return $closeBtn.text($closeBtn.data('original-text')); return $closeBtn.text($closeBtn.data('originalText'));
} }
/** /**
...@@ -1642,7 +1642,7 @@ export default class Notes { ...@@ -1642,7 +1642,7 @@ export default class Notes {
this.updateNoteError(); this.updateNoteError();
}); });
return $closeBtn.text($closeBtn.data('original-text')); return $closeBtn.text($closeBtn.data('originalText'));
} }
} }
......
...@@ -3,11 +3,11 @@ import Flash from './flash'; ...@@ -3,11 +3,11 @@ import Flash from './flash';
export default function notificationsDropdown() { export default function notificationsDropdown() {
$(document).on('click', '.update-notification', function updateNotificationCallback(e) { $(document).on('click', '.update-notification', function updateNotificationCallback(e) {
e.preventDefault(); e.preventDefault();
if ($(this).is('.is-active') && $(this).data('notification-level') === 'custom') { if ($(this).is('.is-active') && $(this).data('notificationLevel') === 'custom') {
return; return;
} }
const notificationLevel = $(this).data('notification-level'); const notificationLevel = $(this).data('notificationLevel');
const form = $(this).parents('.notification-form:first'); const form = $(this).parents('.notification-form:first');
form.find('.js-notification-loading').toggleClass('fa-bell fa-spin fa-spinner'); form.find('.js-notification-loading').toggleClass('fa-bell fa-spin fa-spinner');
......
...@@ -56,7 +56,7 @@ export default { ...@@ -56,7 +56,7 @@ export default {
}, },
initLoadMore() { initLoadMore() {
$(document).unbind('scroll'); $(document).off('scroll');
$(document).endlessScroll({ $(document).endlessScroll({
bottomPixels: ENDLESS_SCROLL_BOTTOM_PX, bottomPixels: ENDLESS_SCROLL_BOTTOM_PX,
fireDelay: ENDLESS_SCROLL_FIRE_DELAY_MS, fireDelay: ENDLESS_SCROLL_FIRE_DELAY_MS,
......
...@@ -15,21 +15,21 @@ export default class AbuseReports { ...@@ -15,21 +15,21 @@ export default class AbuseReports {
const $messageCellElement = $(this); const $messageCellElement = $(this);
const reportMessage = $messageCellElement.text(); const reportMessage = $messageCellElement.text();
if (reportMessage.length > MAX_MESSAGE_LENGTH) { if (reportMessage.length > MAX_MESSAGE_LENGTH) {
$messageCellElement.data('original-message', reportMessage); $messageCellElement.data('originalMessage', reportMessage);
$messageCellElement.data('message-truncated', 'true'); $messageCellElement.data('messageTruncated', 'true');
$messageCellElement.text(truncate(reportMessage, MAX_MESSAGE_LENGTH)); $messageCellElement.text(truncate(reportMessage, MAX_MESSAGE_LENGTH));
} }
} }
toggleMessageTruncation() { toggleMessageTruncation() {
const $messageCellElement = $(this); const $messageCellElement = $(this);
const originalMessage = $messageCellElement.data('original-message'); const originalMessage = $messageCellElement.data('originalMessage');
if (!originalMessage) return; if (!originalMessage) return;
if ($messageCellElement.data('message-truncated') === 'true') { if ($messageCellElement.data('messageTruncated') === 'true') {
$messageCellElement.data('message-truncated', 'false'); $messageCellElement.data('messageTruncated', 'false');
$messageCellElement.text(originalMessage); $messageCellElement.text(originalMessage);
} else { } else {
$messageCellElement.data('message-truncated', 'true'); $messageCellElement.data('messageTruncated', 'true');
$messageCellElement.text(`${originalMessage.substr(0, (MAX_MESSAGE_LENGTH - 3))}...`); $messageCellElement.text(`${originalMessage.substr(0, (MAX_MESSAGE_LENGTH - 3))}...`);
} }
} }
......
...@@ -16,9 +16,9 @@ export default function adminInit() { ...@@ -16,9 +16,9 @@ export default function adminInit() {
$('input#user_force_random_password').on('change', function randomPasswordClick() { $('input#user_force_random_password').on('change', function randomPasswordClick() {
const $elems = $('#user_password, #user_password_confirmation'); const $elems = $('#user_password, #user_password_confirmation');
if ($(this).attr('checked')) { if ($(this).attr('checked')) {
$elems.val('').attr('disabled', true); $elems.val('').prop('disabled', true);
} else { } else {
$elems.removeAttr('disabled'); $elems.prop('disabled', false);
} }
}); });
......
...@@ -14,7 +14,7 @@ export default function initBroadcastMessagesForm() { ...@@ -14,7 +14,7 @@ export default function initBroadcastMessagesForm() {
$('div.broadcast-message-preview').css('color', previewColor); $('div.broadcast-message-preview').css('color', previewColor);
}); });
const previewPath = $('textarea#broadcast_message_message').data('preview-path'); const previewPath = $('textarea#broadcast_message_message').data('previewPath');
$('textarea#broadcast_message_message').on('input', _.debounce(function onMessageInput() { $('textarea#broadcast_message_message').on('input', _.debounce(function onMessageInput() {
const message = $(this).val(); const message = $(this).val();
......
...@@ -71,7 +71,7 @@ export default class Project { ...@@ -71,7 +71,7 @@ export default class Project {
selected = $dropdown.data('selected'); selected = $dropdown.data('selected');
return $dropdown.glDropdown({ return $dropdown.glDropdown({
data(term, callback) { data(term, callback) {
axios.get($dropdown.data('refs-url'), { axios.get($dropdown.data('refsUrl'), {
params: { params: {
ref: $dropdown.data('ref'), ref: $dropdown.data('ref'),
search: term, search: term,
...@@ -84,8 +84,8 @@ export default class Project { ...@@ -84,8 +84,8 @@ export default class Project {
filterable: true, filterable: true,
filterRemote: true, filterRemote: true,
filterByText: true, filterByText: true,
inputFieldName: $dropdown.data('input-field-name'), inputFieldName: $dropdown.data('inputFieldName'),
fieldName: $dropdown.data('field-name'), fieldName: $dropdown.data('fieldName'),
renderRow: function(ref) { renderRow: function(ref) {
var li = refListItem.cloneNode(false); var li = refListItem.cloneNode(false);
......
...@@ -9,7 +9,7 @@ export default class Search { ...@@ -9,7 +9,7 @@ export default class Search {
this.searchInput = '.js-search-input'; this.searchInput = '.js-search-input';
this.searchClear = '.js-search-clear'; this.searchClear = '.js-search-clear';
this.groupId = $groupDropdown.data('group-id'); this.groupId = $groupDropdown.data('groupId');
this.eventListeners(); this.eventListeners();
$groupDropdown.glDropdown({ $groupDropdown.glDropdown({
...@@ -36,7 +36,7 @@ export default class Search { ...@@ -36,7 +36,7 @@ export default class Search {
return obj.full_name; return obj.full_name;
}, },
toggleLabel(obj) { toggleLabel(obj) {
return `${($groupDropdown.data('default-label'))} ${obj.full_name}`; return `${($groupDropdown.data('defaultLabel'))} ${obj.full_name}`;
}, },
clicked: () => Search.submitSearch(), clicked: () => Search.submitSearch(),
}); });
...@@ -69,7 +69,7 @@ export default class Search { ...@@ -69,7 +69,7 @@ export default class Search {
return obj.name_with_namespace; return obj.name_with_namespace;
}, },
toggleLabel(obj) { toggleLabel(obj) {
return `${($projectDropdown.data('default-label'))} ${obj.name_with_namespace}`; return `${($projectDropdown.data('defaultLabel'))} ${obj.name_with_namespace}`;
}, },
clicked: () => Search.submitSearch(), clicked: () => Search.submitSearch(),
}); });
......
...@@ -5,13 +5,13 @@ import ProjectSelectComboButton from './project_select_combo_button'; ...@@ -5,13 +5,13 @@ import ProjectSelectComboButton from './project_select_combo_button';
export default function projectSelect() { export default function projectSelect() {
$('.ajax-project-select').each(function(i, select) { $('.ajax-project-select').each(function(i, select) {
var placeholder; var placeholder;
const simpleFilter = $(select).data('simple-filter') || false; const simpleFilter = $(select).data('simpleFilter') || false;
this.groupId = $(select).data('group-id'); this.groupId = $(select).data('groupId');
this.includeGroups = $(select).data('include-groups'); this.includeGroups = $(select).data('includeGroups');
this.allProjects = $(select).data('all-projects') || false; this.allProjects = $(select).data('allProjects') || false;
this.orderBy = $(select).data('order-by') || 'id'; this.orderBy = $(select).data('orderBy') || 'id';
this.withIssuesEnabled = $(select).data('with-issues-enabled'); this.withIssuesEnabled = $(select).data('withIssuesEnabled');
this.withMergeRequestsEnabled = $(select).data('with-merge-requests-enabled'); this.withMergeRequestsEnabled = $(select).data('withMergeRequestsEnabled');
placeholder = "Search for project"; placeholder = "Search for project";
if (this.includeGroups) { if (this.includeGroups) {
......
...@@ -19,7 +19,7 @@ export default class PrometheusMetrics { ...@@ -19,7 +19,7 @@ export default class PrometheusMetrics {
this.$missingEnvVarMetricCount = this.$missingEnvVarPanel.find('.js-env-var-count'); this.$missingEnvVarMetricCount = this.$missingEnvVarPanel.find('.js-env-var-count');
this.$missingEnvVarMetricsList = this.$missingEnvVarPanel.find('.js-missing-var-metrics-list'); this.$missingEnvVarMetricsList = this.$missingEnvVarPanel.find('.js-missing-var-metrics-list');
this.activeMetricsEndpoint = this.$monitoredMetricsPanel.data('active-metrics'); this.activeMetricsEndpoint = this.$monitoredMetricsPanel.data('activeMetrics');
this.$panelToggle.on('click', e => this.handlePanelToggle(e)); this.$panelToggle.on('click', e => this.handlePanelToggle(e));
} }
......
...@@ -9,8 +9,8 @@ export default class ProtectedBranchAccessDropdown { ...@@ -9,8 +9,8 @@ export default class ProtectedBranchAccessDropdown {
$dropdown.glDropdown({ $dropdown.glDropdown({
data, data,
selectable: true, selectable: true,
inputId: $dropdown.data('input-id'), inputId: $dropdown.data('inputId'),
fieldName: $dropdown.data('field-name'), fieldName: $dropdown.data('fieldName'),
toggleLabel(item, $el) { toggleLabel(item, $el) {
if ($el.is('.is-active')) { if ($el.is('.is-active')) {
return item.text; return item.text;
......
...@@ -59,7 +59,7 @@ export default class ProtectedBranchCreate { ...@@ -59,7 +59,7 @@ export default class ProtectedBranchCreate {
); );
this.savePreviousSelection($allowedToMergeInput.val(), $allowedToPushInput.val()); this.savePreviousSelection($allowedToMergeInput.val(), $allowedToPushInput.val());
this.$form.find('input[type="submit"]').attr('disabled', completedForm); this.$form.find('input[type="submit"]').prop('disabled', completedForm);
} }
static getProtectedBranches(term, callback) { static getProtectedBranches(term, callback) {
......
...@@ -41,11 +41,11 @@ export default class ProtectedBranchEdit { ...@@ -41,11 +41,11 @@ export default class ProtectedBranchEdit {
axios.patch(this.$wrap.data('url'), { axios.patch(this.$wrap.data('url'), {
protected_branch: { protected_branch: {
merge_access_levels_attributes: [{ merge_access_levels_attributes: [{
id: this.$allowedToMergeDropdown.data('access-level-id'), id: this.$allowedToMergeDropdown.data('accessLevelId'),
access_level: $allowedToMergeInput.val(), access_level: $allowedToMergeInput.val(),
}], }],
push_access_levels_attributes: [{ push_access_levels_attributes: [{
id: this.$allowedToPushDropdown.data('access-level-id'), id: this.$allowedToPushDropdown.data('accessLevelId'),
access_level: $allowedToPushInput.val(), access_level: $allowedToPushInput.val(),
}], }],
}, },
......
...@@ -9,8 +9,8 @@ export default class ProtectedTagAccessDropdown { ...@@ -9,8 +9,8 @@ export default class ProtectedTagAccessDropdown {
this.options.$dropdown.glDropdown({ this.options.$dropdown.glDropdown({
data: this.options.data, data: this.options.data,
selectable: true, selectable: true,
inputId: this.options.$dropdown.data('input-id'), inputId: this.options.$dropdown.data('inputId'),
fieldName: this.options.$dropdown.data('field-name'), fieldName: this.options.$dropdown.data('fieldName'),
toggleLabel(item, $el) { toggleLabel(item, $el) {
if ($el.is('.is-active')) { if ($el.is('.is-active')) {
return item.text; return item.text;
......
...@@ -39,7 +39,7 @@ export default class ProtectedTagCreate { ...@@ -39,7 +39,7 @@ export default class ProtectedTagCreate {
const $tagInput = this.$form.find('input[name="protected_tag[name]"]'); const $tagInput = this.$form.find('input[name="protected_tag[name]"]');
const $allowedToCreateInput = this.$form.find('#create_access_levels_attributes'); const $allowedToCreateInput = this.$form.find('#create_access_levels_attributes');
this.$form.find('input[type="submit"]').attr('disabled', !($tagInput.val() && $allowedToCreateInput.length)); this.$form.find('input[type="submit"]').prop('disabled', !($tagInput.val() && $allowedToCreateInput.length));
} }
static getProtectedTags(term, callback) { static getProtectedTags(term, callback) {
......
...@@ -31,7 +31,7 @@ export default class ProtectedTagEdit { ...@@ -31,7 +31,7 @@ export default class ProtectedTagEdit {
axios.patch(this.$wrap.data('url'), { axios.patch(this.$wrap.data('url'), {
protected_tag: { protected_tag: {
create_access_levels_attributes: [{ create_access_levels_attributes: [{
id: this.$allowedToCreateDropdownButton.data('access-level-id'), id: this.$allowedToCreateDropdownButton.data('accessLevelId'),
access_level: $allowedToCreateInput.val(), access_level: $allowedToCreateInput.val(),
}], }],
}, },
......
...@@ -6,7 +6,7 @@ class RefSelectDropdown { ...@@ -6,7 +6,7 @@ class RefSelectDropdown {
filterable: true, filterable: true,
filterByText: true, filterByText: true,
remote: false, remote: false,
fieldName: $dropdownButton.data('field-name'), fieldName: $dropdownButton.data('fieldName'),
filterInput: 'input[type="search"]', filterInput: 'input[type="search"]',
selectable: true, selectable: true,
isSelectable(branch, $el) { isSelectable(branch, $el) {
...@@ -24,7 +24,7 @@ class RefSelectDropdown { ...@@ -24,7 +24,7 @@ class RefSelectDropdown {
}); });
const $dropdownContainer = $dropdownButton.closest('.dropdown'); const $dropdownContainer = $dropdownButton.closest('.dropdown');
const $fieldInput = $(`input[name="${$dropdownButton.data('field-name')}"]`, $dropdownContainer); const $fieldInput = $(`input[name="${$dropdownButton.data('fieldName')}"]`, $dropdownContainer);
const $filterInput = $('input[type="search"]', $dropdownContainer); const $filterInput = $('input[type="search"]', $dropdownContainer);
$filterInput.on('keyup', (e) => { $filterInput.on('keyup', (e) => {
......
...@@ -76,8 +76,8 @@ Sidebar.prototype.toggleTodo = function(e) { ...@@ -76,8 +76,8 @@ Sidebar.prototype.toggleTodo = function(e) {
$('.js-issuable-todo').disable().addClass('is-loading'); $('.js-issuable-todo').disable().addClass('is-loading');
axios[ajaxType](url, { axios[ajaxType](url, {
issuable_id: $this.data('issuable-id'), issuable_id: $this.data('issuableId'),
issuable_type: $this.data('issuable-type'), issuable_type: $this.data('issuableType'),
}).then(({ data }) => { }).then(({ data }) => {
this.todoUpdateDone(data); this.todoUpdateDone(data);
}).catch(() => flash(`There was an error ${ajaxType === 'post' ? 'adding a' : 'deleting the'} todo.`)); }).catch(() => flash(`There was an error ${ajaxType === 'post' ? 'adding a' : 'deleting the'} todo.`));
...@@ -96,18 +96,18 @@ Sidebar.prototype.todoUpdateDone = function(data) { ...@@ -96,18 +96,18 @@ Sidebar.prototype.todoUpdateDone = function(data) {
$el.removeClass('is-loading') $el.removeClass('is-loading')
.enable() .enable()
.attr('aria-label', $el.data(`${attrPrefix}-text`)) .attr('aria-label', $el.data(`${attrPrefix}Text`))
.attr('data-delete-path', deletePath) .attr('data-delete-path', deletePath)
.attr('title', $el.data(`${attrPrefix}-text`)); .attr('title', $el.data(`${attrPrefix}Text`));
if ($el.hasClass('has-tooltip')) { if ($el.hasClass('has-tooltip')) {
$el.tooltip('fixTitle'); $el.tooltip('fixTitle');
} }
if ($el.data(`${attrPrefix}-icon`)) { if ($el.data(`${attrPrefix}Icon`)) {
$elText.html($el.data(`${attrPrefix}-icon`)); $elText.html($el.data(`${attrPrefix}Icon`));
} else { } else {
$elText.text($el.data(`${attrPrefix}-text`)); $elText.text($el.data(`${attrPrefix}Text`));
} }
}); });
}; };
......
...@@ -25,32 +25,32 @@ function setSearchOptions() { ...@@ -25,32 +25,32 @@ function setSearchOptions() {
if ($projectOptionsDataEl.length) { if ($projectOptionsDataEl.length) {
gl.projectOptions = gl.projectOptions || {}; gl.projectOptions = gl.projectOptions || {};
var projectPath = $projectOptionsDataEl.data('project-path'); var projectPath = $projectOptionsDataEl.data('projectPath');
gl.projectOptions[projectPath] = { gl.projectOptions[projectPath] = {
name: $projectOptionsDataEl.data('name'), name: $projectOptionsDataEl.data('name'),
issuesPath: $projectOptionsDataEl.data('issues-path'), issuesPath: $projectOptionsDataEl.data('issuesPath'),
issuesDisabled: $projectOptionsDataEl.data('issues-disabled'), issuesDisabled: $projectOptionsDataEl.data('issuesDisabled'),
mrPath: $projectOptionsDataEl.data('mr-path'), mrPath: $projectOptionsDataEl.data('mrPath'),
}; };
} }
if ($groupOptionsDataEl.length) { if ($groupOptionsDataEl.length) {
gl.groupOptions = gl.groupOptions || {}; gl.groupOptions = gl.groupOptions || {};
var groupPath = $groupOptionsDataEl.data('group-path'); var groupPath = $groupOptionsDataEl.data('groupPath');
gl.groupOptions[groupPath] = { gl.groupOptions[groupPath] = {
name: $groupOptionsDataEl.data('name'), name: $groupOptionsDataEl.data('name'),
issuesPath: $groupOptionsDataEl.data('issues-path'), issuesPath: $groupOptionsDataEl.data('issuesPath'),
mrPath: $groupOptionsDataEl.data('mr-path'), mrPath: $groupOptionsDataEl.data('mrPath'),
}; };
} }
if ($dashboardOptionsDataEl.length) { if ($dashboardOptionsDataEl.length) {
gl.dashboardOptions = { gl.dashboardOptions = {
issuesPath: $dashboardOptionsDataEl.data('issues-path'), issuesPath: $dashboardOptionsDataEl.data('issuesPath'),
mrPath: $dashboardOptionsDataEl.data('mr-path'), mrPath: $dashboardOptionsDataEl.data('mrPath'),
}; };
} }
} }
...@@ -61,9 +61,9 @@ export default class SearchAutocomplete { ...@@ -61,9 +61,9 @@ export default class SearchAutocomplete {
this.bindEventContext(); this.bindEventContext();
this.wrap = wrap || $('.search'); this.wrap = wrap || $('.search');
this.optsEl = optsEl || this.wrap.find('.search-autocomplete-opts'); this.optsEl = optsEl || this.wrap.find('.search-autocomplete-opts');
this.autocompletePath = autocompletePath || this.optsEl.data('autocomplete-path'); this.autocompletePath = autocompletePath || this.optsEl.data('autocompletePath');
this.projectId = projectId || (this.optsEl.data('autocomplete-project-id') || ''); this.projectId = projectId || (this.optsEl.data('autocompleteProjectId') || '');
this.projectRef = projectRef || (this.optsEl.data('autocomplete-project-ref') || ''); this.projectRef = projectRef || (this.optsEl.data('autocompleteProjectRef') || '');
this.dropdown = this.wrap.find('.dropdown'); this.dropdown = this.wrap.find('.dropdown');
this.dropdownToggle = this.wrap.find('.js-dropdown-search-toggle'); this.dropdownToggle = this.wrap.find('.js-dropdown-search-toggle');
this.dropdownContent = this.dropdown.find('.dropdown-content'); this.dropdownContent = this.dropdown.find('.dropdown-content');
......
...@@ -50,7 +50,7 @@ class SidebarMoveIssue { ...@@ -50,7 +50,7 @@ class SidebarMoveIssue {
const selectedProjectId = options.isMarking ? project.id : 0; const selectedProjectId = options.isMarking ? project.id : 0;
this.mediator.setMoveToProjectId(selectedProjectId); this.mediator.setMoveToProjectId(selectedProjectId);
this.$confirmButton.attr('disabled', !isValidProjectId(selectedProjectId)); this.$confirmButton.prop('disabled', !isValidProjectId(selectedProjectId));
}, },
}); });
} }
......
...@@ -18,7 +18,7 @@ export default class SingleFileDiff { ...@@ -18,7 +18,7 @@ export default class SingleFileDiff {
this.toggleDiff = this.toggleDiff.bind(this); this.toggleDiff = this.toggleDiff.bind(this);
this.content = $('.diff-content', this.file); this.content = $('.diff-content', this.file);
this.$toggleIcon = $('.diff-toggle-caret', this.file); this.$toggleIcon = $('.diff-toggle-caret', this.file);
this.diffForPath = this.content.find('[data-diff-for-path]').data('diff-for-path'); this.diffForPath = this.content.find('[data-diff-for-path]').data('diffForPath');
this.isOpen = !this.diffForPath; this.isOpen = !this.diffForPath;
if (this.diffForPath) { if (this.diffForPath) {
this.collapsedContent = this.content; this.collapsedContent = this.content;
......
import Flash from './flash'; import Flash from './flash';
import { __, s__ } from './locale'; import { __, s__ } from './locale';
import { spriteIcon } from './lib/utils/common_utils'; import { spriteIcon } from './lib/utils/common_utils';
import axios from './lib/utils/axios_utils';
export default class Star { export default class Star {
constructor() { constructor() {
$('.project-home-panel .toggle-star') $('.project-home-panel .toggle-star').on('click', function toggleStarClickCallback() {
.on('ajax:success', function handleSuccess(e, data) { const $this = $(this);
const $this = $(this); const $starSpan = $this.find('span');
const $starSpan = $this.find('span'); const $startIcon = $this.find('svg');
const $startIcon = $this.find('svg');
function toggleStar(isStarred) { axios.post($this.data('endpoint'))
.then(({ data }) => {
const isStarred = $starSpan.hasClass('starred');
$this.parent().find('.star-count').text(data.star_count); $this.parent().find('.star-count').text(data.star_count);
if (isStarred) { if (isStarred) {
$starSpan.removeClass('starred').text(s__('StarProject|Star')); $starSpan.removeClass('starred').text(s__('StarProject|Star'));
$startIcon.remove(); $startIcon.remove();
...@@ -21,12 +24,8 @@ export default class Star { ...@@ -21,12 +24,8 @@ export default class Star {
$startIcon.remove(); $startIcon.remove();
$this.prepend(spriteIcon('star')); $this.prepend(spriteIcon('star'));
} }
} })
.catch(() => Flash('Star toggle failed. Try again later.'));
toggleStar($starSpan.hasClass('starred')); });
})
.on('ajax:error', () => {
Flash('Star toggle failed. Try again later.', 'alert');
});
} }
} }
export default function subscriptionSelect() { export default function subscriptionSelect() {
$('.js-subscription-event').each((i, element) => { $('.js-subscription-event').each((i, element) => {
const fieldName = $(element).data('field-name'); const fieldName = $(element).data('fieldName');
return $(element).glDropdown({ return $(element).glDropdown({
selectable: true, selectable: true,
......
...@@ -40,7 +40,7 @@ export default class TaskList { ...@@ -40,7 +40,7 @@ export default class TaskList {
[this.fieldName]: $target.val(), [this.fieldName]: $target.val(),
}; };
return axios.patch($target.data('update-url') || $('form.js-issuable-update').attr('action'), patchData) return axios.patch($target.data('updateUrl') || $('form.js-issuable-update').attr('action'), patchData)
.then(({ data }) => this.onSuccess(data)) .then(({ data }) => this.onSuccess(data))
.catch(err => this.onError(err)); .catch(err => this.onError(err));
} }
......
...@@ -6,9 +6,9 @@ import TemplateSelector from '../blob/template_selector'; ...@@ -6,9 +6,9 @@ import TemplateSelector from '../blob/template_selector';
export default class IssuableTemplateSelector extends TemplateSelector { export default class IssuableTemplateSelector extends TemplateSelector {
constructor(...args) { constructor(...args) {
super(...args); super(...args);
this.projectPath = this.dropdown.data('project-path'); this.projectPath = this.dropdown.data('projectPath');
this.namespacePath = this.dropdown.data('namespace-path'); this.namespacePath = this.dropdown.data('namespacePath');
this.issuableType = this.$dropdownContainer.data('issuable-type'); this.issuableType = this.$dropdownContainer.data('issuableType');
this.titleInput = $(`#${this.issuableType}_title`); this.titleInput = $(`#${this.issuableType}_title`);
const initialQuery = { const initialQuery = {
......
...@@ -22,7 +22,7 @@ export default class UserCallout { ...@@ -22,7 +22,7 @@ export default class UserCallout {
const $currentTarget = $(e.currentTarget); const $currentTarget = $(e.currentTarget);
if (this.options.setCalloutPerProject) { if (this.options.setCalloutPerProject) {
Cookies.set(this.cookieName, 'true', { expires: 365, path: this.userCalloutBody.data('project-path') }); Cookies.set(this.cookieName, 'true', { expires: 365, path: this.userCalloutBody.data('projectPath') });
} else { } else {
Cookies.set(this.cookieName, 'true', { expires: 365 }); Cookies.set(this.cookieName, 'true', { expires: 365 });
} }
......
This diff is collapsed.
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
return new GLForm($(this.$refs['gl-form']), this.enableAutocomplete); return new GLForm($(this.$refs['gl-form']), this.enableAutocomplete);
}, },
beforeDestroy() { beforeDestroy() {
const glForm = $(this.$refs['gl-form']).data('gl-form'); const glForm = $(this.$refs['gl-form']).data('glForm');
if (glForm) { if (glForm) {
glForm.destroy(); glForm.destroy();
} }
......
- if current_user - if current_user
= link_to toggle_star_project_path(@project), { class: 'btn star-btn toggle-star', method: :post, remote: true } do %button.btn.btn-default.star-btn.toggle-star{ type: "button", data: { endpoint: toggle_star_project_path(@project, :json) } }
- if current_user.starred?(@project) - if current_user.starred?(@project)
= sprite_icon('star') = sprite_icon('star')
%span.starred= _('Unstar') %span.starred= _('Unstar')
......
...@@ -149,6 +149,11 @@ feature 'Project > Members > Share with Group', :js do ...@@ -149,6 +149,11 @@ feature 'Project > Members > Share with Group', :js do
create(:group).add_owner(master) create(:group).add_owner(master)
visit project_settings_members_path(project) visit project_settings_members_path(project)
click_link 'Share with group'
find('.ajax-groups-select.select2-container')
execute_script 'GROUP_SELECT_PER_PAGE = 1;' execute_script 'GROUP_SELECT_PER_PAGE = 1;'
open_select2 '#link_group_id' open_select2 '#link_group_id'
end end
......
import 'jquery';
import 'jquery-ujs';
import AjaxLoadingSpinner from '~/ajax_loading_spinner'; import AjaxLoadingSpinner from '~/ajax_loading_spinner';
describe('Ajax Loading Spinner', () => { describe('Ajax Loading Spinner', () => {
......
...@@ -138,7 +138,7 @@ import '~/lib/utils/common_utils'; ...@@ -138,7 +138,7 @@ import '~/lib/utils/common_utils';
$thumbsUpEmoji = $votesBlock.find('[data-name=thumbsup]').parent(); $thumbsUpEmoji = $votesBlock.find('[data-name=thumbsup]').parent();
$thumbsUpEmoji.attr('data-title', 'sam'); $thumbsUpEmoji.attr('data-title', 'sam');
awardsHandler.userAuthored($thumbsUpEmoji); awardsHandler.userAuthored($thumbsUpEmoji);
return expect($thumbsUpEmoji.data("original-title")).toBe("You cannot vote on your own issue, MR and note"); return expect($thumbsUpEmoji.data("originalTitle")).toBe("You cannot vote on your own issue, MR and note");
}); });
it('should restore tooltip back to initial vote list', function() { it('should restore tooltip back to initial vote list', function() {
var $thumbsUpEmoji, $votesBlock; var $thumbsUpEmoji, $votesBlock;
...@@ -149,7 +149,7 @@ import '~/lib/utils/common_utils'; ...@@ -149,7 +149,7 @@ import '~/lib/utils/common_utils';
awardsHandler.userAuthored($thumbsUpEmoji); awardsHandler.userAuthored($thumbsUpEmoji);
jasmine.clock().tick(2801); jasmine.clock().tick(2801);
jasmine.clock().uninstall(); jasmine.clock().uninstall();
return expect($thumbsUpEmoji.data("original-title")).toBe("sam"); return expect($thumbsUpEmoji.data("originalTitle")).toBe("sam");
}); });
}); });
describe('::getAwardUrl', function() { describe('::getAwardUrl', function() {
...@@ -194,7 +194,7 @@ import '~/lib/utils/common_utils'; ...@@ -194,7 +194,7 @@ import '~/lib/utils/common_utils';
$thumbsUpEmoji.attr('data-title', 'sam, jerry, max, and andy'); $thumbsUpEmoji.attr('data-title', 'sam, jerry, max, and andy');
awardsHandler.addAward($votesBlock, awardUrl, 'thumbsup', false); awardsHandler.addAward($votesBlock, awardUrl, 'thumbsup', false);
$thumbsUpEmoji.tooltip(); $thumbsUpEmoji.tooltip();
return expect($thumbsUpEmoji.data("original-title")).toBe('You, sam, jerry, max, and andy'); return expect($thumbsUpEmoji.data("originalTitle")).toBe('You, sam, jerry, max, and andy');
}); });
return it('handles the special case where "You" is not cleanly comma seperated', function() { return it('handles the special case where "You" is not cleanly comma seperated', function() {
var $thumbsUpEmoji, $votesBlock, awardUrl; var $thumbsUpEmoji, $votesBlock, awardUrl;
...@@ -204,7 +204,7 @@ import '~/lib/utils/common_utils'; ...@@ -204,7 +204,7 @@ import '~/lib/utils/common_utils';
$thumbsUpEmoji.attr('data-title', 'sam'); $thumbsUpEmoji.attr('data-title', 'sam');
awardsHandler.addAward($votesBlock, awardUrl, 'thumbsup', false); awardsHandler.addAward($votesBlock, awardUrl, 'thumbsup', false);
$thumbsUpEmoji.tooltip(); $thumbsUpEmoji.tooltip();
return expect($thumbsUpEmoji.data("original-title")).toBe('You and sam'); return expect($thumbsUpEmoji.data("originalTitle")).toBe('You and sam');
}); });
}); });
describe('::removeYouToUserList', function() { describe('::removeYouToUserList', function() {
...@@ -217,7 +217,7 @@ import '~/lib/utils/common_utils'; ...@@ -217,7 +217,7 @@ import '~/lib/utils/common_utils';
$thumbsUpEmoji.addClass('active'); $thumbsUpEmoji.addClass('active');
awardsHandler.addAward($votesBlock, awardUrl, 'thumbsup', false); awardsHandler.addAward($votesBlock, awardUrl, 'thumbsup', false);
$thumbsUpEmoji.tooltip(); $thumbsUpEmoji.tooltip();
return expect($thumbsUpEmoji.data("original-title")).toBe('sam, jerry, max, and andy'); return expect($thumbsUpEmoji.data("originalTitle")).toBe('sam, jerry, max, and andy');
}); });
return it('handles the special case where "You" is not cleanly comma seperated', function() { return it('handles the special case where "You" is not cleanly comma seperated', function() {
var $thumbsUpEmoji, $votesBlock, awardUrl; var $thumbsUpEmoji, $votesBlock, awardUrl;
...@@ -228,7 +228,7 @@ import '~/lib/utils/common_utils'; ...@@ -228,7 +228,7 @@ import '~/lib/utils/common_utils';
$thumbsUpEmoji.addClass('active'); $thumbsUpEmoji.addClass('active');
awardsHandler.addAward($votesBlock, awardUrl, 'thumbsup', false); awardsHandler.addAward($votesBlock, awardUrl, 'thumbsup', false);
$thumbsUpEmoji.tooltip(); $thumbsUpEmoji.tooltip();
return expect($thumbsUpEmoji.data("original-title")).toBe('sam'); return expect($thumbsUpEmoji.data("originalTitle")).toBe('sam');
}); });
}); });
describe('::searchEmojis', () => { describe('::searchEmojis', () => {
......
...@@ -15,7 +15,7 @@ describe('requiresInput', () => { ...@@ -15,7 +15,7 @@ describe('requiresInput', () => {
}); });
it('enables submit when no field is required', () => { it('enables submit when no field is required', () => {
$('*[required=required]').removeAttr('required'); $('*[required=required]').prop('required', false);
$('.js-requires-input').requiresInput(); $('.js-requires-input').requiresInput();
expect(submitButton).not.toBeDisabled(); expect(submitButton).not.toBeDisabled();
}); });
......
import * as featureHighlightHelper from '~/feature_highlight/feature_highlight_helper'; import * as featureHighlightHelper from '~/feature_highlight/feature_highlight_helper';
import * as featureHighlight from '~/feature_highlight/feature_highlight'; import * as featureHighlight from '~/feature_highlight/feature_highlight';
import axios from '~/lib/utils/axios_utils';
import MockAdapter from 'axios-mock-adapter';
describe('feature highlight', () => { describe('feature highlight', () => {
beforeEach(() => { beforeEach(() => {
setFixtures(` setFixtures(`
<div> <div>
<div class="js-feature-highlight" data-highlight="test" data-highlight-priority="10" disabled> <div class="js-feature-highlight" data-highlight="test" data-highlight-priority="10" data-dismiss-endpoint="/test" disabled>
Trigger Trigger
</div> </div>
</div> </div>
...@@ -19,13 +21,21 @@ describe('feature highlight', () => { ...@@ -19,13 +21,21 @@ describe('feature highlight', () => {
}); });
describe('setupFeatureHighlightPopover', () => { describe('setupFeatureHighlightPopover', () => {
let mock;
const selector = '.js-feature-highlight[data-highlight=test]'; const selector = '.js-feature-highlight[data-highlight=test]';
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios);
mock.onGet('/test').reply(200);
spyOn(window, 'addEventListener'); spyOn(window, 'addEventListener');
spyOn(window, 'removeEventListener'); spyOn(window, 'removeEventListener');
featureHighlight.setupFeatureHighlightPopover('test', 0); featureHighlight.setupFeatureHighlightPopover('test', 0);
}); });
afterEach(() => {
mock.restore();
});
it('setup popover content', () => { it('setup popover content', () => {
const $popoverContent = $('.feature-highlight-popover-content'); const $popoverContent = $('.feature-highlight-popover-content');
const outerHTML = $popoverContent.prop('outerHTML'); const outerHTML = $popoverContent.prop('outerHTML');
...@@ -51,15 +61,6 @@ describe('feature highlight', () => { ...@@ -51,15 +61,6 @@ describe('feature highlight', () => {
}, 0); }, 0);
}); });
it('setup inserted.bs.popover', () => {
$(selector).trigger('mouseenter');
const popoverId = $(selector).attr('aria-describedby');
const spyEvent = spyOnEvent(`#${popoverId} .dismiss-feature-highlight`, 'click');
$(`#${popoverId} .dismiss-feature-highlight`).click();
expect(spyEvent).toHaveBeenTriggered();
});
it('setup show.bs.popover', () => { it('setup show.bs.popover', () => {
$(selector).trigger('show.bs.popover'); $(selector).trigger('show.bs.popover');
expect(window.addEventListener).toHaveBeenCalledWith('scroll', jasmine.any(Function)); expect(window.addEventListener).toHaveBeenCalledWith('scroll', jasmine.any(Function));
...@@ -75,9 +76,19 @@ describe('feature highlight', () => { ...@@ -75,9 +76,19 @@ describe('feature highlight', () => {
}); });
it('displays popover', () => { it('displays popover', () => {
expect($(selector).attr('aria-describedby')).toBeFalsy(); expect(document.querySelector(selector).getAttribute('aria-describedby')).toBeFalsy();
$(selector).trigger('mouseenter'); $(selector).trigger('mouseenter');
expect($(selector).attr('aria-describedby')).toBeTruthy(); expect(document.querySelector(selector).getAttribute('aria-describedby')).toBeTruthy();
});
it('toggles when clicked', () => {
$(selector).trigger('mouseenter');
const popoverId = $(selector).attr('aria-describedby');
const toggleSpy = spyOn(featureHighlightHelper.togglePopover, 'call');
$(`#${popoverId} .dismiss-feature-highlight`).click();
expect(toggleSpy).toHaveBeenCalled();
}); });
}); });
......
...@@ -64,8 +64,8 @@ describe('glDropdown', function describeDropdown() { ...@@ -64,8 +64,8 @@ describe('glDropdown', function describeDropdown() {
}); });
afterEach(() => { afterEach(() => {
$('body').unbind('keydown'); $('body').off('keydown');
this.dropdownContainerElement.unbind('keyup'); this.dropdownContainerElement.off('keyup');
}); });
it('should open on click', () => { it('should open on click', () => {
......
...@@ -23,7 +23,7 @@ describe('Merge request notes', () => { ...@@ -23,7 +23,7 @@ describe('Merge request notes', () => {
gl.utils.disableButtonIfEmptyField = _.noop; gl.utils.disableButtonIfEmptyField = _.noop;
window.project_uploads_path = 'http://test.host/uploads'; window.project_uploads_path = 'http://test.host/uploads';
$('body').attr('data-page', 'projects:merge_requests:show'); $('body').attr('data-page', 'projects:merge_requests:show');
window.gon.current_user_id = $('.note:last').data('author-id'); window.gon.current_user_id = $('.note:last').data('authorId');
return new Notes('', []); return new Notes('', []);
}); });
...@@ -76,7 +76,7 @@ describe('Merge request notes', () => { ...@@ -76,7 +76,7 @@ describe('Merge request notes', () => {
</form>`; </form>`;
setFixtures(diffsResponse.html + noteFormHtml); setFixtures(diffsResponse.html + noteFormHtml);
$('body').attr('data-page', 'projects:merge_requests:show'); $('body').attr('data-page', 'projects:merge_requests:show');
window.gon.current_user_id = $('.note:last').data('author-id'); window.gon.current_user_id = $('.note:last').data('authorId');
return new Notes('', []); return new Notes('', []);
}); });
......
...@@ -22,19 +22,19 @@ describe('Abuse Reports', () => { ...@@ -22,19 +22,19 @@ describe('Abuse Reports', () => {
it('should truncate long messages', () => { it('should truncate long messages', () => {
const $longMessage = findMessage('LONG MESSAGE'); const $longMessage = findMessage('LONG MESSAGE');
expect($longMessage.data('original-message')).toEqual(jasmine.anything()); expect($longMessage.data('originalMessage')).toEqual(jasmine.anything());
assertMaxLength($longMessage); assertMaxLength($longMessage);
}); });
it('should not truncate short messages', () => { it('should not truncate short messages', () => {
const $shortMessage = findMessage('SHORT MESSAGE'); const $shortMessage = findMessage('SHORT MESSAGE');
expect($shortMessage.data('original-message')).not.toEqual(jasmine.anything()); expect($shortMessage.data('originalMessage')).not.toEqual(jasmine.anything());
}); });
it('should allow clicking a truncated message to expand and collapse the full message', () => { it('should allow clicking a truncated message to expand and collapse the full message', () => {
const $longMessage = findMessage('LONG MESSAGE'); const $longMessage = findMessage('LONG MESSAGE');
$longMessage.click(); $longMessage.click();
expect($longMessage.data('original-message').length).toEqual($longMessage.text().length); expect($longMessage.data('originalMessage').length).toEqual($longMessage.text().length);
$longMessage.click(); $longMessage.click();
assertMaxLength($longMessage); assertMaxLength($longMessage);
}); });
......
...@@ -27,7 +27,7 @@ describe('New Project', () => { ...@@ -27,7 +27,7 @@ describe('New Project', () => {
}); });
it('does not change project path for disabled $projectImportUrl', () => { it('does not change project path for disabled $projectImportUrl', () => {
$projectImportUrl.attr('disabled', true); $projectImportUrl.prop('disabled', true);
projectNew.deriveProjectPathFromUrl($projectImportUrl); projectNew.deriveProjectPathFromUrl($projectImportUrl);
...@@ -36,7 +36,7 @@ describe('New Project', () => { ...@@ -36,7 +36,7 @@ describe('New Project', () => {
describe('for enabled $projectImportUrl', () => { describe('for enabled $projectImportUrl', () => {
beforeEach(() => { beforeEach(() => {
$projectImportUrl.attr('disabled', false); $projectImportUrl.prop('disabled', false);
}); });
it('does not change project path if it is set by user', () => { it('does not change project path if it is set by user', () => {
......
...@@ -78,7 +78,7 @@ describe('SidebarMoveIssue', () => { ...@@ -78,7 +78,7 @@ describe('SidebarMoveIssue', () => {
this.sidebarMoveIssue.onConfirmClicked(); this.sidebarMoveIssue.onConfirmClicked();
expect(this.mediator.moveIssue).toHaveBeenCalled(); expect(this.mediator.moveIssue).toHaveBeenCalled();
expect(this.$confirmButton.attr('disabled')).toBe('disabled'); expect(this.$confirmButton.prop('disabled')).toBeTruthy();
expect(this.$confirmButton.hasClass('is-loading')).toBe(true); expect(this.$confirmButton.hasClass('is-loading')).toBe(true);
}); });
...@@ -93,7 +93,7 @@ describe('SidebarMoveIssue', () => { ...@@ -93,7 +93,7 @@ describe('SidebarMoveIssue', () => {
// Wait for the move issue request to fail // Wait for the move issue request to fail
setTimeout(() => { setTimeout(() => {
expect(window.Flash).toHaveBeenCalled(); expect(window.Flash).toHaveBeenCalled();
expect(this.$confirmButton.attr('disabled')).toBe(undefined); expect(this.$confirmButton.prop('disabled')).toBeFalsy();
expect(this.$confirmButton.hasClass('is-loading')).toBe(false); expect(this.$confirmButton.hasClass('is-loading')).toBe(false);
done(); done();
}); });
...@@ -120,7 +120,7 @@ describe('SidebarMoveIssue', () => { ...@@ -120,7 +120,7 @@ describe('SidebarMoveIssue', () => {
this.$content.find('.js-move-issue-dropdown-item').eq(0).trigger('click'); this.$content.find('.js-move-issue-dropdown-item').eq(0).trigger('click');
expect(this.mediator.setMoveToProjectId).toHaveBeenCalledWith(0); expect(this.mediator.setMoveToProjectId).toHaveBeenCalledWith(0);
expect(this.$confirmButton.attr('disabled')).toBe('disabled'); expect(this.$confirmButton.prop('disabled')).toBeTruthy();
done(); done();
}, 0); }, 0);
}); });
......
/* eslint-disable jasmine/no-global-setup */ /* eslint-disable jasmine/no-global-setup */
import $ from 'jquery'; import $ from 'jquery';
import 'jasmine-jquery'; import 'vendor/jasmine-jquery';
import '~/commons'; import '~/commons';
import Vue from 'vue'; import Vue from 'vue';
...@@ -144,6 +144,9 @@ if (process.env.BABEL_ENV === 'coverage') { ...@@ -144,6 +144,9 @@ if (process.env.BABEL_ENV === 'coverage') {
describe('Uncovered files', function () { describe('Uncovered files', function () {
const sourceFiles = require.context('~', true, /\.js$/); const sourceFiles = require.context('~', true, /\.js$/);
$.holdReady(true);
sourceFiles.keys().forEach(function (path) { sourceFiles.keys().forEach(function (path) {
// ignore if there is a matching spec file // ignore if there is a matching spec file
if (testsContext.keys().indexOf(`${path.replace(/\.js$/, '')}_spec`) > -1) { if (testsContext.keys().indexOf(`${path.replace(/\.js$/, '')}_spec`) > -1) {
......
This diff is collapsed.
...@@ -448,7 +448,7 @@ Controller = (function() { ...@@ -448,7 +448,7 @@ Controller = (function() {
Controller.prototype.insertContentFor = function($li) { Controller.prototype.insertContentFor = function($li) {
var data, tpl; var data, tpl;
tpl = this.getOpt('insertTpl'); tpl = this.getOpt('insertTpl');
data = $.extend({}, $li.data('item-data'), { data = $.extend({}, $li.data('itemData'), {
'atwho-at': this.at 'atwho-at': this.at
}); });
return this.callbacks("tplEval").call(this, tpl, data, "onInsert"); return this.callbacks("tplEval").call(this, tpl, data, "onInsert");
...@@ -824,7 +824,7 @@ EditableController = (function(superClass) { ...@@ -824,7 +824,7 @@ EditableController = (function(superClass) {
this.$inputor.focus(); this.$inputor.focus();
} }
suffix = (suffix = this.getOpt('suffix')) === "" ? suffix : suffix || "\u00A0"; suffix = (suffix = this.getOpt('suffix')) === "" ? suffix : suffix || "\u00A0";
data = $li.data('item-data'); data = $li.data('itemData');
this.query.el.removeClass('atwho-query').addClass('atwho-inserted').html(content).attr('data-atwho-at-query', "" + data['atwho-at'] + this.query.text); this.query.el.removeClass('atwho-query').addClass('atwho-inserted').html(content).attr('data-atwho-at-query', "" + data['atwho-at'] + this.query.text);
if (range = this._getRange()) { if (range = this._getRange()) {
range.setEndAfter(this.query.el[0]); range.setEndAfter(this.query.el[0]);
......
...@@ -125,4 +125,4 @@ ...@@ -125,4 +125,4 @@
} }
}; };
})(jQuery); })(jQuery);
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
(function($) { (function($) {
var fetchRequestResults, getRequestId, peekEnabled, updatePerformanceBar; var fetchRequestResults, getRequestId, peekEnabled, updatePerformanceBar;
getRequestId = function() { getRequestId = function() {
return $('#peek').data('request-id'); return $('#peek').data('requestId');
}; };
peekEnabled = function() { peekEnabled = function() {
return $('#peek').length; return $('#peek').length;
......
...@@ -4211,9 +4211,9 @@ jquery.waitforimages@^2.2.0: ...@@ -4211,9 +4211,9 @@ jquery.waitforimages@^2.2.0:
version "2.2.0" version "2.2.0"
resolved "https://registry.yarnpkg.com/jquery.waitforimages/-/jquery.waitforimages-2.2.0.tgz#63f23131055a1b060dc913e6d874bcc9b9e6b16b" resolved "https://registry.yarnpkg.com/jquery.waitforimages/-/jquery.waitforimages-2.2.0.tgz#63f23131055a1b060dc913e6d874bcc9b9e6b16b"
"jquery@>= 1.9.1", jquery@>=1.8.0, jquery@^2.2.4: "jquery@>= 1.9.1", jquery@>=1.8.0, jquery@^3.2.1:
version "2.2.4" version "3.3.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-2.2.4.tgz#2c89d6889b5eac522a7eea32c14521559c6cbf02" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"
js-base64@^2.1.9: js-base64@^2.1.9:
version "2.1.9" version "2.1.9"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment