diff --git a/.php_cs b/.php_cs index 222f843..ae03cc3 100644 --- a/.php_cs +++ b/.php_cs @@ -1,31 +1,10 @@ in(__DIR__ . '/src') + ->in(__DIR__ . '/tests') ; return Symfony\CS\Config\Config::create() - ->fixers(array( - 'encoding', - 'linefeed', - 'indentation', - 'trailing_spaces', - 'unused_use', - 'visibility', - 'short_tag', - 'php_closing_tag', - 'return', - 'braces', - 'lowercase_constants', - 'lowercase_keywords', - 'include', - 'function_declaration', - 'controls_spaces', - 'spaces_cast', - 'elseif', - 'eof_ending', - 'standardize_not_equal', - 'new_with_braces' - )) + ->level(Symfony\CS\FixerInterface::PSR2_LEVEL) ->finder($finder) ; - diff --git a/src/DependencyInjection/Compiler/ExtensionPass.php b/src/DependencyInjection/Compiler/ExtensionPass.php index 0a4c4bf..0fcb54f 100644 --- a/src/DependencyInjection/Compiler/ExtensionPass.php +++ b/src/DependencyInjection/Compiler/ExtensionPass.php @@ -68,7 +68,6 @@ protected function registerRuleCompilers(ContainerBuilder $container) $container->getDefinition('boekkooi.jquery_validation.rule_compiler')->replaceArgument(0, $references); } - /** * @param ContainerBuilder $container * @return array|null diff --git a/src/Form/Rule.php b/src/Form/Rule.php index 7ca978e..33fc86f 100644 --- a/src/Form/Rule.php +++ b/src/Form/Rule.php @@ -24,16 +24,16 @@ abstract class Rule public $message; /** - * A list of field names that require to be valid before the rule is used - * @var array + * A list rule conditions. + * @var RuleCondition[] */ - public $depends; + public $conditions; - public function __construct($name, $options = null, RuleMessage $message = null, array $depends = array()) + public function __construct($name, $options = null, RuleMessage $message = null, array $conditions = array()) { $this->name = $name; $this->options = $options; $this->message = $message; - $this->depends = $depends; + $this->conditions = $conditions; } } diff --git a/src/Form/Rule/Condition/FieldDependency.php b/src/Form/Rule/Condition/FieldDependency.php new file mode 100644 index 0000000..0da0c30 --- /dev/null +++ b/src/Form/Rule/Condition/FieldDependency.php @@ -0,0 +1,39 @@ + + */ +class FieldDependency implements RuleCondition +{ + const FIELD_VALID = '='; + const FIELD_INVALID = '!'; + + /** + * Dependent field + * @var string + */ + public $field; + + /** + * @var string + */ + public $condition; + + public function __construct($field, $condition = self::FIELD_VALID) + { + $this->field = FormHelper::getFormName($field); + $this->condition = $condition; + } + + /** + * {@inheritdoc} + */ + public function macro() + { + return 'field_dependency'; + } +} diff --git a/src/Form/Rule/ConstraintRule.php b/src/Form/Rule/ConstraintRule.php index 7ff168e..d31983d 100644 --- a/src/Form/Rule/ConstraintRule.php +++ b/src/Form/Rule/ConstraintRule.php @@ -16,9 +16,9 @@ class ConstraintRule extends Rule */ public $groups; - public function __construct($name, $options = null, RuleMessage $message = null, array $groups = array(Constraint::DEFAULT_GROUP), array $depends = array()) + public function __construct($name, $options = null, RuleMessage $message = null, array $groups = array(Constraint::DEFAULT_GROUP), array $conditions = array()) { - parent::__construct($name, $options, $message, $depends); + parent::__construct($name, $options, $message, $conditions); $this->groups = $groups; } diff --git a/src/Form/Rule/Processor/CompoundCopyToChildPass.php b/src/Form/Rule/Processor/CompoundCopyToChildPass.php index 389786e..38db6f3 100644 --- a/src/Form/Rule/Processor/CompoundCopyToChildPass.php +++ b/src/Form/Rule/Processor/CompoundCopyToChildPass.php @@ -4,6 +4,7 @@ use Boekkooi\Bundle\JqueryValidationBundle\Form\FormRuleContextBuilder; use Boekkooi\Bundle\JqueryValidationBundle\Form\FormRuleProcessorContext; use Boekkooi\Bundle\JqueryValidationBundle\Form\FormRuleProcessorInterface; +use Boekkooi\Bundle\JqueryValidationBundle\Form\Rule\Condition\FieldDependency; use Boekkooi\Bundle\JqueryValidationBundle\Form\Rule\ConstraintRule; use Boekkooi\Bundle\JqueryValidationBundle\Form\Rule\Mapping\RequiredRule; use Boekkooi\Bundle\JqueryValidationBundle\Form\RuleCollection; @@ -102,7 +103,7 @@ private function registerRulesForChildren(FormRuleContextBuilder $formRuleContex if ($collection->containsKey($name)) { $childRule = $collection[$name]; $childRule->message = $rule->message; - $childRule->depends = $rule->depends; + $childRule->conditions = $rule->conditions; if ($childRule instanceof ConstraintRule && $rule instanceof ConstraintRule) { $childRule->groups = array_unique( array_merge($childRule->groups, $rule->groups) @@ -114,7 +115,7 @@ private function registerRulesForChildren(FormRuleContextBuilder $formRuleContex $rule = clone $rule; $rule->message = $message; - $rule->depends[] = $childView->vars['full_name']; + $rule->conditions[] = new FieldDependency($childView->vars['full_name']); } } diff --git a/src/Form/Rule/Processor/DateTimeToArrayTransformerPass.php b/src/Form/Rule/Processor/DateTimeToArrayTransformerPass.php index 49651af..ff1f04a 100644 --- a/src/Form/Rule/Processor/DateTimeToArrayTransformerPass.php +++ b/src/Form/Rule/Processor/DateTimeToArrayTransformerPass.php @@ -3,6 +3,7 @@ use Boekkooi\Bundle\JqueryValidationBundle\Form\FormRuleContextBuilder; use Boekkooi\Bundle\JqueryValidationBundle\Form\FormRuleProcessorContext; +use Boekkooi\Bundle\JqueryValidationBundle\Form\Rule\Condition\FieldDependency; use Boekkooi\Bundle\JqueryValidationBundle\Form\Rule\Mapping\MaxRule; use Boekkooi\Bundle\JqueryValidationBundle\Form\Rule\Mapping\MinRule; use Boekkooi\Bundle\JqueryValidationBundle\Form\Rule\Mapping\NumberRule; @@ -10,7 +11,8 @@ use Boekkooi\Bundle\JqueryValidationBundle\Form\RuleCollection; use Boekkooi\Bundle\JqueryValidationBundle\Form\RuleMessage; use Boekkooi\Bundle\JqueryValidationBundle\Form\Rule\TransformerRule; -use Boekkooi\Bundle\JqueryValidationBundle\Form\Util\FormViewRecursiveIterator; +use Boekkooi\Bundle\JqueryValidationBundle\Form\Util\FormHelper; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer; use Symfony\Component\Form\FormView; /** @@ -36,55 +38,58 @@ public function process(FormRuleProcessorContext $context, FormRuleContextBuilde return; } + /** @var \Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer $transformer */ $transformer = $this->findTransformer($formConfig, 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToArrayTransformer'); if ($transformer === null) { return; } $view = $context->getView(); - - /** @var FormView[] $it */ - $it = new \RecursiveIteratorIterator( - new FormViewRecursiveIterator($view->getIterator()), - \RecursiveIteratorIterator::LEAVES_ONLY - ); + $fields = $this->getTransformerFields($transformer); $invalidMessage = $this->getFormRuleMessage($formConfig); - $depends = array(); - foreach ($it as $childView) { + $views = array(); + $conditions = array(); + foreach ($fields as $fieldName) { + $childView = $view->children[$fieldName]; + + // Get child rules collection $childRules = $formRuleContext->get($childView); if ($childRules === null) { $formRuleContext->add($childView, new RuleCollection()); $childRules = $formRuleContext->get($childView); } + // Register rules $this->addNumberCheck( $childView, $childRules, $invalidMessage, - $depends + $conditions ); - $depends[] = $childView->vars['full_name']; + + $views[] = FormHelper::getFormName($childView); + $conditions[] = new FieldDependency($childView); } - if ($this->useGroupRule && count($depends) > 1) { - $rules = $formRuleContext->get(array_shift($depends)); + if ($this->useGroupRule && count($views) > 1) { + $rules = $formRuleContext->get(array_shift($views)); $rules->set( CompoundCopyToChildPass::RULE_NAME_GROUP_REQUIRED, - new TransformerRule(CompoundCopyToChildPass::RULE_NAME_GROUP_REQUIRED, $depends, $invalidMessage) + new TransformerRule(CompoundCopyToChildPass::RULE_NAME_GROUP_REQUIRED, $views, $invalidMessage) ); } } - private function addNumberCheck(FormView $view, RuleCollection $rules, RuleMessage $message = null, array $depends = array()) + private function addNumberCheck(FormView $view, RuleCollection $rules, RuleMessage $message = null, array $conditions = array()) { - if (!$this->useGroupRule && count($depends) > 0) { + if (!$this->useGroupRule && count($conditions) > 0) { $rules->set( RequiredRule::RULE_NAME, new TransformerRule( RequiredRule::RULE_NAME, true, $message, - $depends + $conditions ) ); } @@ -98,7 +103,7 @@ private function addNumberCheck(FormView $view, RuleCollection $rules, RuleMessa NumberRule::RULE_NAME, true, $message, - $depends + $conditions ) ); @@ -125,11 +130,22 @@ private function addNumberCheck(FormView $view, RuleCollection $rules, RuleMessa } $rules->set( MinRule::RULE_NAME, - new TransformerRule(MinRule::RULE_NAME, $min, $message, $depends) + new TransformerRule(MinRule::RULE_NAME, $min, $message, $conditions) ); $rules->set( MaxRule::RULE_NAME, - new TransformerRule(MaxRule::RULE_NAME, $max, $message, $depends) + new TransformerRule(MaxRule::RULE_NAME, $max, $message, $conditions) ); } + + private function getTransformerFields(DateTimeToArrayTransformer $transformer) + { + $property = new \ReflectionProperty( + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToArrayTransformer', + 'fields' + ); + $property->setAccessible(true); + + return $property->getValue($transformer); + } } diff --git a/src/Form/RuleCondition.php b/src/Form/RuleCondition.php new file mode 100644 index 0000000..6c09012 --- /dev/null +++ b/src/Form/RuleCondition.php @@ -0,0 +1,14 @@ + + */ +interface RuleCondition +{ + /** + * Get the twig macro name to call. + * @return string + */ + public function macro(); +} diff --git a/src/Form/RuleMessage.php b/src/Form/RuleMessage.php index 2fb8ee5..2f88632 100644 --- a/src/Form/RuleMessage.php +++ b/src/Form/RuleMessage.php @@ -6,10 +6,21 @@ */ class RuleMessage { + /** + * A message text. + * @var string + */ public $message; + /** + * A list of message parameters. + * @var array + */ public $parameters; + /** + * @var null + */ public $plural; public function __construct($message, array $parameters = array(), $plural = null) diff --git a/src/Resources/views/Form/conditions.js.twig b/src/Resources/views/Form/conditions.js.twig new file mode 100644 index 0000000..af79f11 --- /dev/null +++ b/src/Resources/views/Form/conditions.js.twig @@ -0,0 +1,16 @@ +{% macro field_dependency(condition, rule) %} + {%- set isRequired = rule.name is sameas('required') -%} + + {%- if isRequired -%} + var dep = form.find("[name=\"{{ condition.field|e('js') }}\"]")[0]; + {%- endif -%} + + if ( + {%- if condition.condition is sameas('!') -%}!{%- endif -%} + ( + {%- if isRequired -%} + !$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || {% endif -%} + "{{ condition.field|e('js') }}" in validator.errorMap || "{{ condition.field|e('js') }}" in validator.invalid)) { + return false; + } +{% endmacro %} diff --git a/src/Resources/views/Form/macros.js.twig b/src/Resources/views/Form/macros.js.twig index 53182fa..c814100 100644 --- a/src/Resources/views/Form/macros.js.twig +++ b/src/Resources/views/Form/macros.js.twig @@ -44,12 +44,12 @@ {# Generate a rule #} {% macro rule(rule, includeGroupDeps) %} - {%- import _self as gen -%} + {% import "BoekkooiJqueryValidationBundle:Form:conditions.js.twig" as macro_conditions %} {%- set hasGroups = includeGroupDeps|default(false) and rule.groups|length > 0 -%} - {%- set hasDepends = (rule.depends is not empty) -%} + {%- set hasConditions = (rule.conditions is not empty) -%} - {%- if hasGroups or hasDepends -%} + {%- if hasGroups or hasConditions -%} {%- set hasParams = rule.options is not sameas(true) -%} { @@ -57,33 +57,29 @@ param: {{- rule.options|json_encode()|raw -}}, {%- endif -%} depends: function() { - {%- if hasDepends and rule.name is sameas('required') %} - var dep = form.find("[name=\"{{ rule.depends|e('js')|last }}\"]")[0]; - {% endif %} - - return - {%- if hasGroups %} ( - {%- for group in rule.groups -%} - validator.settings.validation_groups["{{ group|e('js') }}"] {%- if not loop.last %} || {% endif -%} + {%- if hasConditions %} + {%- if hasGroups -%} + if (!( + {%- for group in rule.groups -%} + validator.settings.validation_groups["{{ group|e('js') }}"] {%- if not loop.last %} || {% endif -%} + {%- endfor -%} + )) { + return false; + } + {%- endif -%} + + {%- for condition in rule.conditions -%} + {{ attribute(macro_conditions, condition.macro, [condition, rule]) }} {%- endfor -%} - ) - {%- endif -%} - - {%- if hasGroups and hasDepends %} && {% endif -%} - {%- if hasDepends %} - {% if rule.name is sameas('required') %} - $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && - {% endif %} - - !( - {%- for selector in rule.depends -%} - "{{ selector|e('js') }}" in validator.errorMap || - "{{ selector|e('js') }}" in validator.invalid {%- if not loop.last %} || {% endif -%} - {%- endfor -%} - ) + return true; + {% else %} + return ( + {%- for group in rule.groups -%} + validator.settings.validation_groups["{{ group|e('js') }}"] {%- if not loop.last %} || {% endif -%} + {%- endfor -%} + ); {%- endif -%} - ; } } {%- else -%} diff --git a/tests/Functional/BasicFormTest.php b/tests/Functional/BasicFormTest.php index f1711ee..a598344 100644 --- a/tests/Functional/BasicFormTest.php +++ b/tests/Functional/BasicFormTest.php @@ -379,17 +379,26 @@ public function it_should_render_collection_datetime_row_javascript() "required": { depends: function () { var dep = form.find("[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } }, "min": { param: 1, depends: function () { - return !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid); + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } }, "max": { param: 12, depends: function () { - return !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid); + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } }, "messages": { @@ -401,18 +410,37 @@ public function it_should_render_collection_datetime_row_javascript() form.find("*[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bday\x5D\"]").rules("add", { "required": { depends: function () { + var dep = form.find("[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } var dep = form.find("[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } }, "min": { param: 1, depends: function () { - return !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid); + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } }, "max": { param: 31, depends: function () { - return !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid); + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } }, "messages": { @@ -426,8 +454,22 @@ public function it_should_render_collection_datetime_row_javascript() "max": 23, "required": { depends: function () { + if (!(validator.settings.validation_groups["Default"])) { + return false; + } + var dep = form.find("[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + var dep = form.find("[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } var dep = form.find("[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bday\x5D\"]")[0]; - return (validator.settings.validation_groups["Default"]) && $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.invalid)) { + return false; + } + return true; } }, "messages": { @@ -439,18 +481,39 @@ public function it_should_render_collection_datetime_row_javascript() form.find("*[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bminute\x5D\"]").rules("add", { "required": { depends: function () { + var dep = form.find("[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + var dep = form.find("[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + var dep = form.find("[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bday\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.invalid)) { + return false; + } var dep = form.find("[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.invalid || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } }, "min": { param: 0, depends: function () { - return !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid); + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } }, "max": { param: 59, depends: function () { - return !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid); + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } }, "messages": { @@ -576,35 +639,59 @@ public function it_should_render_date_time_javascript() "required": { depends: function () { var dep = form.find("[name=\"date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "min": { + }, "min": { param: 1, depends: function () { - return !("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid); + if (("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 12, depends: function () { - return !("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid); + if (("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } } }, "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bday\x5D": { "required": { depends: function () { + var dep = form.find("[name=\"date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } var dep = form.find("[name=\"date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "min": { + }, "min": { param: 1, depends: function () { - return !("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid); + if (("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 31, depends: function () { - return !("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid); + if (("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } } }, @@ -613,26 +700,56 @@ public function it_should_render_date_time_javascript() "max": 23, "required": { depends: function () { + var dep = form.find("[name=\"date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + var dep = form.find("[name=\"date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } var dep = form.find("[name=\"date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bday\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.invalid)) { + return false; + } + return true; } } }, "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bminute\x5D": { "required": { depends: function () { + var dep = form.find("[name=\"date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + var dep = form.find("[name=\"date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + var dep = form.find("[name=\"date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bday\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.invalid)) { + return false; + } var dep = form.find("[name=\"date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bday\x5D" in validator.invalid || "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "min": { + }, "min": { param: 0, depends: function () { - return !("date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid); + if (("date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 59, depends: function () { - return !("date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid); + if (("date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } } }, @@ -641,35 +758,59 @@ public function it_should_render_date_time_javascript() "required": { depends: function () { var dep = form.find("[name=\"date_time_form\x5Bdate_choice\x5D\x5Byear\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "min": { + }, "min": { param: 1, depends: function () { - return !("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 12, depends: function () { - return !("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } } }, "date_time_form\x5Bdate_choice\x5D\x5Bday\x5D": { "required": { depends: function () { + var dep = form.find("[name=\"date_time_form\x5Bdate_choice\x5D\x5Byear\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } var dep = form.find("[name=\"date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "min": { + }, "min": { param: 1, depends: function () { - return !("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 31, depends: function () { - return !("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } } }, @@ -678,35 +819,59 @@ public function it_should_render_date_time_javascript() "required": { depends: function () { var dep = form.find("[name=\"date_time_form\x5Bdate_text\x5D\x5Byear\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "min": { + }, "min": { param: 1, depends: function () { - return !("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 12, depends: function () { - return !("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } } }, "date_time_form\x5Bdate_text\x5D\x5Bday\x5D": { "required": { depends: function () { + var dep = form.find("[name=\"date_time_form\x5Bdate_text\x5D\x5Byear\x5D\"]")[0]; + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } var dep = form.find("[name=\"date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "min": { + }, "min": { param: 1, depends: function () { - return !("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 31, depends: function () { - return !("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } } }, @@ -716,17 +881,24 @@ public function it_should_render_date_time_javascript() "required": { depends: function () { var dep = form.find("[name=\"date_time_form\x5Btime_choice\x5D\x5Bhour\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "min": { + }, "min": { param: 0, depends: function () { - return !("date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.invalid); + if (("date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 59, depends: function () { - return !("date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.invalid); + if (("date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } } }, @@ -735,17 +907,24 @@ public function it_should_render_date_time_javascript() "required": { depends: function () { var dep = form.find("[name=\"date_time_form\x5Btime_text\x5D\x5Bhour\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "min": { + }, "min": { param: 0, depends: function () { - return !("date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid); + if (("date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 59, depends: function () { - return !("date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid); + if (("date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } } }, @@ -804,9 +983,7 @@ public function it_should_render_date_time_javascript() "min": "This\x20value\x20is\x20not\x20valid.", "max": "This\x20value\x20is\x20not\x20valid." }, - "date_time_form\x5Bdate_single_text\x5D": { - "required": "This\x20value\x20should\x20not\x20be\x20blank." - }, + "date_time_form\x5Bdate_single_text\x5D": {"required": "This\x20value\x20should\x20not\x20be\x20blank."}, "date_time_form\x5Btime_choice\x5D\x5Bhour\x5D": { "min": "This\x20value\x20is\x20not\x20valid.", "max": "This\x20value\x20is\x20not\x20valid.", @@ -827,9 +1004,7 @@ public function it_should_render_date_time_javascript() "min": "This\x20value\x20is\x20not\x20valid.", "max": "This\x20value\x20is\x20not\x20valid." }, - "date_time_form\x5Btime_single_text\x5D": { - "required": "This\x20value\x20should\x20not\x20be\x20blank." - } + "date_time_form\x5Btime_single_text\x5D": {"required": "This\x20value\x20should\x20not\x20be\x20blank."} } }); })(jQuery);', @@ -865,16 +1040,25 @@ public function it_should_not_render_groups_for_view_transformer_rules_javascrip "required": { depends: function () { var dep = form.find("[name=\"view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D\"]")[0]; - return $.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) && !("view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid); + if ((!$.validator.methods.required.call(validator, validator.elementValue(dep), dep, true) || "view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } }, "min": { param: 0, depends: function () { - return !("view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid); + if (("view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } }, "max": { param: 59, depends: function () { - return !("view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid); + if (("view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } } }, diff --git a/tests/Functional/TotalFormTest.php b/tests/Functional/TotalFormTest.php index b98be20..6f58c4e 100644 --- a/tests/Functional/TotalFormTest.php +++ b/tests/Functional/TotalFormTest.php @@ -66,32 +66,43 @@ public function it_should_render_collection_datetime_row_javascript() "min": { param: 1, depends: function () { - return !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid); + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 12, depends: function () { - return !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid); + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "messages": { - "min": "This\x20value\x20is\x20not\x20valid.", - "max": "This\x20value\x20is\x20not\x20valid." - } + }, "messages": {"min": "This\x20value\x20is\x20not\x20valid.", "max": "This\x20value\x20is\x20not\x20valid."} }); form.find("*[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bday\x5D\"]").rules("add", { "min": { param: 1, depends: function () { - return !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid); + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 31, depends: function () { - return !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid); + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "messages": {"min": "This\x20value\x20is\x20not\x20valid.", "max": "This\x20value\x20is\x20not\x20valid."} + }, "messages": {"min": "This\x20value\x20is\x20not\x20valid.", "max": "This\x20value\x20is\x20not\x20valid."} }); form.find("*[name=\"collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D\"]").rules("add", { "min": 0, @@ -107,18 +118,19 @@ public function it_should_render_collection_datetime_row_javascript() "min": { param: 0, depends: function () { - return !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid); + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 59, depends: function () { - return !("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid); + if (("collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "collection_date_time\x5Btags\x5D\x5B__name__\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "messages": { - "min": "This\x20value\x20is\x20not\x20valid.", - "max": "This\x20value\x20is\x20not\x20valid." - } + }, "messages": {"min": "This\x20value\x20is\x20not\x20valid.", "max": "This\x20value\x20is\x20not\x20valid."} }); })(jQuery);', $javascriptPrototype @@ -148,22 +160,40 @@ public function it_should_render_date_time_javascript() "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D": { "min": { param: 1, depends: function () { - return !("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid); + if (("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } }, "max": { param: 12, depends: function () { - return !("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid); + if (("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } } }, "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bday\x5D": { "min": { param: 1, depends: function () { - return !("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid); + if (("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } }, "max": { param: 31, depends: function () { - return !("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid); + if (("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Bdate\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } } }, @@ -175,12 +205,17 @@ public function it_should_render_date_time_javascript() "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bminute\x5D": { "min": { param: 0, depends: function () { - return !("date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid); + if (("date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 59, depends: function () { - return !("date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid); + if (("date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Bdatetime_choice\x5D\x5Btime\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } } }, @@ -192,24 +227,40 @@ public function it_should_render_date_time_javascript() "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D": { "min": { param: 1, depends: function () { - return !("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 12, depends: function () { - return !("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } } }, "date_time_form\x5Bdate_choice\x5D\x5Bday\x5D": { "min": { param: 1, depends: function () { - return !("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 31, depends: function () { - return !("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_choice\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } } }, @@ -221,24 +272,40 @@ public function it_should_render_date_time_javascript() "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D": { "min": { param: 1, depends: function () { - return !("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 12, depends: function () { - return !("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + return true; } } }, "date_time_form\x5Bdate_text\x5D\x5Bday\x5D": { "min": { param: 1, depends: function () { - return !("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 31, depends: function () { - return !("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.invalid); + if (("date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Byear\x5D" in validator.invalid)) { + return false; + } + if (("date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.errorMap || "date_time_form\x5Bdate_text\x5D\x5Bmonth\x5D" in validator.invalid)) { + return false; + } + return true; } } }, @@ -252,12 +319,17 @@ public function it_should_render_date_time_javascript() "date_time_form\x5Btime_choice\x5D\x5Bminute\x5D": { "min": { param: 0, depends: function () { - return !("date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.invalid); + if (("date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 59, depends: function () { - return !("date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.invalid); + if (("date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_choice\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } } }, @@ -270,12 +342,17 @@ public function it_should_render_date_time_javascript() "date_time_form\x5Btime_text\x5D\x5Bminute\x5D": { "min": { param: 0, depends: function () { - return !("date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid); + if (("date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } - }, - "max": { + }, "max": { param: 59, depends: function () { - return !("date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid); + if (("date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "date_time_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } } }, @@ -391,12 +468,18 @@ public function it_should_not_render_groups_for_view_transformer_rules_javascrip "view_transform_rules_form\x5Btime_text\x5D\x5Bminute\x5D": { "min": { param: 0, depends: function () { - return !("view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid); + if (("view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } }, "max": { param: 59, depends: function () { - return !("view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid); + if (("view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.errorMap || "view_transform_rules_form\x5Btime_text\x5D\x5Bhour\x5D" in validator.invalid)) { + return false; + } + return true; } } },