mirror of
https://github.com/zhigang1992/react-jsonschema-form.git
synced 2026-04-28 20:25:31 +08:00
* feat: add allOf support
* use patch version of json-schema-merge-allof
* fix: publicPath for netlify builds
* fix typo
* fix: pass around shouldMergeAllOf a bit
* fix: remove shouldMergeAllOf
* fix: resolve allOf when calculating idSchema and pathSchema
* Revert "Fix dependency defaults for uncontrolled components (#1371)"
This reverts commit 6728977b00.
* Revert "Revert "Fix dependency defaults for uncontrolled components (#1371)""
This reverts commit ad2bd6841b9218622a2a4bc92a07f4e8b88ce636.
* test: start writing some basic tests
* add doc on allOf
* add allOf playground sample
* handle merging errors by removing allOf
* add test for nested allOf's
* clarify that allOf keyword is dropped
* don't use merge allof fork
* remove change to package-lock.json
* prettier format
50 lines
1.0 KiB
JavaScript
50 lines
1.0 KiB
JavaScript
import { expect } from "chai";
|
|
|
|
import { createFormComponent, createSandbox } from "./test_utils";
|
|
|
|
describe("allOf", () => {
|
|
let sandbox;
|
|
|
|
beforeEach(() => {
|
|
sandbox = createSandbox();
|
|
});
|
|
|
|
afterEach(() => {
|
|
sandbox.restore();
|
|
});
|
|
|
|
it("should render a regular input element with a single type, when multiple types specified", () => {
|
|
const schema = {
|
|
type: "object",
|
|
properties: {
|
|
foo: {
|
|
allOf: [{ type: ["string", "number", "null"] }, { type: "string" }],
|
|
},
|
|
},
|
|
};
|
|
|
|
const { node } = createFormComponent({
|
|
schema,
|
|
});
|
|
|
|
expect(node.querySelectorAll("input")).to.have.length.of(1);
|
|
});
|
|
|
|
it("should be able to handle incompatible types and not crash", () => {
|
|
const schema = {
|
|
type: "object",
|
|
properties: {
|
|
foo: {
|
|
allOf: [{ type: "string" }, { type: "boolean" }],
|
|
},
|
|
},
|
|
};
|
|
|
|
const { node } = createFormComponent({
|
|
schema,
|
|
});
|
|
|
|
expect(node.querySelectorAll("input")).to.have.length.of(0);
|
|
});
|
|
});
|