2024-06-05 11:25:15 -04:00
|
|
|
const fs = require('fs');
|
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
|
|
// Set up jQuery
|
|
|
|
|
global.$ = global.jQuery = require('jquery');
|
|
|
|
|
|
2024-07-18 12:36:49 -04:00
|
|
|
// tests/jest.setup.js
|
|
|
|
|
global.io = jest.fn().mockReturnValue({
|
2025-06-16 19:42:08 -04:00
|
|
|
on: jest.fn(),
|
|
|
|
|
emit: jest.fn(),
|
2024-07-18 12:36:49 -04:00
|
|
|
});
|
|
|
|
|
|
2024-06-05 11:25:15 -04:00
|
|
|
// Load module code
|
2025-10-06 09:38:54 -04:00
|
|
|
global.window = global.window || {};
|
|
|
|
|
global.window.NotifyModules = global.window.NotifyModules || {};
|
|
|
|
|
global.window.NotifyModules.start = function() {
|
|
|
|
|
var modules = document.querySelectorAll('[data-module]');
|
|
|
|
|
modules.forEach(function(element) {
|
|
|
|
|
var moduleName = element.getAttribute('data-module');
|
|
|
|
|
var moduleStarted = element.getAttribute('data-module-started');
|
|
|
|
|
|
|
|
|
|
if (!moduleStarted && global.window.NotifyModules[moduleName]) {
|
|
|
|
|
var module = new global.window.NotifyModules[moduleName]();
|
|
|
|
|
if (module.start) {
|
|
|
|
|
module.start(element);
|
|
|
|
|
}
|
|
|
|
|
element.setAttribute('data-module-started', 'true');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|