Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Fix #115: Custom validation closure does not exist and is bypassed #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dvuckovic
Copy link

It looks like the instance property responsible for collection of custom closures in the Validation class is not properly initialized.

The customClosures property defaults to an empty object {} that is never populated in the constructor.

On the other hand, an erroneous validationClosures property is initialized, but is never read from.

The fix is to initialize customClosures object properly, and custom validators will suddenly start working:

     constructor(valueContainer, controls, definedClosures = {}) {
         this.valueContainer = valueContainer
-        this.validationClosures = definedClosures
+        this.customClosures = definedClosures
         this.setRules(controls)
     }

@@ -26,7 +26,7 @@ export default class Validation {
*/
constructor(valueContainer, controls, definedClosures = {}) {
this.valueContainer = valueContainer
this.validationClosures = definedClosures
this.customClosures = definedClosures
Copy link

Choose a reason for hiding this comment

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

Class properties must be methods. Expected '(' but instead saw '.'.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant