Commit 98cd652f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

remove global libraries from mocha-config

parent f3745a53
......@@ -2726,10 +2726,10 @@
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.2.1.tgz",
"integrity": "sha1-XE2d5lKvbNCncBVKYxu6ErAVx4c="
},
"jquery-ui-dist": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/jquery-ui-dist/-/jquery-ui-dist-1.12.1.tgz",
"integrity": "sha1-XAgV08xvkP9fqvWyaKbiO0ypBPo=",
"jquery-ui": {
"version": "1.10.5",
"resolved": "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.10.5.tgz",
"integrity": "sha1-gmrtPdH4jTKudddN9IZD3EMaWBU=",
"dev": true
},
"js-tokens": {
......
......@@ -24,13 +24,10 @@
"browserify": "^13.1.1",
"chai": "^3.5.0",
"clean-css-cli": "^4.2.1",
"datatables.net": "^1.10.19",
"del": "^3.0.0",
"exorcist": "^0.4.0",
"file-url": "^2.0.0",
"istanbul": "0.4.5",
"jquery": "3.2.1",
"jquery-ui-dist": "1.12.1",
"jsdom": "11.7.0",
"jshint": "^2.9.6",
"log4js-in-memory-appender": "^0.1.2",
......@@ -43,11 +40,14 @@
},
"dependencies": {
"csv-stringify": "^4.0.0",
"datatables.net": "^1.10.19",
"datatables.net-rowreorder": "^1.2.5",
"dual-listbox": "1.0.7",
"file-saver": "^1.3.8",
"http-status-codes": "^1.3.0",
"is-url": "^1.2.4",
"jquery": "3.2.1",
"jquery-ui": "1.10.5",
"jstree": "^3.3.5",
"jszip": "^3.1.5",
"log4js": "4.1.0",
......
......@@ -9,6 +9,12 @@ var ObjectWithListeners = require('./ObjectWithListeners');
var SecurityError = require('./SecurityError');
var ValidationError = require('./ValidationError');
var $ = require('jquery');
var jQuery = $;
var dt = require('datatables.net')();
var dtReorder = require('datatables.net-rowreorder')();
require('jquery-ui/dialog');
/**
* This static global object contains set of functions that returns/set data in
* the Gui (html).
......
"use strict";
require("./mocha-config");
var $ = require('jquery');
var GuiConnector = require('../../main/js/GuiConnector');
var SecurityError = require('../../main/js/SecurityError');
......
......@@ -2,6 +2,9 @@
var Promise = require("bluebird");
mockEnvironment();
var $ = require('jquery');
var Helper = require('./helper');
......@@ -9,18 +12,11 @@ var GuiConnector = require('./GuiConnector-mock');
var path = require('path');
global.window = undefined;
// -----------------------------
var logger = require('./logger');
function mockBootstrap() {
$.fn.typeahead = function () {
logger.debug("Mock typeahead function call");
};
}
before(function () {
function mockEnvironment() {
require('../../main/js/Functions').loadScript = function () {
global.MathJax = {
Hub: {
......@@ -53,10 +49,6 @@ before(function () {
global.document.elementFromPoint = function () {
};
global.$ = require('jquery');
global.jQuery = $;
global.window.$ = $;
// additions to jsdom implementations:
global.Option = window.Option;
global.Blob = window.Blob;
......@@ -172,25 +164,15 @@ before(function () {
};
// ---
require('jquery-ui-dist/jquery-ui.js');
require("bootstrap");
require('datatables.net')(window, $);
require('datatables.net-rowreorder')(window, $);
require('spectrum-colorpicker');
global.tinycolor = window.tinycolor;
require('jstree');
global.google = require('./google-map-mock');
global.ServerConnector = require('./ServerConnector-mock');
Promise.longStackTraces();
}
mockBootstrap();
});
beforeEach(function () {
Helper.prototype.setUrl.call(this, "http://test/");
......@@ -228,7 +210,7 @@ afterEach(function () {
var content = document.body.innerHTML;
document.body.innerHTML = "";
this.test.error(new Error("Test didn't left clean document. Found: " + content));
} else if ($._data(window, "events").resize) {
} else if ($._data(window, "events") && $._data(window, "events").resize) {
var events = $._data(window, "events").resize;
logger.warn(events);
$(window).off("resize");
......@@ -236,7 +218,7 @@ afterEach(function () {
}
} else {
//when failed don't forget to clean events
if ($._data(window, "events").resize) {
if ($._data(window, "events") && $._data(window, "events").resize) {
logger.warn("Clearing events: " + $._data(window, "events").resize);
$(window).off("resize");
}
......
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