Skip to content

Commit

Permalink
Fixed bug on change group value (#944)
Browse files Browse the repository at this point in the history
* test #923

* fix

* chlog

* allow npm publish from branch
  • Loading branch information
ukrbublik committed Jul 6, 2023
1 parent 13f8898 commit 890bffe
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: master
- uses: pnpm/action-setup@v2
with:
version: 7
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- 2nd parameter of `onChange` callback now equals original config, not extended config (PR #866) (issue #364)
- Fix totalQuery structure in mongodb (PR #916) (issue #915)
- Fixed bug in `loadTree()` (PR #917) (issue #356)
- Fixed bug on change group value (PR #944) (issue #923)
- 6.2.0
- Fixed type `Config`: should have render settings like `renderSize` (PR #909) (issue #879)
- Fixed type for `renderBeforeWidget`: `RuleProps` instead of wrong `FieldProps` (PR #909) (issue #879)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/modules/utils/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ const validateNormalValue = (leftField, field, value, valueSrc, valueType, async
const wType = wConfig.type;
const jsType = wConfig.jsType;
const fieldSettings = fieldConfig.fieldSettings;
const listValues = fieldSettings.treeValues || fieldSettings.listValues;
const listValues = fieldSettings?.treeValues || fieldSettings?.listValues;

if (valueType && valueType != wType)
return [`Value should have type ${wType}, but got value of type ${valueType}`, value];
Expand Down
17 changes: 17 additions & 0 deletions packages/tests/specs/InteractionsVanilla.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,21 @@ describe("interactions on vanilla", () => {
});
});

it("change group operator", async () => {
await with_qb(configs.with_group_array_cars, inits.with_group_array_cars, "JsonLogic", (qb, onChange) => {
qb
.find(".rule_group_ext .group--field--count--rule .rule--value .widget--widget input")
.simulate("change", { target: { value: 4 } });
const changedTree = getTree(onChange.getCall(0).args[0]);
const childKeys = Object.keys(changedTree.children1);
expect(childKeys.length).to.equal(1);
const child = changedTree.children1[childKeys[0]];
expect(child.properties.field).to.equal("cars");
expect(child.properties.operator).to.equal("greater");
expect(child.properties.conjunction).to.equal("AND");
expect(child.properties.value).to.eql([4]);
});
});

});

3 comments on commit 890bffe

@vercel
Copy link

@vercel vercel bot commented on 890bffe Jul 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 890bffe Jul 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 890bffe Jul 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.