Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-06-07 22:34:19 +0300
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-07-07 16:57:00 +0300
commit421e41c9ce3abdd843079c1eb022cad8974d36ff (patch)
tree495149c4fd99d811e31bae9e2d775954764a04fa /spec/javascripts/issue_spec.js
parentfa82736cf4ba55c0f549f137afd2abe8383e33f8 (diff)
Added specs
Diffstat (limited to 'spec/javascripts/issue_spec.js')
-rw-r--r--spec/javascripts/issue_spec.js41
1 files changed, 40 insertions, 1 deletions
diff --git a/spec/javascripts/issue_spec.js b/spec/javascripts/issue_spec.js
index df97a100b0d..43420076be0 100644
--- a/spec/javascripts/issue_spec.js
+++ b/spec/javascripts/issue_spec.js
@@ -1,6 +1,6 @@
/* eslint-disable space-before-function-paren, one-var, one-var-declaration-per-line, no-use-before-define, comma-dangle, max-len */
import Issue from '~/issue';
-
+import * as CloseReopenReportToggle from '~/close_reopen_report_toggle';
import '~/lib/utils/text_utility';
describe('Issue', function() {
@@ -195,4 +195,43 @@ describe('Issue', function() {
});
});
});
+
+ describe('units', () => {
+ describe('class constructor', () => {
+ it('calls .initCloseReopenReport', () => {
+ spyOn(Issue.prototype, 'initCloseReopenReport');
+
+ new Issue(); // eslint-disable-line no-new
+
+ expect(Issue.prototype.initCloseReopenReport).toHaveBeenCalled();
+ });
+ });
+
+ describe('initCloseReopenReport', () => {
+ it('inits a new CloseReopenReportToggle instance and calls .initDroplab', () => {
+ const container = jasmine.createSpyObj('container', ['querySelector']);
+ const closeReopenReportToggle = jasmine.createSpyObj('closeReopenReportToggle', ['initDroplab']);
+ const dropdownTrigger = {};
+ const dropdownList = {};
+ const button = {};
+
+ spyOn(document, 'querySelector').and.returnValue(container);
+ spyOn(CloseReopenReportToggle, 'default').and.returnValue(closeReopenReportToggle);
+ container.querySelector.and.returnValues(dropdownTrigger, dropdownList, button);
+
+ Issue.prototype.initCloseReopenReport();
+
+ expect(document.querySelector).toHaveBeenCalledWith('.js-issuable-close-dropdown');
+ expect(container.querySelector).toHaveBeenCalledWith('.js-issuable-close-toggle');
+ expect(container.querySelector).toHaveBeenCalledWith('.js-issuable-close-menu');
+ expect(container.querySelector).toHaveBeenCalledWith('.js-issuable-close-button');
+ expect(CloseReopenReportToggle.default).toHaveBeenCalledWith({
+ dropdownTrigger,
+ dropdownList,
+ button,
+ });
+ expect(closeReopenReportToggle.initDroplab).toHaveBeenCalled();
+ });
+ });
+ });
});