Update master

This commit is contained in:
Dennis Eichhorn 2024-04-24 23:44:36 +00:00
commit 0ac99f6bf0
139 changed files with 5979 additions and 1827 deletions

View File

@ -3,45 +3,9 @@ name: CI
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
codestyle-tests: general_module_workflow_js:
runs-on: ubuntu-latest uses: Karaka-Management/Karaka/.github/workflows/js_template.yml@develop
if: "!contains(github.event.head_commit.message, 'NO_CI')" secrets:
steps: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Repository GH_PAT: ${{ secrets.GH_PAT }}
uses: actions/checkout@main CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fetch-depth: 1
- name: Checkout Build Repository
uses: actions/checkout@main
with:
fetch-depth: 1
ref: develop
repository: Karaka-Management/Build
path: Build
- name: Install NPM
uses: actions/setup-node@v3
with:
node-version: '14'
cache: 'npm'
- run: npm install
- name: eslint
run: npx eslint ./ -c Build/Config/.eslintrc.json
# linting:
# runs-on: ubuntu-latest
# if: "!contains(github.event.head_commit.message, 'NO_CI')"
# strategy:
# fail-fast: false
# max-parallel: 3
# steps:
# - name: Checkout Repository
# uses: actions/checkout@main
# with:
# fetch-depth: 0
# submodules: recursive
# token: ${{ secrets.GH_TOKEN }}
# - name: Lint Code Base
# uses: github/super-linter/slim@v4
# env:
# VALIDATE_ALL_CODEBASE: false
# DEFAULT_BRANCH: develop
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

4
.gitignore vendored
View File

@ -13,4 +13,6 @@ node_modules
cache cache
Cache Cache
Libraries Libraries
.idea .idea
*Spec.js
*spec.js

View File

@ -32,11 +32,15 @@ export class AssetManager
*/ */
registerLoadedAssets () registerLoadedAssets ()
{ {
this.assets = {};
if (typeof document === 'undefined') {
return;
}
const scripts = document.getElementsByTagName('script'); const scripts = document.getElementsByTagName('script');
const length = !scripts ? 0 : scripts.length; const length = !scripts ? 0 : scripts.length;
this.assets = {};
for (let i = 0; i < length; ++i) { for (let i = 0; i < length; ++i) {
this.assets[jsOMS.hash(scripts[i].src)] = scripts[i].src; this.assets[jsOMS.hash(scripts[i].src)] = scripts[i].src;
} }

View File

@ -269,6 +269,7 @@ export class EventManager
attach (group, callback, remove = false, reset = false) attach (group, callback, remove = false, reset = false)
{ {
if (!Object.prototype.hasOwnProperty.call(this.callbacks, group)) { if (!Object.prototype.hasOwnProperty.call(this.callbacks, group)) {
// @question Consider to make this a struct?
this.callbacks[group] = { remove: remove, reset: reset, callbacks: [], lastRun: 0 }; this.callbacks[group] = { remove: remove, reset: reset, callbacks: [], lastRun: 0 };
} }

0
ICAL.txt → ICLA.txt Executable file → Normal file
View File

View File

@ -46,3 +46,7 @@ Unless required by applicable law or agreed to in writing, Licensor provides the
7. Limitation of Liability 7. Limitation of Liability
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
8. Future Changes
The Licensor may change the License for future versions as he sees fit.

View File

@ -90,12 +90,19 @@ export class Logger
*/ */
createContext (message, context, level) createContext (message, context, level)
{ {
context.backtrace = console.trace(); let stack;
try {
throw new Error('');
} catch (e) {
stack = e.stack || '';
}
context.backtrace = stack;
context.datetime = (new Date()).toISOString(); context.datetime = (new Date()).toISOString();
context.version = '1.0.0'; context.version = '1.0.0';
context.os = SystemUtils.getOS(); context.os = SystemUtils.getOS();
context.browser = SystemUtils.getBrowser(); context.browser = SystemUtils.getBrowser();
context.path = window.location.href; context.path = typeof window === 'undefined' ? '' : window.location.href;
context.datetime = (new Date()).toString(); context.datetime = (new Date()).toString();
context.level = level; context.level = level;
context.message = message; context.message = message;

View File

@ -1,14 +1,13 @@
/** /**
* Math formula evaluator * Math processor.
* *
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 2.0 * @license OMS License 2.0
* @version 1.0.0 * @version 1.0.0
* @since 1.0.0 * @since 1.0.0
*/ */
(function (jsOMS) { export class MathProcessor
'use strict'; {
/** /**
* Evaluate math formula * Evaluate math formula
* *
@ -18,18 +17,18 @@
* *
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.mathEvaluate = function (equation) static mathEvaluate (equation)
{ {
const stack = []; const stack = [];
const postfix = jsOMS.shuntingYard(equation); const postfix = MathProcessor.shuntingYard(equation);
const length = postfix.length; const length = postfix.length;
for (let i = 0; i < length; ++i) { for (let i = 0; i < length; ++i) {
if (!isNaN(parseFloat(postfix[i])) && isFinite(postfix[i])) { if (!isNaN(parseFloat(postfix[i])) && isFinite(postfix[i])) {
stack.push(postfix[i]); stack.push(postfix[i]);
} else { } else {
const a = jsOMS.parseValue(stack.pop()); const a = MathProcessor.parseValue(stack.pop());
const b = jsOMS.parseValue(stack.pop()); const b = MathProcessor.parseValue(stack.pop());
if (postfix[i] === '+') { if (postfix[i] === '+') {
stack.push(a + b); stack.push(a + b);
@ -59,7 +58,7 @@
* *
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.parseValue = function (value) static parseValue (value)
{ {
return typeof value === 'string' ? (value.indexOf('.') === -1 ? parseInt(value) : parseFloat(value)) : value; return typeof value === 'string' ? (value.indexOf('.') === -1 ? parseInt(value) : parseFloat(value)) : value;
}; };
@ -73,7 +72,7 @@
* *
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.shuntingYard = function (equation) static shuntingYard (equation)
{ {
const stack = []; const stack = [];
const operators = { const operators = {
@ -126,4 +125,5 @@
return output; return output;
}; };
}(window.jsOMS = window.jsOMS || {})); };

View File

@ -47,7 +47,7 @@ export class BrowserNotification
requestPermission () requestPermission ()
{ {
/** global: Notification */ /** global: Notification */
if (Notification.permission !== 'granted' && Notification.permission !== 'denied') { if (Notification.permission !== 'granted' && Notification.permission !== 'denied' && window.isSecureContext) {
Notification.requestPermission(); Notification.requestPermission();
} }
}; };

View File

@ -17,7 +17,7 @@ export class Response
* *
* @since 1.0.0 * @since 1.0.0
*/ */
constructor (data) constructor (data = {})
{ {
/** @type {Object} responses */ /** @type {Object} responses */
this.responses = data; this.responses = data;
@ -34,7 +34,9 @@ export class Response
*/ */
get (id = null) get (id = null)
{ {
return id === null ? this.responses : (typeof this.responses[id] === 'undefined' ? null : this.responses[id]); return id === null
? this.responses
: (typeof this.responses[id] === 'undefined' ? null : this.responses[id]);
}; };
/** /**

View File

@ -0,0 +1,50 @@
import { jsOMS } from '../../../Utils/oLib.js';
/**
* Set value of input.
*
* @param {Object} action Action data
* @param {function} callback Callback
* @param {string} id Action element
*
* @since 1.0.0
*/
export function domChangeAttribute (action, callback, id)
{
'use strict';
const fill = action.base === 'self'
? (action.selector === ''
? [document.getElementById(id)]
: document.getElementById(id).querySelectorAll(action.selector))
: document.querySelectorAll(action.selector);
for (const i in fill) {
/** global: HTMLElement */
if (!Object.prototype.hasOwnProperty.call(fill, i) || !(fill[i] instanceof HTMLElement)) {
continue;
}
switch (action.subtype) {
case 'remove': {
const old = fill[i].getAttribute(action.attr);
if (old !== null && old.match(new RegExp('(\\s|^)' + action.value + '(\\s|$)')) !== null) {
const reg = new RegExp('(\\s|^)' + action.value);
fill[i].setAttribute(action.attr, old.replace(reg, '').trim());
}
break;
}
case 'add':
fill[i].setAttribute(action.attr, jsOMS.trim(fill[i].getAttribute(action.attr) + ' ' + action.value));
break;
case 'set':
fill[i].setAttribute(action.attr, action.value);
break;
default:
}
}
callback(action.data);
};

View File

@ -1,3 +1,5 @@
import { GeneralUI } from '../../../UI/GeneralUI.js';
/** /**
* Get value from dom. * Get value from dom.
* *
@ -29,16 +31,11 @@ export function domGetValue (action, callback, id)
? e[i].getAttribute('name') ? e[i].getAttribute('name')
: e[i].getAttribute('id'); : e[i].getAttribute('id');
if (e[i].tagName.toLowerCase() === 'input' if (e[i].tagName.toLowerCase() === 'form') {
|| e[i].tagName.toLowerCase() === 'selects'
|| e[i].tagName.toLowerCase() === 'button'
) {
value[eId] = e[i].getAttribute('value');
} else if (e[i].tagName.toLowerCase() === 'form') {
value = window.omsApp.uiManager.getFormManager().get(eId).getData(); value = window.omsApp.uiManager.getFormManager().get(eId).getData();
break; break;
} else { } else {
value[eId] = e[i].getAttribute('data-id'); value[eId] = GeneralUI.getValueFromDataSource(e[i]);
} }
} }

45
Model/Action/Event/If.js Normal file
View File

@ -0,0 +1,45 @@
/**
* Prevent UI action.
*
* @param {Object} action Action data
* @param {function} callback Callback
* @param {string} id Action element
*
* @since 1.0.0
*/
export function ifAction (action, callback, id)
{
'use strict';
const conditions = action.conditions;
const data = Object.values(action.data)[0];
for (const i in conditions) {
if (conditions[i].comp === '==' && data === conditions[i].value) {
action.key = conditions[i].jump - 1;
break;
} else if (conditions[i].comp === '!=' && data !== conditions[i].value) {
action.key = conditions[i].jump - 1;
break;
} else if (conditions[i].comp === '>' && data > conditions[i].value) {
action.key = conditions[i].jump - 1;
break;
} else if (conditions[i].comp === '<' && data < conditions[i].value) {
action.key = conditions[i].jump - 1;
break;
} else if (conditions[i].comp === '>=' && data >= conditions[i].value) {
action.key = conditions[i].jump - 1;
break;
} else if (conditions[i].comp === '<=' && data <= conditions[i].value) {
action.key = conditions[i].jump - 1;
break;
} else if (conditions[i].comp === '') {
// empty comparison => else statement
action.key = conditions[i].jump - 1;
break;
}
}
callback();
};

View File

@ -0,0 +1,16 @@
/**
* Prevent UI action.
*
* @param {Object} action Action data
* @param {function} callback Callback
* @param {string} id Action element
*
* @since 1.0.0
*/
export function jumpAction (action, callback, id)
{
'use strict';
action.key = action.jump - 1;
callback();
};

View File

@ -20,9 +20,13 @@ export class SystemUtils
*/ */
static getBrowser () static getBrowser ()
{ {
/** global: InstallTrigger */ if (typeof window === 'undefined') {
/** global: navigator */ return BrowserType.UNKNOWN;
/** global: window */ }
/* global InstallTrigger */
/* global navigator */
/* global window */
if ((!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) { if ((!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) {
return BrowserType.OPERA; return BrowserType.OPERA;
} else if (typeof InstallTrigger !== 'undefined') { } else if (typeof InstallTrigger !== 'undefined') {
@ -54,10 +58,14 @@ export class SystemUtils
*/ */
static getOS () static getOS ()
{ {
if (typeof navigator === 'undefined') {
return OSType.UNKNOWN;
}
for (const os in OSType) { for (const os in OSType) {
if (Object.prototype.hasOwnProperty.call(OSType, os)) { if (Object.prototype.hasOwnProperty.call(OSType, os)) {
/** global: navigator */ /* global navigator */
if (navigator.appVersion.toLowerCase().indexOf(OSType[os]) !== -1) { if (navigator.userAgent.toLowerCase().indexOf(OSType[os]) !== -1) {
return OSType[os]; return OSType[os];
} }
} }

View File

@ -164,7 +164,7 @@ export class Form
// If isOnChange(): every change results in action // If isOnChange(): every change results in action
// -> perform action on change // -> perform action on change
if (!this.forms[id].isOnChange()) { if (!this.forms[id].isOnChange()) {
toBind[i].addEventListener('change', function (evnt) { toBind[i].addEventListener('change', function () {
if (window.omsApp.state) { if (window.omsApp.state) {
window.omsApp.state.hasChanges = true; window.omsApp.state.hasChanges = true;
} }
@ -212,8 +212,8 @@ export class Form
jsOMS.preventAll(event); jsOMS.preventAll(event);
const remove = self.forms[id].getRemove()[elementIndex]; const remove = self.forms[id].getRemove()[elementIndex];
const callback = function (xhr) { const callback = function (xhr = null) {
if (xhr.status !== 200) { if (xhr !== null && xhr.status !== 200) {
self.app.notifyManager.send( self.app.notifyManager.send(
new NotificationMessage( new NotificationMessage(
NotificationLevel.ERROR, NotificationLevel.ERROR,
@ -540,7 +540,7 @@ export class Form
for (let i = 0; i < updateElementLength; ++i) { for (let i = 0; i < updateElementLength; ++i) {
updateElementNames[i] = updateElementNames[i].trim(); updateElementNames[i] = updateElementNames[i].trim();
// get the elment to update // get the element to update
// @todo maybe stupid, because same as elementContainer. however this is more general? anyway, one can be replaced // @todo maybe stupid, because same as elementContainer. however this is more general? anyway, one can be replaced
updateElements.push( updateElements.push(
formElement.querySelector(updateElementNames[i] + '[data-id="' + elementContainer.getAttribute('data-id') + '"]') formElement.querySelector(updateElementNames[i] + '[data-id="' + elementContainer.getAttribute('data-id') + '"]')
@ -569,8 +569,9 @@ export class Form
: Array.prototype.slice.call(dataOriginElement.querySelectorAll('[data-tpl-text]')) : Array.prototype.slice.call(dataOriginElement.querySelectorAll('[data-tpl-text]'))
); );
} }
/** @var {Element} elementContainer Original element */ /** @var {Element} elementContainer Original element */
const element = uiContainer.querySelector('.hidden[data-id="' + elementContainer.getAttribute('data-id') + '"]'); const element = uiContainer.querySelector('.vh[data-id="' + elementContainer.getAttribute('data-id') + '"]');
/** @var {object} remoteUrls Texts and values which come from remote sources */ /** @var {object} remoteUrls Texts and values which come from remote sources */
const remoteUrls = {}; const remoteUrls = {};
@ -637,7 +638,7 @@ export class Form
for (let i = 0; i < updateElementLength; ++i) { for (let i = 0; i < updateElementLength; ++i) {
updateElementNames[i] = updateElementNames[i].trim(); updateElementNames[i] = updateElementNames[i].trim();
// get the elment to update // get the element to update
updateElements.push( updateElements.push(
formElement.querySelector(updateElementNames[i] + '[data-id="' + externalFormElement.getAttribute('data-id') + '"]') formElement.querySelector(updateElementNames[i] + '[data-id="' + externalFormElement.getAttribute('data-id') + '"]')
); );
@ -747,7 +748,10 @@ export class Form
formActionCancel (self, event, id, elementIndex) formActionCancel (self, event, id, elementIndex)
{ {
const ele = document.getElementById(id); const ele = document.getElementById(id);
if (ele.getAttribute('data-update-form') === null && ele.tagName.toLowerCase() !== 'form') { if (ele.getAttribute('data-update-form') === null
&& ele.getAttribute('data-ui-container') !== null
&& ele.getAttribute('data-ui-element') !== null
) {
this.formActionCancelInline(self, event, id, elementIndex); this.formActionCancelInline(self, event, id, elementIndex);
} else { } else {
this.formActionCancelExternal(self, event, id, elementIndex); this.formActionCancelExternal(self, event, id, elementIndex);
@ -771,7 +775,7 @@ export class Form
const elementContainer = event.target.closest(formElement.getAttribute('data-ui-element')); const elementContainer = event.target.closest(formElement.getAttribute('data-ui-element'));
/** @var {Element} elementContainer Original element */ /** @var {Element} elementContainer Original element */
const element = uiContainer.querySelector('.hidden[data-id="' + elementContainer.getAttribute('data-id') + '"]'); const element = uiContainer.querySelector('.vh[data-id="' + elementContainer.getAttribute('data-id') + '"]');
jsOMS.removeClass(element, 'vh'); jsOMS.removeClass(element, 'vh');
@ -829,7 +833,11 @@ export class Form
const uiContainerName = formElement.getAttribute('data-ui-container'); const uiContainerName = formElement.getAttribute('data-ui-container');
/** @var {Element} elementContainer Element container that holds the data that should get updated */ /** @var {Element} elementContainer Element container that holds the data that should get updated */
const elementContainer = event.target.closest(formElement.getAttribute('data-ui-element')); let elementContainer = event.target.closest(formElement.getAttribute('data-ui-element'));
if (elementContainer === null) {
elementContainer = formElement.querySelector(formElement.getAttribute('data-ui-element'));
}
jsOMS.addClass(elementContainer, 'vh'); jsOMS.addClass(elementContainer, 'vh');
/** @var {NodeListOf<Element>} values Value elements of the element to update */ /** @var {NodeListOf<Element>} values Value elements of the element to update */
@ -1007,6 +1015,7 @@ export class Form
this.formActionAdd(self, event, id, elementIndex); this.formActionAdd(self, event, id, elementIndex);
} else if ((elementIndex = Array.from(self.forms[id].getSave()).indexOf(event.target)) !== -1) { } else if ((elementIndex = Array.from(self.forms[id].getSave()).indexOf(event.target)) !== -1) {
this.formActionSave(self, event, id, elementIndex); this.formActionSave(self, event, id, elementIndex);
// self.submit(self.forms[id], self.forms[id].getSubmit()[elementIndex]);
} else if ((elementIndex = Array.from(self.forms[id].getCancel()).indexOf(event.target)) !== -1) { } else if ((elementIndex = Array.from(self.forms[id].getCancel()).indexOf(event.target)) !== -1) {
jsOMS.preventAll(event); jsOMS.preventAll(event);
// @todo currently only handling update cancel, what about add cancel? // @todo currently only handling update cancel, what about add cancel?
@ -1039,7 +1048,7 @@ export class Form
// add // add
// save // save
// update // update
// dragndrop // drag'n drop
} }
/** /**
@ -1233,6 +1242,7 @@ export class Form
&& (statusCode === 200 || statusCode === null) && (statusCode === 200 || statusCode === null)
) { ) {
successInject(response, xhr); successInject(response, xhr);
form.setSuccess(null); // unload success
} }
if (response.get('type') !== null) { if (response.get('type') !== null) {

View File

@ -151,7 +151,7 @@ export class Tab
} }
} }
if (e.querySelector('.tab-links').querySelector('.active') === null) { if (e.querySelector('.tab-links')?.querySelector('.active') === null) {
e.querySelector('.tab-links').querySelector('label').click(); e.querySelector('.tab-links').querySelector('label').click();
} }
}; };

View File

@ -41,8 +41,44 @@ export class UIStateManager
const length = !elements ? 0 : elements.length; const length = !elements ? 0 : elements.length;
for (let i = 0; i < length; ++i) { for (let i = 0; i < length; ++i) {
this.loadState(elements[i]);
this.bindElement(elements[i]); this.bindElement(elements[i]);
} }
// @performance This is a stupid fix to fix view changes during the first loadState
// E.g. scroll position depends on other UI elements
for (let i = 0; i < length; ++i) {
this.loadState(elements[i]);
}
};
loadState (element)
{
if (!element) {
return;
}
let state = JSON.parse(window.localStorage.getItem('ui-state-' + element.id));
state = state !== null ? state : {};
switch (element.tagName.toLowerCase()) {
case 'input':
if ((state === '1' && !element.checked)
|| (state === '0' && element.checked)
) {
element.click();
}
break;
case 'div':
element.scrollLeft = state.x;
element.scrollTop = state.y;
element.scrollTo({ top: state.y, left: state.x });
break;
default:
break;
}
}; };
/** /**
@ -60,37 +96,31 @@ export class UIStateManager
return; return;
} }
let state = JSON.parse(window.localStorage.getItem('ui-state-' + element.id));
state = state !== null ? state : {};
switch (element.tagName.toLowerCase()) { switch (element.tagName.toLowerCase()) {
case 'input': case 'input':
if ((state === '1' && !element.checked)
|| (state === '0' && element.checked)
) {
element.click();
}
element.addEventListener('change', function (event) { element.addEventListener('change', function (event) {
if (this.getAttribute('type') === 'checkbox' if (this.getAttribute('type') === 'checkbox'
|| this.getAttribute('type') === 'radio' || this.getAttribute('type') === 'radio'
) { ) {
window.localStorage.setItem('ui-state-' + this.id, JSON.stringify(this.checked ? '1' : '0')); window.localStorage.setItem(
'ui-state-' + this.id,
JSON.stringify(this.checked ? '1' : '0')
);
} else { } else {
window.localStorage.setItem('ui-state-' + this.id, JSON.stringify(this.value)); window.localStorage.setItem(
'ui-state-' + this.id,
JSON.stringify(this.value)
);
} }
}); });
break; break;
case 'div': case 'div':
// @todo this is not working, WHY? state is correct, but element.scrollTop is just ignored?!
element.scrollLeft = state.x;
element.scrollTop = state.y;
element.scrollTo({ top: state.y, left: state.x });
element.addEventListener('scroll', function () { element.addEventListener('scroll', function () {
window.localStorage.setItem('ui-state-' + this.id, JSON.stringify({ x: this.scrollLeft, y: this.scrollTop })); window.localStorage.setItem(
'ui-state-' + this.id,
JSON.stringify({ x: this.scrollLeft, y: this.scrollTop })
);
}); });
break; break;

View File

@ -201,7 +201,9 @@ export class UriFactory
*/ */
static build (uri, toMatch = null) static build (uri, toMatch = null)
{ {
const current = HttpUri.parseUrl(window.location.href); const current = typeof window === 'undefined'
? ''
: HttpUri.parseUrl(window.location.href);
const query = HttpUri.getAllUriQueryParameters(typeof current.query === 'undefined' ? {} : current.query); const query = HttpUri.getAllUriQueryParameters(typeof current.query === 'undefined' ? {} : current.query);
for (const key in query) { for (const key in query) {
@ -259,18 +261,18 @@ export class UriFactory
} }
return ''; return '';
} else if (match.indexOf('?') === 0) { } else if (match.indexOf('?') === 0 && match.length === 1) {
return current.query(); return current.query();
} else if (match.indexOf('/') === 0) { } else if (match.indexOf('/') === 0 && match.length === 1) {
return current.path; return current.path;
} else if (match.indexOf(':user') === 0) { } else if (match.indexOf(':user') === 0) {
return current.user; return current.user;
} else if (match.indexOf(':pass') === 0) { } else if (match.indexOf(':pass') === 0) {
return current.pass; return current.pass;
} else if (match.indexOf('/') === 0) { } else if (match.indexOf('/') === 0) {
return 'ERROR PATH'; return 'ERROR%20PATH';
} else if (match === '%') { } else if (match === '%') {
return window.location.href; return typeof window === 'undefined' ? '' : window.location.href;
} else { } else {
return match; return match;
} }

View File

@ -594,6 +594,8 @@ export class FormView
if (elements[i].tagName.toLowerCase() === 'canvas') { if (elements[i].tagName.toLowerCase() === 'canvas') {
elements[i].clearRect(0, 0, elements[i].width, elements[i].height); elements[i].clearRect(0, 0, elements[i].width, elements[i].height);
} else if (elements[i].tagName.toLowerCase() === 'textarea') {
elements[i].innerHTML = '';
} }
if (elements[i].getAttribute('data-value') !== null) { if (elements[i].getAttribute('data-value') !== null) {

View File

@ -8,7 +8,7 @@
} }
], ],
"require-dev": { "require-dev": {
"squizlabs/php_codesniffer": ">=3.6", "squizlabs/php_codesniffer": ">=3.7",
"phpstan/phpstan": ">=0.12.18" "phpstan/phpstan": ">=0.12.18"
} }
} }

5586
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,26 +4,40 @@
"hash": "", "hash": "",
"description": "<p align=\"center\"><img src=\"https://raw.githubusercontent.com/Jingga-Management/Assets/master/art/logo.png\" width=\"256\" alt=\"Logo\"></p>", "description": "<p align=\"center\"><img src=\"https://raw.githubusercontent.com/Jingga-Management/Assets/master/art/logo.png\" width=\"256\" alt=\"Logo\"></p>",
"directories": { "directories": {
"test": "tests" "test": "tests"
}, },
"type": "module",
"dependencies": { "dependencies": {
<<<<<<< HEAD
"chromedriver": "^119.0.1", "chromedriver": "^119.0.1",
"eslint": "^8.12.0", "eslint": "^8.12.0",
"geckodriver": "^4.3.3", "geckodriver": "^4.3.3",
"selenium-webdriver": "^4.0.0-beta.4" "selenium-webdriver": "^4.0.0-beta.4"
=======
"chromedriver": "^122.0.6",
"eslint": "^8.12.0",
"geckodriver": "^4.3.3",
"selenium-webdriver": "^4.18.1"
>>>>>>> develop
}, },
"author": "Dennis Eichhorn", "author": "Dennis Eichhorn",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/karaka-management/jsOMS.git" "url": "git+https://github.com/karaka-management/jsOMS.git"
}, },
"license": "OMS", "license": "OMS",
"bugs": { "bugs": {
"url": "https://github.com/karaka-management/jsOMS/issues" "url": "https://github.com/karaka-management/jsOMS/issues"
}, },
"homepage": "https://github.com/karaka-management/jsOMS#readme", "homepage": "https://github.com/karaka-management/jsOMS#readme",
"devDependencies": { "devDependencies": {
"eslint-plugin-import": "^2.25.4" "esbuild": "0.19.5",
"eslint": "^8.12.0",
"eslint-plugin-import": "^2.25.4",
"jasmine": "^5.1.0",
"jasmine-core": "^5.1.2",
"karma-jasmine": "^5.1.0",
"karma-jasmine-html-reporter": "^2.1.0"
} }
} }

View File

@ -1,12 +0,0 @@
describe('3DViewerTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('DdsLoaderTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('MtlLoaderTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('ObjLoaderTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('StlLoaderTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,4 +1,5 @@
import { AccountManager } from '../Account/AccountManager.js'; import { AccountManager } from '../../Account/AccountManager.js';
import { Account } from '../../Account/Account.js';
describe('AccountManagerTest', function () describe('AccountManagerTest', function ()
{ {

View File

@ -1,4 +1,4 @@
import { Account } from '../Account/Account.js'; import { Account } from '../../Account/Account.js';
describe('AccountTest', function () describe('AccountTest', function ()
{ {

View File

@ -1,4 +1,4 @@
import { AccountType } from '../Account/AccountType.js'; import { AccountType } from '../../Account/AccountType.js';
describe('AccountTypeTest', function () describe('AccountTypeTest', function ()
{ {

View File

@ -1,12 +0,0 @@
describe('AnimationTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('ParticleAnimationTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('ParticleTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,4 +1,4 @@
import { AssetManager } from '../Asset/AssetManager.js'; import { AssetManager } from '../../Asset/AssetManager.js';
describe('AssetManagerTest', function () describe('AssetManagerTest', function ()
{ {
@ -18,11 +18,17 @@ describe('AssetManagerTest', function ()
{ {
it('Testing asset interaction functionality', function () it('Testing asset interaction functionality', function ()
{ {
let asset = new AssetManager(), let asset = new AssetManager();
base = window.location.href.substr(0, window.location.href.length - 15); let base = typeof window === 'undefined' ? '' : window.location.href.slice(0, -15);
asset.registerLoadedAssets(); asset.registerLoadedAssets();
if (typeof window === 'undefined') {
expect(true).toBeTrue();
return;
}
expect(asset.get(base + '../Utils/oLib.js')).not.toBe(null); expect(asset.get(base + '../Utils/oLib.js')).not.toBe(null);
expect(asset.remove(base + '../Utils/oLib.js')).toBeTruthy(); expect(asset.remove(base + '../Utils/oLib.js')).toBeTruthy();
expect(asset.load(base + '../Utils/oLib.js', 'js')).not.toBeFalsy(); expect(asset.load(base + '../Utils/oLib.js', 'js')).not.toBeFalsy();

View File

@ -1,12 +0,0 @@
describe('AuthTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('AutoloaderTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('AreaChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('BarChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('BoxplotChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('CalendarChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('CandlestickChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('ChartLegendTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('ColumnChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('DiffAreaChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('DonutChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('FillGougeChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('GanttChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('GougeChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('GroupedBarChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('GroupedColumnChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('LineChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('OhlcChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('PieChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('PositionEnumTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('PositionTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
}

View File

@ -1,12 +0,0 @@
describe('PyramidChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('RadarChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('ScatterplotChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('StackedAreaChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('StackedBarChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('StackedColumnChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('TextElementTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('TreeChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('VWaterfallChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('WaterfallChartTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,99 +0,0 @@
<html>
<head>
<style>
svg {
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
}
svg .axis {
font-size: 12px;
}
svg .title {
font-size: 25px;
}
svg .subtitle {
font-size: 12px;
}
svg .footer {
font-size: 12px;
}
svg .axis path,
svg .axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
svg .line {
fill: none;
stroke: steelblue;
}
svg .tick > line {
opacity: 1;
}
svg rect.zoom-panel {
cursor: move;
fill: none;
pointer-events: all;
}
svg .dot {
stroke-width: 2px;
fill: #fff;
}
.dataPoint:hover {
cursor: pointer;
}
svg .dataPoint-dot {
stroke-width: 3px;
fill: #fff;
}
svg .dot:hover {
stroke-width: 3px;
fill: #000;
cursor: pointer;
}
.grid .tick {
stroke: lightgrey;
stroke-opacity: 0.7;
shape-rendering: crispEdges;
}
.grid path {
stroke-width: 0;
}
div.tooltip {
color: #fff;
position: absolute;
top: 0;
left: 0;
text-align: left;
padding: 5px;
font: 12px sans-serif;
background: #363636;
border: 0;
border-radius: 3px;
pointer-events: none;
}
</style>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
jsOMS = {};
</script>
<script src="../../../../jsOMS/Chart/Position.js"></script>
<script src="../../../../jsOMS/Chart/Chart.js"></script>
<body>
<div id="chart" style="width: 100%; height: 100%"></div>
<script src="../../../../jsOMS/Chart/ColumnChart.js"></script>

View File

@ -1,95 +0,0 @@
<html>
<head>
<style>
svg .axis {
font-size: 12px;
}
svg .title {
font-size: 25px;
}
svg .subtitle {
font-size: 12px;
}
svg .footer {
font-size: 12px;
}
svg .axis path,
svg .axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
svg .line {
fill: none;
stroke: steelblue;
}
svg .tick > line {
opacity: 1;
}
svg rect.zoom-panel {
cursor: move;
fill: none;
pointer-events: all;
}
svg .dot {
stroke-width: 2px;
fill: #fff;
}
.dataPoint:hover {
cursor: pointer;
}
svg .dataPoint-dot {
stroke-width: 3px;
fill: #fff;
}
svg .dot:hover {
stroke-width: 3px;
fill: #000;
cursor: pointer;
}
.grid .tick {
stroke: lightgrey;
stroke-opacity: 0.7;
shape-rendering: crispEdges;
}
.grid path {
stroke-width: 0;
}
div.tooltip {
color: #fff;
position: absolute;
top: 0;
left: 0;
text-align: left;
padding: 5px;
font: 12px sans;
background: #363636;
border: 0;
border-radius: 3px;
pointer-events: none;
}
</style>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
jsOMS = {};
</script>
<script src="../../../../jsOMS/Chart/Position.js"></script>
<script src="../../../../jsOMS/Chart/Chart.js"></script>
<body>
<div id="chart" style="width: 100%; height: 100%"></div>
<script src="../../../../jsOMS/Chart/LineChart.js"></script>

View File

@ -1,99 +0,0 @@
<html>
<head>
<style>
svg {
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
}
svg .axis {
font-size: 12px;
}
svg .title {
font-size: 25px;
}
svg .subtitle {
font-size: 12px;
}
svg .footer {
font-size: 12px;
}
svg .axis path,
svg .axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
svg .line {
fill: none;
stroke: steelblue;
}
svg .tick > line {
opacity: 1;
}
svg rect.zoom-panel {
cursor: move;
fill: none;
pointer-events: all;
}
svg .dot {
stroke-width: 2px;
fill: #fff;
}
.dataPoint:hover {
cursor: pointer;
}
svg .dataPoint-dot {
stroke-width: 3px;
fill: #fff;
}
svg .dot:hover {
stroke-width: 3px;
fill: #000;
cursor: pointer;
}
.grid .tick {
stroke: lightgrey;
stroke-opacity: 0.7;
shape-rendering: crispEdges;
}
.grid path {
stroke-width: 0;
}
div.tooltip {
color: #fff;
position: absolute;
top: 0;
left: 0;
text-align: left;
padding: 5px;
font-size: 12px;
background: #363636;
border: 0;
border-radius: 3px;
pointer-events: none;
}
</style>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
jsOMS = {};
</script>
<script src="../../../../jsOMS/Chart/Position.js"></script>
<script src="../../../../jsOMS/Chart/Chart.js"></script>
<body>
<div id="chart" style="width: 100%; height: 100%"></div>
<script src="../../../../jsOMS/Chart/PieChart.js"></script>

View File

@ -1,95 +0,0 @@
<html>
<head>
<style>
svg .axis {
font-size: 12px;
}
svg .title {
font-size: 25px;
}
svg .subtitle {
font-size: 12px;
}
svg .footer {
font-size: 12px;
}
svg .axis path,
svg .axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
svg .line {
fill: none;
stroke: steelblue;
}
svg .tick > line {
opacity: 1;
}
svg rect.zoom-panel {
cursor: move;
fill: none;
pointer-events: all;
}
svg .dot {
stroke-width: 2px;
fill: #fff;
}
.dataPoint:hover {
cursor: pointer;
}
svg .dataPoint-dot {
stroke-width: 3px;
fill: #fff;
}
svg .dot:hover {
stroke-width: 3px;
fill: #000;
cursor: pointer;
}
.grid .tick {
stroke: lightgrey;
stroke-opacity: 0.7;
shape-rendering: crispEdges;
}
.grid path {
stroke-width: 0;
}
div.tooltip {
color: #fff;
position: absolute;
top: 0;
left: 0;
text-align: left;
padding: 5px;
font: 12px sans;
background: #363636;
border: 0;
border-radius: 3px;
pointer-events: none;
}
</style>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
jsOMS = {};
</script>
<script src="../../../../jsOMS/Chart/Position.js"></script>
<script src="../../../../jsOMS/Chart/Chart.js"></script>
<body>
<div id="chart" style="width: 100%; height: 100%"></div>
<script src="../../../../jsOMS/Chart/RadarChart.js"></script>

View File

@ -1,4 +1,4 @@
import { Options } from '../Config/Options.js'; import { Options } from '../../Config/Options.js';
describe('OptionsTest', function () describe('OptionsTest', function ()
{ {

View File

@ -1,12 +0,0 @@
describe('CacheManagerTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,4 +1,4 @@
import { LocalStorage } from '../DataStorage/LocalStorage.js'; import { LocalStorage } from '../../DataStorage/LocalStorage.js';
describe('LocalStorageTest', function () describe('LocalStorageTest', function ()
{ {
@ -8,7 +8,11 @@ describe('LocalStorageTest', function ()
{ {
it('Testing default functionality', function () it('Testing default functionality', function ()
{ {
expect(LocalStorage.available()).toBeTruthy(); if (typeof window === 'undefined') {
expect(LocalStorage.available()).toBeFalse();
} else {
expect(LocalStorage.available()).toBeTruthy();
}
}); });
}); });
}); });

View File

@ -1,12 +0,0 @@
describe('StorageManagerTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('DispatcherTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,4 +1,4 @@
import { EventManager } from '../Event/EventManager.js'; import { EventManager } from '../../Event/EventManager.js';
describe('EventManagerTest', function () describe('EventManagerTest', function ()
{ {

View File

@ -4,114 +4,105 @@ describe('LoggerTest', function ()
{ {
'use strict'; 'use strict';
const isVerbose = typeof window !== 'undefined';
describe('testLocalLogging', function () describe('testLocalLogging', function ()
{ {
it('Testing emergency functionality', function () it('Testing emergency functionality', function ()
{ {
spyOn(console, 'log'); let log = new Logger(isVerbose, false, false);
spyOn(log, 'write');
let log = new Logger(true, false, false);
log.emergency(); log.emergency();
expect(console.log).toHaveBeenCalled(); expect(log.write).toHaveBeenCalled();
}); });
it('Testing alert functionality', function () it('Testing alert functionality', function ()
{ {
spyOn(console, 'log'); let log = new Logger(isVerbose, false, false);
spyOn(log, 'write');
let log = new Logger(true, false, false);
log.alert(); log.alert();
expect(console.log).toHaveBeenCalled(); expect(log.write).toHaveBeenCalled();
}); });
it('Testing critical functionality', function () it('Testing critical functionality', function ()
{ {
spyOn(console, 'log'); let log = new Logger(isVerbose, false, false);
spyOn(log, 'write');
let log = new Logger(true, false, false);
log.critical(); log.critical();
expect(console.log).toHaveBeenCalled(); expect(log.write).toHaveBeenCalled();
}); });
it('Testing error functionality', function () it('Testing error functionality', function ()
{ {
spyOn(console, 'log'); let log = new Logger(isVerbose, false, false);
spyOn(log, 'write');
let log = new Logger(true, false, false);
log.error(); log.error();
expect(console.log).toHaveBeenCalled(); expect(log.write).toHaveBeenCalled();
}); });
it('Testing warning functionality', function () it('Testing warning functionality', function ()
{ {
spyOn(console, 'log'); let log = new Logger(isVerbose, false, false);
spyOn(log, 'write');
let log = new Logger(true, false, false);
log.warning(); log.warning();
expect(console.log).toHaveBeenCalled(); expect(log.write).toHaveBeenCalled();
}); });
it('Testing notice functionality', function () it('Testing notice functionality', function ()
{ {
spyOn(console, 'log'); let log = new Logger(isVerbose, false, false);
spyOn(log, 'write');
let log = new Logger(true, false, false);
log.notice(); log.notice();
expect(console.log).toHaveBeenCalled(); expect(log.write).toHaveBeenCalled();
}); });
it('Testing info functionality', function () it('Testing info functionality', function ()
{ {
spyOn(console, 'log'); let log = new Logger(isVerbose, false, false);
spyOn(log, 'write');
let log = new Logger(true, false, false);
log.info(); log.info();
expect(console.log).toHaveBeenCalled(); expect(log.write).toHaveBeenCalled();
}); });
it('Testing debug functionality', function () it('Testing debug functionality', function ()
{ {
spyOn(console, 'log'); let log = new Logger(isVerbose, false, false);
spyOn(log, 'write');
let log = new Logger(true, false, false);
log.debug(); log.debug();
expect(console.log).toHaveBeenCalled(); expect(log.write).toHaveBeenCalled();
}); });
it('Testing log functionality', function () it('Testing log functionality', function ()
{ {
spyOn(console, 'log'); let log = new Logger(isVerbose, false, false);
spyOn(log, 'write');
let log = new Logger(true, false, false);
log.log(); log.log();
expect(console.log).toHaveBeenCalled(); expect(log.write).toHaveBeenCalled();
}); });
it('Testing log functionality', function () it('Testing log functionality', function ()
{ {
spyOn(console, 'log'); let log = new Logger(isVerbose, false, false);
spyOn(log, 'write');
let log = new Logger(true, false, false);
log.log(); log.log();
expect(console.log).toHaveBeenCalled(); expect(log.write).toHaveBeenCalled();
}); });
it('Testing console functionality', function () it('Testing console functionality', function ()
{ {
let log = new Logger(isVerbose, false, false);
spyOn(console, 'log'); spyOn(console, 'log');
let log = new Logger(true, false, false);
log.console(); log.console();
expect(console.log).toHaveBeenCalled(); expect(console.log).toHaveBeenCalled();
}); });
@ -121,109 +112,98 @@ describe('LoggerTest', function ()
{ {
it('Testing emergency functionality', function () it('Testing emergency functionality', function ()
{ {
spyOn(console, 'log');
let log = new Logger(false, false, false); let log = new Logger(false, false, false);
spyOn(log, 'writeVerbose');
log.emergency(); log.emergency();
expect(console.log).not.toHaveBeenCalled(); expect(log.writeVerbose).not.toHaveBeenCalled();
}); });
it('Testing alert functionality', function () it('Testing alert functionality', function ()
{ {
spyOn(console, 'log');
let log = new Logger(false, false, false); let log = new Logger(false, false, false);
spyOn(log, 'writeVerbose');
log.alert(); log.alert();
expect(console.log).not.toHaveBeenCalled(); expect(log.writeVerbose).not.toHaveBeenCalled();
}); });
it('Testing critical functionality', function () it('Testing critical functionality', function ()
{ {
spyOn(console, 'log');
let log = new Logger(false, false, false); let log = new Logger(false, false, false);
spyOn(log, 'writeVerbose');
log.critical(); log.critical();
expect(console.log).not.toHaveBeenCalled(); expect(log.writeVerbose).not.toHaveBeenCalled();
}); });
it('Testing error functionality', function () it('Testing error functionality', function ()
{ {
spyOn(console, 'log');
let log = new Logger(false, false, false); let log = new Logger(false, false, false);
spyOn(log, 'writeVerbose');
log.error(); log.error();
expect(console.log).not.toHaveBeenCalled(); expect(log.writeVerbose).not.toHaveBeenCalled();
}); });
it('Testing warning functionality', function () it('Testing warning functionality', function ()
{ {
spyOn(console, 'log');
let log = new Logger(false, false, false); let log = new Logger(false, false, false);
spyOn(log, 'writeVerbose');
log.warning(); log.warning();
expect(console.log).not.toHaveBeenCalled(); expect(log.writeVerbose).not.toHaveBeenCalled();
}); });
it('Testing notice functionality', function () it('Testing notice functionality', function ()
{ {
spyOn(console, 'log');
let log = new Logger(false, false, false); let log = new Logger(false, false, false);
spyOn(log, 'writeVerbose');
log.notice(); log.notice();
expect(console.log).not.toHaveBeenCalled(); expect(log.writeVerbose).not.toHaveBeenCalled();
}); });
it('Testing info functionality', function () it('Testing info functionality', function ()
{ {
spyOn(console, 'log');
let log = new Logger(false, false, false); let log = new Logger(false, false, false);
spyOn(log, 'writeVerbose');
log.info(); log.info();
expect(console.log).not.toHaveBeenCalled(); expect(log.writeVerbose).not.toHaveBeenCalled();
}); });
it('Testing debug functionality', function () it('Testing debug functionality', function ()
{ {
spyOn(console, 'log');
let log = new Logger(false, false, false); let log = new Logger(false, false, false);
spyOn(log, 'writeVerbose');
log.debug(); log.debug();
expect(console.log).not.toHaveBeenCalled(); expect(log.writeVerbose).not.toHaveBeenCalled();
}); });
it('Testing log functionality', function () it('Testing log functionality', function ()
{ {
spyOn(console, 'log');
let log = new Logger(false, false, false); let log = new Logger(false, false, false);
spyOn(log, 'writeVerbose');
log.log(); log.log();
expect(console.log).not.toHaveBeenCalled(); expect(log.writeVerbose).not.toHaveBeenCalled();
}); });
it('Testing log functionality', function () it('Testing log functionality', function ()
{ {
spyOn(console, 'log');
let log = new Logger(false, false, false); let log = new Logger(false, false, false);
spyOn(log, 'writeVerbose');
log.log(); log.log();
expect(console.log).not.toHaveBeenCalled(); expect(log.writeVerbose).not.toHaveBeenCalled();
}); });
it('Testing console functionality', function () it('Testing console functionality', function ()
{ {
spyOn(console, 'log');
let log = new Logger(false, false, false); let log = new Logger(false, false, false);
spyOn(console, 'log');
log.console(); log.console();
expect(console.log).toHaveBeenCalled(); expect(console.log).toHaveBeenCalled();

View File

@ -1,3 +1,5 @@
import { MathProcessor } from '../../Math/MathProcessor.js';
describe('MathProcessorTest', function () describe('MathProcessorTest', function ()
{ {
'use strict'; 'use strict';
@ -6,10 +8,10 @@ describe('MathProcessorTest', function ()
{ {
it('Testing formula evaluation', function () it('Testing formula evaluation', function ()
{ {
expect(jsOMS.mathEvaluate('3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3 + 1.5')).toBeCloseTo(4.5, 2); expect(MathProcessor.mathEvaluate('3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3 + 1.5')).toBeCloseTo(4.5, 2);
expect(jsOMS.mathEvaluate('3+4*2/(1-5)^2^3+1.5')).toBeCloseTo(4.5, 2); expect(MathProcessor.mathEvaluate('3+4*2/(1-5)^2^3+1.5')).toBeCloseTo(4.5, 2);
expect(jsOMS.mathEvaluate('invalid')).toBe(null); expect(MathProcessor.mathEvaluate('invalid')).toBe(null);
expect(jsOMS.mathEvaluate('3+4*2/(1-5^2^3+1.5')).toBe(null); expect(MathProcessor.mathEvaluate('3+4*2/(1-5^2^3+1.5')).toBe(null);
}); });
}); });
}); });

View File

@ -1,12 +0,0 @@
describe('UISoundTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('CameraRecognitionTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
}

View File

@ -1,4 +1,4 @@
import { NotificationLevel } from '../Message/Notification/NotificationLevel.js'; import { NotificationLevel } from '../../../Message/Notification/NotificationLevel.js';
describe('NotificationLevelTest', function () describe('NotificationLevelTest', function ()
{ {
@ -8,7 +8,7 @@ describe('NotificationLevelTest', function ()
{ {
it('Testing amount of enums', function () it('Testing amount of enums', function ()
{ {
expect(Object.keys(NotificationLevel).length).toBe(4); expect(Object.keys(NotificationLevel).length).toBe(5);
}); });
it('Testing values of enums', function () it('Testing values of enums', function ()

View File

@ -1,4 +1,6 @@
import { NotificationManager } from '../Message/Notification/NotificationManager.js'; import { NotificationManager } from '../../../Message/Notification/NotificationManager.js';
import { AppNotification } from '../../../Message/Notification/App/AppNotification.js';
import { BrowserNotification } from '../../../Message/Notification/Browser/BrowserNotification.js';
describe('NotificationManagerTest', function () describe('NotificationManagerTest', function ()
{ {
@ -10,8 +12,8 @@ describe('NotificationManagerTest', function ()
{ {
let manager = new NotificationManager(); let manager = new NotificationManager();
expect(manager.getAppNotifier()).toEqual(jasmine.any(App.AppNotification)); expect(manager.getAppNotifier()).toEqual(jasmine.any(AppNotification));
expect(manager.getBrowserNotifier()).toEqual(jasmine.any(Browser.BrowserNotification)); expect(manager.getBrowserNotifier()).toEqual(jasmine.any(BrowserNotification));
}); });
}); });
}); });

View File

@ -1,4 +1,4 @@
import { NotificationMessage } from '../Message/Notification/NotificationMessage.js'; import { NotificationMessage } from '../../../Message/Notification/NotificationMessage.js';
describe('NotificationMessageTest', function () describe('NotificationMessageTest', function ()
{ {

View File

@ -1,4 +1,4 @@
import { NotificationType } from '../Message/Notification/NotificationType.js'; import { NotificationType } from '../../../Message/Notification/NotificationType.js';
describe('NotificationTypeTest', function () describe('NotificationTypeTest', function ()
{ {

View File

@ -1,4 +1,4 @@
import { RequestMethod } from '../Message/Request/RequestMethod.js'; import { RequestMethod } from '../../../Message/Request/RequestMethod.js';
describe('RequestMethodTest', function () describe('RequestMethodTest', function ()
{ {

View File

@ -1,13 +0,0 @@
describe('RequestTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,4 +1,4 @@
import { RequestType } from '../Message/Request/RequestType.js'; import { RequestType } from '../../../Message/Request/RequestType.js';
describe('RequestTypeTest', function () describe('RequestTypeTest', function ()
{ {
@ -8,7 +8,7 @@ describe('RequestTypeTest', function ()
{ {
it('Testing amount of enums', function () it('Testing amount of enums', function ()
{ {
expect(Object.keys(RequestType).length).toBe(4); expect(Object.keys(RequestType).length).toBe(5);
}); });
it('Testing values of enums', function () it('Testing values of enums', function ()

View File

@ -1,12 +0,0 @@
describe('ResponseManagerTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('ResponseTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,4 +1,4 @@
import { ResponseType } from '../Message/Response/ResponseType.js'; import { ResponseType } from '../../../Message/Response/ResponseType.js';
describe('ResponseTypeTest', function () describe('ResponseTypeTest', function ()
{ {

View File

@ -1,12 +0,0 @@
describe('ModuleFactoryTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('ModuleManagerTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('RouteTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('Sha1Test', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('Sha1bTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('ClientTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -4,85 +4,23 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Framework Test Suit</title> <title>Framework Test Suit</title>
<link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-3.1.0/jasmine_favicon.png"> <link rel="stylesheet" href="../node_modules/jasmine-core/lib/jasmine-core/jasmine.css">
<link rel="stylesheet" href="jasmine/lib/jasmine-3.1.0/jasmine.css">
<!-- jasmine --> <!-- jasmine -->
<script src="jasmine/lib/jasmine-3.1.0/jasmine.js"></script> <script src="../node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
<script src="jasmine/lib/jasmine-3.1.0/jasmine-html.js"></script> <script src="../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
<script src="jasmine/lib/jasmine-3.1.0/boot.js"></script> <script src="../node_modules/jasmine-core/lib/jasmine-core/boot0.js"></script>
<script src="../node_modules/jasmine-core/lib/jasmine-core/boot1.js"></script>
<!-- include source files here... --> <!-- include general files here... -->
<script src="../Utils/oLib.js" type="module"></script> <script src="../Utils/oLib.js" type="module"></script>
<!-- include source files here... --> <!-- include test files here... -->
<script src="../Asset/AssetManager.js" type="module"></script> <script src="../Uri/HttpUri.js" type="module"></script>
<script src="../Autoloader.js" type="module"></script> <script src="Uri/HttpUriTest.js" type="module"></script>
<script src="../Message/Request/Request.js" type="module"></script>
<script src="../Message/Request/OSType.js" type="module"></script>
<script src="../Message/Request/BrowserType.js" type="module"></script>
<script src="../Message/Request/RequestMethod.js" type="module"></script>
<script src="../Message/Request/RequestType.js" type="module"></script>
<script src="../Log/Logger.js" type="module"></script>
<script src="../Log/LogLevel.js" type="module"></script>
<script src="../Account/Account.js" type="module"></script>
<script src="../Account/AccountManager.js" type="module"></script>
<script src="../Account/AccountType.js" type="module"></script>
<script src="../Config/Options.js" type="module"></script>
<script src="../DataStorage/LocalStorage.js" type="module"></script>
<script src="../Event/EventManager.js" type="module"></script>
<script src="../Math/MathProcessor.js" type="module"></script>
<script src="../Message/Notification/NotificationLevel.js" type="module"></script>
<script src="../Message/Notification/NotificationType.js" type="module"></script>
<script src="../Message/Notification/NotificationMessage.js" type="module"></script>
<script src="../Message/Notification/App/AppNotification.js" type="module"></script>
<script src="../Message/Notification/Browser/BrowserNotification.js" type="module"></script>
<script src="../Message/Notification/NotificationManager.js" type="module"></script>
<script src="../Uri/Http.js" type="module"></script>
<script src="../Uri/UriFactory.js" type="module"></script> <script src="../Uri/UriFactory.js" type="module"></script>
<script src="../Utils/ArrayUtils.js" type="module"></script>
<script src="../Utils/GeneralUtils.js" type="module"></script>
<script src="../Utils/StringUtils.js" type="module"></script>
<!-- include spec files here... -->
<script src="Log/LoggerTest.js" type="module"></script>
<script src="Log/LogLevelTest.js" type="module"></script>
<script src="Asset/AssetManagerTest.js" type="module"></script>
<script src="Account/AccountTest.js" type="module"></script>
<script src="Account/AccountManagerTest.js" type="module"></script>
<script src="Account/AccountTypeTest.js" type="module"></script>
<script src="Config/OptionsTest.js" type="module"></script>
<script src="DataStorage/LocalStorageTest.js" type="module"></script>
<script src="Event/EventManagerTest.js" type="module"></script>
<script src="Math/MathProcessorTest.js" type="module"></script>
<script src="Message/Notification/NotificationLevelTest.js" type="module"></script>
<script src="Message/Notification/NotificationTypeTest.js" type="module"></script>
<script src="Message/Notification/NotificationMessageTest.js" type="module"></script>
<script src="Message/Notification/NotificationManagerTest.js" type="module"></script>
<script src="Message/Request/BrowserTypeTest.js" type="module"></script>
<script src="Message/Request/OSTypeTest.js" type="module"></script>
<script src="Message/Request/RequestMethodTest.js" type="module"></script>
<script src="Message/Request/RequestTypeTest.js" type="module"></script>
<script src="Message/Response/ResponseTypeTest.js" type="module"></script>
<script src="Uri/HttpTest.js" type="module"></script>
<script src="Uri/UriFactoryTest.js" type="module"></script> <script src="Uri/UriFactoryTest.js" type="module"></script>
<script src="Utils/ArrayUtilsTest.js" type="module"></script>
<script src="Utils/GeneralUtilsTest.js" type="module"></script>
<script src="Utils/StringUtilsTest.js" type="module"></script>
</head> </head>
<body> <body>
</body> </body>

View File

@ -1,12 +0,0 @@
describe('CellTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('FormattingTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

View File

@ -1,12 +0,0 @@
describe('FunctionsTest', function ()
{
'use strict';
beforeEach(function ()
{
});
afterEach(function ()
{
});
});

Some files were not shown because too many files have changed in this diff Show More