more tests and some fixes

This commit is contained in:
Dennis Eichhorn 2024-04-24 03:20:47 +00:00
parent d2e2bf97df
commit 34298dd7c5
8 changed files with 18 additions and 53 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 }}

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

@ -26,7 +26,7 @@ export function domChangeAttribute (action, callback, id)
} }
switch (action.subtype) { switch (action.subtype) {
case 'remove': case 'remove': {
const old = fill[i].getAttribute(action.attr); const old = fill[i].getAttribute(action.attr);
if (old !== null && old.match(new RegExp('(\\s|^)' + action.value + '(\\s|$)')) !== null) { if (old !== null && old.match(new RegExp('(\\s|^)' + action.value + '(\\s|$)')) !== null) {
@ -35,11 +35,12 @@ export function domChangeAttribute (action, callback, id)
fill[i].setAttribute(action.attr, old.replace(reg, '').trim()); fill[i].setAttribute(action.attr, old.replace(reg, '').trim());
} }
break; break;
}
case 'add': case 'add':
fill[i].setAttribute(action.attr, jsOMS.trim(fill[i].getAttribute(action.attr) + ' ' + action.value)) fill[i].setAttribute(action.attr, jsOMS.trim(fill[i].getAttribute(action.attr) + ' ' + action.value));
break; break;
case 'set': case 'set':
fill[i].setAttribute(action.attr, action.value) fill[i].setAttribute(action.attr, action.value);
break; break;
default: default:
} }

View File

@ -1,4 +1,4 @@
import { GeneralUI } from "../../../UI/GeneralUI.js"; import { GeneralUI } from '../../../UI/GeneralUI.js';
/** /**
* Get value from dom. * Get value from dom.

View File

@ -1,4 +1,3 @@
import { jsOMS } from '../../../Utils/oLib.js';
/** /**
* Prevent UI action. * Prevent UI action.
* *
@ -22,7 +21,7 @@ export function ifAction (action, callback, id)
} else if (conditions[i].comp === '!=' && data !== conditions[i].value) { } else if (conditions[i].comp === '!=' && data !== conditions[i].value) {
action.key = conditions[i].jump - 1; action.key = conditions[i].jump - 1;
break; break;
} else if(conditions[i].comp === '>' && data > conditions[i].value) { } else if (conditions[i].comp === '>' && data > conditions[i].value) {
action.key = conditions[i].jump - 1; action.key = conditions[i].jump - 1;
break; break;
} else if (conditions[i].comp === '<' && data < conditions[i].value) { } else if (conditions[i].comp === '<' && data < conditions[i].value) {

View File

@ -1,4 +1,3 @@
import { jsOMS } from '../../../Utils/oLib.js';
/** /**
* Prevent UI action. * Prevent UI action.
* *

View File

@ -1015,7 +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]); // 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?

View File

@ -594,7 +594,7 @@ 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') { } else if (elements[i].tagName.toLowerCase() === 'textarea') {
elements[i].innerHTML = ''; elements[i].innerHTML = '';
} }