Skip to content

Commit

Permalink
Add validation in test showOnSubmit
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco A. Nina Mena authored and ryancooley committed Nov 3, 2023
1 parent 8b77807 commit a9dd93e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/mixins/extensions/ValidationRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export default {
return check.str;
},
fieldValidationShow (element) {
console.log('fieldValidationShow', element.config.name, element.config, element.config.validation);
let showError = true;
if (element.config && element.config.validation) {
const validationHidden = ['Required', 'Required if'];
Expand Down
17 changes: 15 additions & 2 deletions tests/e2e/specs/ValidationShownOnSubmit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ describe('Validation Rules', () => {
it('Invalid default values', () => {
cy.loadFromJson('validation_rules.json', 0);
cy.get('[data-cy=mode-preview]').click();

cy.shouldNotHaveValidationErrors('screen-field-form_input_1');

cy.shouldHaveValidationErrors('screen-field-form_checkbox_1');
cy.shouldHaveValidationErrors('screen-field-form_input_1');
cy.shouldHaveValidationErrors('screen-field-form_input_2');
cy.shouldNotHaveValidationErrors('screen-field-form_input_3');
cy.shouldHaveValidationErrors('screen-field-form_input_4');
cy.shouldNotHaveValidationErrors('screen-field-form_input_5');
cy.shouldNotHaveValidationErrors('screen-field-form_input_6');

cy.get('[data-cy=preview-content] .page button').click();

Expand All @@ -19,6 +25,13 @@ describe('Validation Rules', () => {
cy.get('[data-cy=preview-content] [data-cy="screen-field-form_input_1"]')
.clear()
.type('on');

cy.shouldHaveValidationErrors('screen-field-form_checkbox_1');
cy.shouldNotHaveValidationErrors('screen-field-form_input_1');
cy.shouldHaveValidationErrors('screen-field-form_input_2');
cy.shouldNotHaveValidationErrors('screen-field-form_input_3');
cy.shouldHaveValidationErrors('screen-field-form_input_4');
cy.shouldNotHaveValidationErrors('screen-field-form_input_5');
cy.shouldNotHaveValidationErrors('screen-field-form_input_6');
});
});

0 comments on commit a9dd93e

Please sign in to comment.