Allow Empty value #106
Conversation
…ate validator logic
There was a problem hiding this comment.
Pull request overview
Adjusts UmbNav property editor validation so an empty menu is only treated as invalid when the property is marked mandatory in the Document Type (fixes #104).
Changes:
- Gate the
valueMissingvalidator behind a newmandatoryflag. - Add a
mandatory?: booleanproperty to the property editor UI element.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| this.addValidator( | ||
| 'valueMissing', | ||
| () => this.localize.term('umbnav_requiredMessage'), | ||
| () => !this.value || this.value.length === 0 | ||
| () => this.mandatory === true && (!this.value || this.value.length === 0) | ||
| ); |
There was a problem hiding this comment.
The required-field behavior is now conditional on mandatory, but there are no Playwright tests asserting (1) optional UmbNav properties allow saving with an empty value and (2) mandatory UmbNav properties still block saving when empty. Adding an e2e test (or extending an existing one) for these two scenarios would prevent regressions and confirm the mandatory flag is being provided by the backoffice host as expected.
Only validate when the property has been marked as mandatory in the doctype
Fixed #104