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