Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,12 @@
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.12.1</version>
<version>1.15.0</version>
<!-- Use the latest released version:
https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
<configuration>
<nodeVersion>v16.13.1</nodeVersion>
<npmVersion>8.1.2</npmVersion>
<nodeVersion>v24.12.0</nodeVersion>
<npmVersion>11.6.2</npmVersion>
<installDirectory>./target/node</installDirectory>
<workingDirectory>src/client</workingDirectory>
</configuration>
Expand Down
341 changes: 208 additions & 133 deletions api/src/client/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion api/src/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"html-webpack-plugin": "^5.5.1",
"jsdom": "^21.1.1",
"jsdom-global": "^3.0.2",
"jsf.js_next_gen": "4.0.5-beta.2",
"jsf.js_next_gen": "4.0.5-beta.6",
"mocha": "^10.8.2",
"npm-check-updates": "^19.3.2",
"nyc": "^15.1.0",
Expand Down
60 changes: 30 additions & 30 deletions api/src/client/typescript/faces/impl/AjaxImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,48 +109,48 @@ enum BlockFilter {
* however a dedicated api makes sense for readability reasons
*/
export module Implementation {
/*
Small internal explanation, this code is optimized for readability
and cuts off a ton of old legacy code.
Aka older browsers are not supported anymore.
We use a self written helper library to keep the number of external
code dependencies down.
The library is called mona-dish and started as a small sideproject of mine
it provides following
/*
Small internal explanation, this code is optimized for readability
and cuts off a ton of old legacy code.
Aka older browsers are not supported anymore.
We use a self written helper library to keep the number of external
code dependencies down.
The library is called mona-dish and started as a small sideproject of mine
it provides following

a) Monad like structures for querying because this keeps the code denser and adds abstractions
that always was the strong point of jQuery, and it still is better in this regard than what ecmascript provides
a) Monad like structures for querying because this keeps the code denser and adds abstractions
that always was the strong point of jQuery, and it still is better in this regard than what ecmascript provides

c) A neutral json like configuration which allows assignments of arbitrary values with reduce code which then can be
transformed into different data representations
c) A neutral json like configuration which allows assignments of arbitrary values with reduce code which then can be
transformed into different data representations

examples:
internalCtx.assign(MYPARAM, CTX_PARAM_SRC_FRM_ID).value = form.id.value;
passes a value into context.MYPARAM.CTX_PARAM_SRC_FRM_ID
examples:
internalCtx.assign(MYPARAM, CTX_PARAM_SRC_FRM_ID).value = form.id.value;
passes a value into context.MYPARAM.CTX_PARAM_SRC_FRM_ID

basically an abbreviation for
basically an abbreviation for

internalCtxt[MYPARAM] = internalCtxt?.[MYPARAM] ? internalCtxt[MYPARAM] : {};
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = internalCtxt?.[MYPARAM][CTX_PARAM_SRC_FRM_ID] ? internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] : {};
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = form.id.value;
internalCtxt[MYPARAM] = internalCtxt?.[MYPARAM] ? internalCtxt[MYPARAM] : {};
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = internalCtxt?.[MYPARAM][CTX_PARAM_SRC_FRM_ID] ? internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] : {};
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = form.id.value;


internalCtx.assign(condition, MYPARAM, CTX_PARAM_SRC_FRM_ID).value = form.id.value;
passes a value into context.MYPARAM.CTX_PARAM_SRC_FRM_ID if condition === true otherwise it is ignored
internalCtx.assign(condition, MYPARAM, CTX_PARAM_SRC_FRM_ID).value = form.id.value;
passes a value into context.MYPARAM.CTX_PARAM_SRC_FRM_ID if condition === true otherwise it is ignored

abbreviates:
if(condition) {
internalCtxt[MYPARAM] = internalCtxt?.[MYPARAM] ? internalCtxt[MYPARAM] : {};
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = internalCtxt?.[MYPARAM][CTX_PARAM_SRC_FRM_ID] ? internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] : {};
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = form.id.value;
}
abbreviates:
if(condition) {
internalCtxt[MYPARAM] = internalCtxt?.[MYPARAM] ? internalCtxt[MYPARAM] : {};
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = internalCtxt?.[MYPARAM][CTX_PARAM_SRC_FRM_ID] ? internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] : {};
internalCtxt[MYPARAM][CTX_PARAM_SRC_FRM_ID] = form.id.value;
}


d) Optional constructs, while under heavy debate we only use them lightly where the api requires it from mona-dish
d) Optional constructs, while under heavy debate we only use them lightly where the api requires it from mona-dish

Note the inclusion of this library uses a reduced build which only includes the part of it, which we really use
Note the inclusion of this library uses a reduced build which only includes the part of it, which we really use

*/
*/

const trim = Lang.trim;
const getMessage = ExtLang.getMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';
import { Lang } from "mona-dish";
import pkg from 'mona-dish';
const { Lang } = pkg;

const jsdom = require("jsdom");
import jsdom from "jsdom";
const { JSDOM } = jsdom;

const dom = new JSDOM(`
<!DOCTYPE html>
<html lang="en">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import { expect } from 'chai';
import { describe, it } from 'mocha';
import { Config, Optional } from "mona-dish";
import pkg from 'mona-dish';
const { Config, Optional } = pkg;

//TODO saveResolveTest
describe('optional tests', () => {
it('fromnullable null', () => {
expect(Optional.fromNullable(null).isPresent()).to.be.false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ describe('Tests on the xhr core when it starts to call the request', function ()
button.addEventListener("click", (event: Event) => {
faces.ajax.request(event.target, event, {render: '@all', execute: '@form'})
}).click();
//this.response("ok");

expect(this.requests.length).to.eq(1);
let request = this.requests[0];
Expand Down Expand Up @@ -113,7 +112,6 @@ describe('Tests on the xhr core when it starts to call the request', function ()
button.addEventListener("click", (event: Event) => {
faces.ajax.request(event.target, event, {render: '@all', execute: 'input_1 fíleupload'})
}).click();
//this.response("ok");

expect(this.requests.length).to.eq(1);
let request = this.requests[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe('Tests for the MyFaces specific oam submit', function () {
return false;
};
try {
myfaces.oam.submitForm("blarg", "bla");
myfaces.oam.submitForm("blarg", "bla");
} catch(e) {
done(e);
}
Expand Down
32 changes: 15 additions & 17 deletions api/src/client/typescript/faces/test/xhrCore/ResponseTest23.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ describe('Tests of the various aspects of the response protocol functionality',
(global as any)["MF_23"] = true;
// language=XML
this.respond(`<?xml version="1.0" encoding="UTF-8"?>
<partial-response id="j_id__v_0">
<changes>
<update id="updatePanel"><![CDATA[<span id="updatePanel">hello world</span>]]></update>
<update id="j_id__v_0:javax.faces.ViewState:1"><![CDATA[RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD]]></update>
</changes>
</partial-response>`);
<partial-response id="j_id__v_0">
<changes>
<update id="updatePanel"><![CDATA[<span id="updatePanel">hello world</span>]]></update>
<update id="j_id__v_0:javax.faces.ViewState:1"><![CDATA[RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD]]></update>
</changes>
</partial-response>`);


expect(DQ$("[name*='javax.faces.ViewState']").isAbsent()).to.be.false;
Expand Down Expand Up @@ -283,14 +283,14 @@ describe('Tests of the various aspects of the response protocol functionality',

// language=XML
this.respond(`<?xml version="1.0" encoding="UTF-8"?>
<partial-response id="j_id__v_0">
<changes>
<update id="updatePanel"><![CDATA[<span id="updatePanel">hello world</span>]]></update>
<update id="j_id__v_0:javax.faces.ViewState:1"><![CDATA[RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD]]><!--
<partial-response id="j_id__v_0">
<changes>
<update id="updatePanel"><![CDATA[<span id="updatePanel">hello world</span>]]></update>
<update id="j_id__v_0:javax.faces.ViewState:1"><![CDATA[RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD]]><!--
Some random junk which is sent by the server
--></update>
</changes>
</partial-response>`);
</changes>
</partial-response>`);


expect(DQ$("[name*='javax.faces.ViewState']").isAbsent()).to.be.false;
Expand Down Expand Up @@ -378,9 +378,9 @@ describe('Tests of the various aspects of the response protocol functionality',
expect(DQ.querySelectorAll("body tobago-page tobago-sheet > style").nonce.value).to.be.eq("nonceValue");
});


it("must pass named params properly (tobago testcase)", function(done) {
window.document.body.innerHTML = HTML_PREFIX_EMBEDDED_BODY;
window.document.body.innerHTML = HTML_PREFIX_EMBEDDED_BODY;
try {

let event = {
Expand All @@ -407,9 +407,7 @@ describe('Tests of the various aspects of the response protocol functionality',
expect(requestBody.indexOf("javax.faces.behavior.event")).to.not.eq(-1);
expect(requestBody.indexOf("javax.faces.behavior.event=change")).to.not.eq(-1);
expect(requestBody.indexOf("page%3Ainput=input_value")).to.not.eq(-1);
done();
done();

});


});
2 changes: 1 addition & 1 deletion api/src/client/typescript/mona_dish/Lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {Es2019Array} from "./Es2019Array";
* Lang helpers crossported from the apache myfaces project
*/
export module Lang {


//should be in lang, but for now here to avoid recursive imports, not sure if typescript still has a problem with those
/**
Expand Down
27 changes: 27 additions & 0 deletions api/src/client/typescript/mona_dish/index_esm_compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*!
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Compatibility wrapper that provides a default export of the full namespace.
* Used by the tsconfig paths alias so that `import pkg from 'mona-dish'`
* works in tests and consumer projects that import from source, mirroring
* the behaviour of the built UMD bundle with esModuleInterop enabled.
*/
import * as allExports from "./index";

export * from "./index";
export default allExports;
Loading