-
-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(schema-formio): support custom label on nested form
- Loading branch information
Showing
5 changed files
with
268 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
188 changes: 188 additions & 0 deletions
188
.../third-parties/schema-formio/test/__snapshots__/deep-nested-form.integration.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Deep Nested form integration should generate form and nested form 1`] = ` | ||
Object { | ||
"access": Array [], | ||
"components": Array [ | ||
Object { | ||
"components": Array [ | ||
Object { | ||
"collapsible": false, | ||
"components": Array [ | ||
Object { | ||
"components": Array [ | ||
Object { | ||
"collapsible": false, | ||
"components": Array [ | ||
Object { | ||
"defaultValue": true, | ||
"disabled": false, | ||
"input": true, | ||
"key": "deliverNotifications", | ||
"label": "Remind subscribers", | ||
"type": "checkbox", | ||
"validate": Object { | ||
"required": false, | ||
}, | ||
}, | ||
], | ||
"disabled": false, | ||
"input": false, | ||
"key": "panel", | ||
"label": "One hour before this maintenance", | ||
"tableView": false, | ||
}, | ||
], | ||
"disabled": false, | ||
"display": "form", | ||
"input": true, | ||
"key": "oneHourBefore", | ||
"tableView": false, | ||
"type": "form", | ||
"validate": Object { | ||
"required": false, | ||
}, | ||
}, | ||
Object { | ||
"components": Array [ | ||
Object { | ||
"collapsible": false, | ||
"components": Array [ | ||
Object { | ||
"defaultValue": true, | ||
"disabled": false, | ||
"input": true, | ||
"key": "updateStatus", | ||
"label": "Set status to 'In Progress'", | ||
"type": "checkbox", | ||
"validate": Object { | ||
"required": false, | ||
}, | ||
}, | ||
Object { | ||
"defaultValue": true, | ||
"disabled": false, | ||
"input": true, | ||
"key": "setComponentStatus", | ||
"label": "Set affected components' status to 'Under Maintenance'", | ||
"type": "checkbox", | ||
"validate": Object { | ||
"required": false, | ||
}, | ||
}, | ||
Object { | ||
"defaultValue": true, | ||
"disabled": false, | ||
"input": true, | ||
"key": "deliverNotifications", | ||
"label": "Notify subscribers", | ||
"type": "checkbox", | ||
"validate": Object { | ||
"required": false, | ||
}, | ||
}, | ||
], | ||
"disabled": false, | ||
"input": false, | ||
"key": "panel", | ||
"label": "At the start time for this maintenance", | ||
"tableView": false, | ||
}, | ||
], | ||
"disabled": false, | ||
"display": "form", | ||
"input": true, | ||
"key": "atStartTime", | ||
"tableView": false, | ||
"type": "form", | ||
"validate": Object { | ||
"required": false, | ||
}, | ||
}, | ||
Object { | ||
"components": Array [ | ||
Object { | ||
"collapsible": false, | ||
"components": Array [ | ||
Object { | ||
"defaultValue": true, | ||
"disabled": false, | ||
"input": true, | ||
"key": "updateStatus", | ||
"label": "Set status to 'Completed'", | ||
"type": "checkbox", | ||
"validate": Object { | ||
"required": false, | ||
}, | ||
}, | ||
Object { | ||
"defaultValue": true, | ||
"disabled": false, | ||
"input": true, | ||
"key": "setComponentStatus", | ||
"label": "Set affected components' status to 'Under Maintenance'", | ||
"type": "checkbox", | ||
"validate": Object { | ||
"required": false, | ||
}, | ||
}, | ||
Object { | ||
"defaultValue": true, | ||
"disabled": false, | ||
"input": true, | ||
"key": "deliverNotifications", | ||
"label": "Notify subscribers", | ||
"type": "checkbox", | ||
"validate": Object { | ||
"required": false, | ||
}, | ||
}, | ||
], | ||
"disabled": false, | ||
"input": false, | ||
"key": "panel", | ||
"label": "At the end of time for this maintenance", | ||
"tableView": false, | ||
}, | ||
], | ||
"disabled": false, | ||
"display": "form", | ||
"input": true, | ||
"key": "atEndTime", | ||
"tableView": false, | ||
"type": "form", | ||
"validate": Object { | ||
"required": false, | ||
}, | ||
}, | ||
], | ||
"disabled": false, | ||
"input": false, | ||
"key": "panel", | ||
"label": "Automation options test", | ||
"tableView": false, | ||
}, | ||
], | ||
"disabled": false, | ||
"display": "form", | ||
"input": true, | ||
"key": "automationOptions", | ||
"tableView": false, | ||
"type": "form", | ||
"validate": Object { | ||
"required": false, | ||
}, | ||
}, | ||
], | ||
"display": "form", | ||
"included": Object { | ||
"components": "/components", | ||
}, | ||
"machineName": "scheduled-maintenance", | ||
"name": "scheduled-maintenance", | ||
"submissionAccess": Array [], | ||
"tags": Array [], | ||
"title": "ScheduledMaintenance", | ||
"type": "form", | ||
} | ||
`; |
69 changes: 69 additions & 0 deletions
69
packages/third-parties/schema-formio/test/deep-nested-form.integration.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import {Default, Property} from "@tsed/schema"; | ||
import {Form, getFormioSchema, Label} from "../src"; | ||
|
||
@Form({label: "One hour before this maintenance"}) | ||
export class AutomationOneHourBefore { | ||
@Label("Remind subscribers") | ||
@Default(true) | ||
deliverNotifications: boolean = true; | ||
} | ||
|
||
@Form({label: "At the start time for this maintenance"}) | ||
export class AutomationAtStartTime { | ||
@Label("Set status to 'In Progress'") | ||
@Default(true) | ||
updateStatus: boolean = true; | ||
|
||
@Label("Set affected components' status to 'Under Maintenance'") | ||
@Default(true) | ||
setComponentStatus: boolean = true; | ||
|
||
@Label("Notify subscribers") | ||
@Default(true) | ||
deliverNotifications: boolean = true; | ||
} | ||
|
||
@Label("At the end of time for this maintenance") | ||
export class AutomationAtEndTime { | ||
@Label("Set status to 'Completed'") | ||
@Default(true) | ||
updateStatus: boolean = true; | ||
|
||
@Label("Set affected components' status to 'Under Maintenance'") | ||
@Default(true) | ||
setComponentStatus: boolean = true; | ||
|
||
@Label("Notify subscribers") | ||
@Default(true) | ||
deliverNotifications: boolean = true; | ||
} | ||
|
||
@Label("Automation options test") | ||
export class AutomationOptions { | ||
@Property() | ||
oneHourBefore: AutomationOneHourBefore; | ||
|
||
@Property() | ||
atStartTime: AutomationAtStartTime; | ||
|
||
@Property() | ||
atEndTime: AutomationAtEndTime; | ||
} | ||
|
||
@Form({ | ||
included: { | ||
components: `/components` | ||
} | ||
}) | ||
export class ScheduledMaintenance { | ||
@Property() | ||
automationOptions: AutomationOptions; | ||
} | ||
|
||
describe("Deep Nested form integration", () => { | ||
it("should generate form and nested form", async () => { | ||
const form = await getFormioSchema(ScheduledMaintenance); | ||
|
||
expect(form).toMatchSnapshot(); | ||
}); | ||
}); |