You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So with the help of @offirgolan it seems the real issue here is a bug in the regex engine.
The basics are a /regex/ with the g modifier doesn't reset correctly, so multiple .test() calls alternate between true and false if everyone should be true, every other calls successfully resets it.
importBaseValidatorfrom'ember-cp-validations/validators/base';importyoutubeRegexfrom'npm:youtube-regex';constYoutubeUrl=BaseValidator.extend({validate(value){constvalid=youtubeRegex().test(value);if(!valid){return'Enter a full YouTube URL';}returntrue;}});
As the twiddle shows it seems like using a custom 'format' validator with this youtube regex only validates every second time (even if valid).
I don't believe the youtube-regex is at fault but I honestly don't know.
Environment
Steps to Reproduce
https://ember-twiddle.com/f310e9371cab8145d85180137bd8992d?openFiles=models.video.js%2C
The text was updated successfully, but these errors were encountered: