Skip to content

Commit

Permalink
Merge branch 'v2' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
mguellsegarra committed Sep 6, 2024
2 parents 67816d9 + 987214b commit a91d9ce
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gisce/ooui",
"version": "2.10.0-alpha.3",
"version": "2.10.0",
"engines": {
"node": "20.5.0"
},
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/attributeParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ const evaluateFieldComparison = ({
valueInObject === undefined &&
fields[fieldName].type !== "boolean" &&
fields[fieldName].type !== "many2one" &&
fields[fieldName].type !== "selection"
fields[fieldName].type !== "selection" &&
typeof expectedValue !== "boolean"
) {
return {
modifiedValueInObject: null,
Expand Down
23 changes: 23 additions & 0 deletions src/spec/Form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5773,4 +5773,27 @@ describe("A Form", () => {
expect(form.contextForFields.street).toBeDefined();
expect(form.contextForFields.street).toEqual({ active_test: false });
});
it("Should be able to parse attributes with an undefined char value and exist condition in attrs", () => {
const arch = `<form><group><alert colspan="4" name="alert1" alert_type="warning" title="Atenci&#243;n" text="Debes introducir un CUPS para iniciar tu oferta correctamente" attrs="{'invisible': [('cups', '!=', False)]}" json_attrs="{&quot;invisible&quot;: {&quot;rules&quot;: [{&quot;operator&quot;: &quot;!=&quot;, &quot;field&quot;: &quot;cups&quot;, &quot;value&quot;: false}], &quot;condition&quot;: &quot;AND&quot;}}"/>
<alert colspan="2" name="alert2" alert_type="info" title="Atenci&#243;n" text="alert2" attrs="{'invisible': [('cups', '=', False)]}" json_attrs="{&quot;invisible&quot;: {&quot;rules&quot;: [{&quot;operator&quot;: &quot;=&quot;, &quot;field&quot;: &quot;cups&quot;, &quot;value&quot;: false}], &quot;condition&quot;: &quot;AND&quot;}}"/>
</group><input type="char" name="cups" /></form>`;
const fields = {
cups: {
is_function: false,
size: 22,
string: "CUPS (*)",
type: "char",
views: {},
},
};
const form = new Form(fields);
form.parse(arch, { values: { cups: undefined } });
expect(form.type).toBe("form");
const alert1 = form.findById("alert1")!;
const alert2 = form.findById("alert2")!;
expect(alert1).toBeDefined();
expect(alert2).toBeDefined();
expect(alert1.invisible).toBeFalsy();
expect(alert2.invisible).toBeTruthy();
});
});

0 comments on commit a91d9ce

Please sign in to comment.