diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-07-07 18:04:43 +0300 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-07-07 18:05:17 +0300 |
commit | f28cd19dde32ab62cc3543d3579fc416d5976aed (patch) | |
tree | 0e8e0323fbda001255e6aec578a60572e50523a3 /app/assets | |
parent | c7f23e2564880a9742b3f428dcde567852e75212 (diff) |
Fix MR and issue specs
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/helpers/issuables_helper.js | 8 | ||||
-rw-r--r-- | app/assets/javascripts/issue.js | 8 | ||||
-rw-r--r-- | app/assets/javascripts/merge_request.js | 4 |
3 files changed, 13 insertions, 7 deletions
diff --git a/app/assets/javascripts/helpers/issuables_helper.js b/app/assets/javascripts/helpers/issuables_helper.js index 68fd8c74bea..52d0f7e43fc 100644 --- a/app/assets/javascripts/helpers/issuables_helper.js +++ b/app/assets/javascripts/helpers/issuables_helper.js @@ -1,6 +1,6 @@ import CloseReopenReportToggle from '../close_reopen_report_toggle'; -export default function initCloseReopenReport() { +function initCloseReopenReport() { const container = document.querySelector('.js-issuable-close-dropdown'); if (!container) return undefined; @@ -19,3 +19,9 @@ export default function initCloseReopenReport() { return closeReopenReportToggle; } + +const IssuablesHelper = { + initCloseReopenReport, +}; + +export default IssuablesHelper; diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js index 912da6ed6c1..f5e97e6e384 100644 --- a/app/assets/javascripts/issue.js +++ b/app/assets/javascripts/issue.js @@ -6,7 +6,7 @@ import '~/lib/utils/text_utility'; import './flash'; import './task_list'; import CreateMergeRequestDropdown from './create_merge_request_dropdown'; -import initCloseReopenReport from './helpers/issuables_helper'; +import IssuablesHelper from './helpers/issuables_helper'; class Issue { constructor() { @@ -98,10 +98,10 @@ class Issue { } initCloseReopenReport() { - this.closeReopenReportToggle = initCloseReopenReport(); + this.closeReopenReportToggle = IssuablesHelper.initCloseReopenReport(); - this.closeButtons = this.closeButtons.not('.issuable-close-button'); - this.reopenButtons = this.reopenButtons.not('.issuable-close-button'); + if (this.closeButtons) this.closeButtons = this.closeButtons.not('.issuable-close-button'); + if (this.reopenButtons) this.reopenButtons = this.reopenButtons.not('.issuable-close-button'); } disableCloseReopenButton($button, shouldDisable) { diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index 938c7446a06..8594dc226ec 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -4,7 +4,7 @@ import 'vendor/jquery.waitforimages'; import './task_list'; import './merge_request_tabs'; -import initCloseReopenReport from './helpers/issuables_helper'; +import IssuablesHelper from './helpers/issuables_helper'; (function() { this.MergeRequest = (function() { @@ -26,7 +26,7 @@ import initCloseReopenReport from './helpers/issuables_helper'; this.initTabs(); this.initMRBtnListeners(); this.initCommitMessageListeners(); - this.closeReopenReportToggle = initCloseReopenReport(); + this.closeReopenReportToggle = IssuablesHelper.initCloseReopenReport(); if ($("a.btn-close").length) { this.taskList = new gl.TaskList({ |