summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-06-08 17:15:34 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-07-07 14:57:00 +0100
commit001c904f28566b2fb3575b5a79871cedf94ea289 (patch)
tree48d73ad38cddf7ff193118baf2a28cc99cda2f67 /spec/javascripts
parent421e41c9ce3abdd843079c1eb022cad8974d36ff (diff)
downloadgitlab-ce-001c904f28566b2fb3575b5a79871cedf94ea289.tar.gz
Remove inclusive JS imports
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/close_reopen_report_toggle_spec.js14
-rw-r--r--spec/javascripts/issue_spec.js14
-rw-r--r--spec/javascripts/merge_request_spec.js14
3 files changed, 14 insertions, 28 deletions
diff --git a/spec/javascripts/close_reopen_report_toggle_spec.js b/spec/javascripts/close_reopen_report_toggle_spec.js
index 9641a7e43d6..d94f6a8a345 100644
--- a/spec/javascripts/close_reopen_report_toggle_spec.js
+++ b/spec/javascripts/close_reopen_report_toggle_spec.js
@@ -1,5 +1,5 @@
import CloseReopenReportToggle from '~/close_reopen_report_toggle';
-import * as DropLab from '~/droplab/drop_lab';
+import DropLab from '~/droplab/drop_lab';
describe('CloseReopenReportToggle', () => {
describe('class constructor', () => {
@@ -32,7 +32,6 @@ describe('CloseReopenReportToggle', () => {
describe('initDroplab', () => {
let closeReopenReportToggle;
const dropdownList = jasmine.createSpyObj('dropdownList', ['querySelector']);
- const droplab = jasmine.createSpyObj('droplab', ['init']);
const dropdownTrigger = {};
const button = {};
const reopenItem = {};
@@ -40,7 +39,7 @@ describe('CloseReopenReportToggle', () => {
const config = {};
beforeEach(() => {
- spyOn(DropLab, 'default').and.returnValue(droplab);
+ spyOn(DropLab.prototype, 'init');
dropdownList.querySelector.and.returnValues(reopenItem, closeItem);
closeReopenReportToggle = new CloseReopenReportToggle({
@@ -61,17 +60,16 @@ describe('CloseReopenReportToggle', () => {
expect(closeReopenReportToggle.closeItem).toBe(closeItem);
});
- it('instantiates DropLab and set .droplab', () => {
- expect(DropLab.default).toHaveBeenCalled();
- expect(closeReopenReportToggle.droplab).toBe(droplab);
+ it('sets .droplab', () => {
+ expect(closeReopenReportToggle.droplab).toEqual(jasmine.any(Object));
});
it('calls .setConfig', () => {
expect(closeReopenReportToggle.setConfig).toHaveBeenCalled();
});
- it('calls .droplab.init', () => {
- expect(droplab.init).toHaveBeenCalledWith(
+ it('calls droplab.init', () => {
+ expect(DropLab.prototype.init).toHaveBeenCalledWith(
dropdownTrigger,
dropdownList,
jasmine.any(Array),
diff --git a/spec/javascripts/issue_spec.js b/spec/javascripts/issue_spec.js
index 43420076be0..63241e5bbd7 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 CloseReopenReportToggle from '~/close_reopen_report_toggle';
import '~/lib/utils/text_utility';
describe('Issue', function() {
@@ -208,15 +208,14 @@ describe('Issue', function() {
});
describe('initCloseReopenReport', () => {
- it('inits a new CloseReopenReportToggle instance and calls .initDroplab', () => {
+ it('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);
+ spyOn(CloseReopenReportToggle.prototype, 'initDroplab');
container.querySelector.and.returnValues(dropdownTrigger, dropdownList, button);
Issue.prototype.initCloseReopenReport();
@@ -225,12 +224,7 @@ describe('Issue', function() {
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();
+ expect(CloseReopenReportToggle.prototype.initDroplab).toHaveBeenCalled();
});
});
});
diff --git a/spec/javascripts/merge_request_spec.js b/spec/javascripts/merge_request_spec.js
index 3235df50456..7a939b1bd9f 100644
--- a/spec/javascripts/merge_request_spec.js
+++ b/spec/javascripts/merge_request_spec.js
@@ -2,7 +2,7 @@
/* global MergeRequest */
import '~/merge_request';
-import * as CloseReopenReportToggle from '~/close_reopen_report_toggle';
+import CloseReopenReportToggle from '~/close_reopen_report_toggle';
(function() {
describe('MergeRequest', function() {
@@ -40,15 +40,14 @@ import * as CloseReopenReportToggle from '~/close_reopen_report_toggle';
});
describe('initCloseReopenReport', () => {
- it('inits a new CloseReopenReportToggle instance and calls .initDroplab', () => {
+ it('calls .initDroplab', () => {
const container = jasmine.createSpyObj('container', ['querySelector']);
- const closeReopenReportToggle = jasmine.createSpyObj('closeReopenReportToggle', ['initDroplab']);
const dropdownTrigger = {};
const dropdownList = {};
const button = {};
+ spyOn(CloseReopenReportToggle.prototype, 'initDroplab');
spyOn(document, 'querySelector').and.returnValue(container);
- spyOn(CloseReopenReportToggle, 'default').and.returnValue(closeReopenReportToggle);
container.querySelector.and.returnValues(dropdownTrigger, dropdownList, button);
MergeRequest.initCloseReopenReport();
@@ -57,12 +56,7 @@ import * as CloseReopenReportToggle from '~/close_reopen_report_toggle';
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();
+ expect(CloseReopenReportToggle.prototype.initDroplab).toHaveBeenCalled();
});
});
});