Commit 729562dd authored by Clement Ho's avatar Clement Ho

Fix rspec prevent default errors

parent 89ab47cd
......@@ -24,7 +24,7 @@ export default class TemplateSelector {
search: {
fields: ['name'],
},
clicked: (item, el, e) => this.fetchFileTemplate(item, el, e),
clicked: (options) => this.fetchFileTemplate(options),
text: item => item.name,
});
}
......@@ -51,7 +51,10 @@ export default class TemplateSelector {
return this.$dropdownContainer.removeClass('hidden');
}
fetchFileTemplate(item, el, e) {
fetchFileTemplate(options) {
const { e } = options;
const item = options.selectedObj;
e.preventDefault();
return this.requestFile(item);
}
......
......@@ -43,7 +43,10 @@
return $el.text();
},
clicked: (selected, $link) => {
clicked: (options) => {
const selected = options.selectedObj;
const $link = options.$el;
if (!$link.data('revert')) {
this.formSubmit(null, $link);
} else {
......
......@@ -58,7 +58,8 @@
});
}
NamespaceSelect.prototype.onSelectItem = function(item, el, e) {
NamespaceSelect.prototype.onSelectItem = function(options) {
const { e } = options;
return e.preventDefault();
};
......
......@@ -119,7 +119,8 @@ import Cookies from 'js-cookie';
toggleLabel: function(obj, $el) {
return $el.text().trim();
},
clicked: function(selected, $el, e) {
clicked: function(options) {
const { e } = options;
e.preventDefault();
if ($('input[name="ref"]').length) {
var $form = $dropdown.closest('form');
......
......@@ -53,7 +53,10 @@
onHide();
}
},
clicked(item, $el, e) {
clicked(options) {
const { $el, e } = options;
const item = options.selectedObj;
e.preventDefault();
if ($el.is('.is-active')) {
......
......@@ -35,7 +35,8 @@ class ProtectedBranchDropdown {
return _.escape(protectedBranch.id);
},
onFilter: this.toggleCreateNewButton.bind(this),
clicked: (item, $el, e) => {
clicked: (options) => {
const { $el, e } = options;
e.preventDefault();
this.onSelect();
}
......
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