Commit 2fa742c0 authored by David Sveningsson's avatar David Sveningsson

fix(schema): allow `permittedContent` and `permittedDescendants` to use AND-syntax

fixes #82
parent 582a7f35
......@@ -209,6 +209,19 @@
{
"type": "string"
},
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/PermittedGroup"
}
]
}
},
{
"$ref": "#/definitions/PermittedGroup"
}
......
import { MetaTable } from "../meta";
describe("permittedContent", () => {
it("should allow string", () => {
expect.assertions(1);
const table = new MetaTable();
expect(() => {
table.loadFromObject({
element: {
permittedContent: ["foo"],
},
});
}).not.toThrow();
});
it("should allow exclude", () => {
expect.assertions(1);
const table = new MetaTable();
expect(() => {
table.loadFromObject({
element: {
permittedContent: [{ exclude: "foo" }],
},
});
}).not.toThrow();
});
it("should allow AND-joined array", () => {
expect.assertions(1);
const table = new MetaTable();
expect(() => {
table.loadFromObject({
element: {
permittedContent: [["foo", { exclude: "bar" }]],
},
});
}).not.toThrow();
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment