From d40e9ae13e863c48f39de3757e8165ceff192aea Mon Sep 17 00:00:00 2001 From: Michal Remis Date: Tue, 28 Apr 2020 15:09:05 +0200 Subject: [PATCH] RemovePlainSimpleForm --- dist/simple-form.bootstrap4.esm.js | 1 - dist/simple-form.bootstrap4.js | 1 - dist/simple-form.esm.js | 37 ---- dist/simple-form.js | 37 ---- src/main.js | 32 ---- .../validateSimpleFormBootstrap4.js | 134 +++++++++++++- .../validateSimpleFormBootstrap4Datetime.js | 170 ------------------ .../validateSimpleFormDateTime.js | 152 ---------------- ...ails.validations.simple_form.bootstrap4.js | 1 - .../rails.validations.simple_form.js | 37 ---- 10 files changed, 130 insertions(+), 472 deletions(-) delete mode 100644 test/javascript/public/test/form_builders/validateSimpleFormBootstrap4Datetime.js delete mode 100644 test/javascript/public/test/form_builders/validateSimpleFormDateTime.js diff --git a/dist/simple-form.bootstrap4.esm.js b/dist/simple-form.bootstrap4.esm.js index 4b28055..5ab3ec9 100644 --- a/dist/simple-form.bootstrap4.esm.js +++ b/dist/simple-form.bootstrap4.esm.js @@ -23,7 +23,6 @@ ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = { wrappers: { "default": { add: function add(element, settings, message) { - alert('bla'); var wrapperElement = element.parent(); var errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback'); diff --git a/dist/simple-form.bootstrap4.js b/dist/simple-form.bootstrap4.js index feaf840..431ad3c 100644 --- a/dist/simple-form.bootstrap4.js +++ b/dist/simple-form.bootstrap4.js @@ -29,7 +29,6 @@ wrappers: { "default": { add: function add(element, settings, message) { - alert('bla'); var wrapperElement = element.parent(); var errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback'); diff --git a/dist/simple-form.esm.js b/dist/simple-form.esm.js index 8a1365d..74ca450 100644 --- a/dist/simple-form.esm.js +++ b/dist/simple-form.esm.js @@ -23,12 +23,6 @@ ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = { wrappers: { "default": { add: function add(element, settings, message) { - console.log(this); - - if (element.is('select') && (element.hasClass('date') || element.hasClass('time'))) { - console.log(this); - } - var wrapper = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/ /g, '.')); var errorElement = wrapper.find(settings.error_tag + '.' + settings.error_class.replace(/ /g, '.')); @@ -49,37 +43,6 @@ ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = { wrapper.removeClass(settings.wrapper_error_class); return errorElement.remove(); } - }, - multi_select: { - add: function add(element, settings, message) { - var wrapperElement = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/ /g, '.')); - var parentElement = element.parent(); - var errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback'); - - if (!errorElement.length) { - errorElement = $('<' + settings.error_tag + '>', { - "class": 'invalid-feedback d-block', - text: message - }); - parentElement.after(errorElement); - } - - wrapperElement.addClass(settings.wrapper_error_class); - element.addClass('is-invalid'); - errorElement.text(message); - }, - remove: function remove(element, settings) { - var wrapperElement = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/ /g, '.')); - var errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback'); - var invalidSiblingExists = element.siblings('.is-invalid').length; - - if (!invalidSiblingExists) { - wrapperElement.removeClass(settings.wrapper_error_class); - errorElement.remove(); - } - - element.removeClass('is-invalid'); - } } } }; diff --git a/dist/simple-form.js b/dist/simple-form.js index 42ad6b1..62decb9 100644 --- a/dist/simple-form.js +++ b/dist/simple-form.js @@ -29,12 +29,6 @@ wrappers: { "default": { add: function add(element, settings, message) { - console.log(this); - - if (element.is('select') && (element.hasClass('date') || element.hasClass('time'))) { - console.log(this); - } - var wrapper = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/ /g, '.')); var errorElement = wrapper.find(settings.error_tag + '.' + settings.error_class.replace(/ /g, '.')); @@ -55,37 +49,6 @@ wrapper.removeClass(settings.wrapper_error_class); return errorElement.remove(); } - }, - multi_select: { - add: function add(element, settings, message) { - var wrapperElement = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/ /g, '.')); - var parentElement = element.parent(); - var errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback'); - - if (!errorElement.length) { - errorElement = $('<' + settings.error_tag + '>', { - "class": 'invalid-feedback d-block', - text: message - }); - parentElement.after(errorElement); - } - - wrapperElement.addClass(settings.wrapper_error_class); - element.addClass('is-invalid'); - errorElement.text(message); - }, - remove: function remove(element, settings) { - var wrapperElement = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/ /g, '.')); - var errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback'); - var invalidSiblingExists = element.siblings('.is-invalid').length; - - if (!invalidSiblingExists) { - wrapperElement.removeClass(settings.wrapper_error_class); - errorElement.remove(); - } - - element.removeClass('is-invalid'); - } } } }; diff --git a/src/main.js b/src/main.js index 8249555..b3e9bf7 100644 --- a/src/main.js +++ b/src/main.js @@ -18,10 +18,6 @@ ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = { wrappers: { default: { add (element, settings, message) { - if (element.is('select') && (element.hasClass('date') || element.hasClass('time'))) { - console.log(this.wrappers.multi_select.add(element, settings, message)) - } - const wrapper = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/ /g, '.')) var errorElement = wrapper.find(settings.error_tag + '.' + settings.error_class.replace(/ /g, '.')) @@ -41,34 +37,6 @@ ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = { wrapper.removeClass(settings.wrapper_error_class) return errorElement.remove() } - }, - multi_select: { - add (element, settings, message) { - const wrapperElement = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/ /g, '.')) - const parentElement = element.parent() - var errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback') - - if (!errorElement.length) { - errorElement = $('<' + settings.error_tag + '>', { class: 'invalid-feedback d-block', text: message }) - parentElement.after(errorElement) - } - - wrapperElement.addClass(settings.wrapper_error_class) - element.addClass('is-invalid') - errorElement.text(message) - }, - remove (element, settings) { - const wrapperElement = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/ /g, '.')) - const errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback') - - const invalidSiblingExists = element.siblings('.is-invalid').length - if (!invalidSiblingExists) { - wrapperElement.removeClass(settings.wrapper_error_class) - errorElement.remove() - } - - element.removeClass('is-invalid') - } } } } diff --git a/test/javascript/public/test/form_builders/validateSimpleFormBootstrap4.js b/test/javascript/public/test/form_builders/validateSimpleFormBootstrap4.js index 753e494..05adb4e 100644 --- a/test/javascript/public/test/form_builders/validateSimpleFormBootstrap4.js +++ b/test/javascript/public/test/form_builders/validateSimpleFormBootstrap4.js @@ -20,7 +20,9 @@ QUnit.module('Validate SimpleForm Bootstrap 4', { }, validators: { 'user[name]': { presence: [{ message: 'must be present' }], format: [{ message: 'is invalid', 'with': { options: 'g', source: '\\d+' } }] }, - 'user[username]': { presence: [{ message: 'must be present' }] } + 'user[username]': { presence: [{ message: 'must be present' }] }, + 'user[date_of_birth]': { presence: [{ message: 'must be present' }] }, + 'user[time_of_birth]': { presence: [{ message: 'must be present' }] } } } @@ -49,8 +51,81 @@ QUnit.module('Validate SimpleForm Bootstrap 4', { .append( $('', { 'class': 'input-group-text', text: '@' }))) .append( - $('', { 'class': 'form-control', name: 'user[username]', id: 'user_username', type: 'text' }))))) - + $('', { 'class': 'form-control', name: 'user[username]', id: 'user_username', type: 'text' })))) + .append($('
', { + class:'form-group date required user_date_of_birth' + }) + .append($('')) + .append($('
', { + class: 'd-flex flex-row justify-content-between align-items-center' + }) + .append($('', { + id: 'user_date_of_birth_2i', + name: 'user[date_of_birth(2i)]', + class: 'form-control mx-1 date required', + 'data-client-side-validations-wrapper': 'vertical_multi_select' + }) + .append($('')) + .append($('')) + .append($(''))) + .append($('') + .append('') + .append('') + .append($('', { + id: 'user_time_of_birth_5i', + name: 'user[time_of_birth(5i)]', + class: 'form-control mx-1 is-invalid time required', + 'data-client-side-validations-wrapper': 'vertical_multi_select' + }) + .append($('')) + .append($('')) + .append($('')) + ) + ) + .append('
Time of birth must be present.
') + .append('Hint: At what time you were born?') + ) + ) $('form#new_user').validate() } }) @@ -99,7 +174,7 @@ for (var i = 0; i < wrappers.length; i++) { assert.ok(input.parent().hasClass('form-group-invalid')) assert.ok(label.parent().hasClass('form-group-invalid')) assert.ok(input.parent().find('div.invalid-feedback:contains("is invalid")').length === 1) - assert.ok(form.find('div.invalid-feedback').length === 1) + assert.ok(input.closest('.form-group').find('div.invalid-feedback').length === 1) }) QUnit.test(wrapper + ' - Validate input-group', function (assert) { @@ -116,4 +191,55 @@ for (var i = 0; i < wrappers.length; i++) { input.trigger('focusout') assert.ok(input.closest('.input-group').find('div.invalid-feedback').length === 0) }) + + QUnit.test(wrapper + ' - Validate date input', function (assert) { + const form = $('form#new_user'); + const select_year = form.find('select#user_date_of_birth_1i') + const select_month = form.find('select#user_date_of_birth_2i') + const select_day = form.find('select#user_date_of_birth_3i') + + form[0].ClientSideValidations.settings.html_settings.wrapper = wrapper + + select_year.trigger('focusout') + select_day.trigger('focusout') + + assert.ok(select_year.closest('.form-group').hasClass('form-group-invalid')) + assert.ok(select_month.closest('.form-group').hasClass('form-group-invalid')) + assert.ok(select_year.closest('.form-group').find('div.invalid-feedback').length === 1) + + select_year.val(2025).trigger('change').trigger('focusout') + + assert.ok(select_year.closest('.form-group').hasClass('form-group-invalid')) + assert.ok(select_year.closest('.form-group').find('div.invalid-feedback').length === 1) + + select_month.val(1).trigger('change').trigger('focusout') + select_day.val(1).trigger('change').trigger('focusout') + + assert.notOk(select_year.closest('.form-group').hasClass('form-group-invalid')) + assert.ok(select_year.closest('.form-group').find('div.invalid-feedback').length === 0) + }) + + QUnit.test(wrapper + ' - Validate time input reusing server message', function (assert) { + const form = $('form#new_user'); + const select_hour = form.find('select#user_time_of_birth_4i') + const select_minute = form.find('select#user_time_of_birth_5i') + + form[0].ClientSideValidations.settings.html_settings.wrapper = wrapper + + assert.ok(select_hour.closest('.form-group').hasClass('form-group-invalid')) + assert.ok(select_minute.closest('.form-group').hasClass('form-group-invalid')) + assert.ok(select_hour.closest('.form-group').find('div.invalid-feedback').length === 1) + + select_hour.val(23).trigger('change').trigger('focusout') + + assert.ok(select_hour.closest('.form-group').hasClass('form-group-invalid')) + assert.ok(select_minute.closest('.form-group').hasClass('form-group-invalid')) + assert.ok(select_hour.closest('.form-group').find('div.invalid-feedback').length === 1) + + select_minute.val(55).trigger('change').trigger('focusout') + + assert.notOk(select_hour.closest('.form-group').hasClass('form-group-invalid')) + assert.ok(select_hour.closest('.form-group').find('div.invalid-feedback').length === 0) + }) + } diff --git a/test/javascript/public/test/form_builders/validateSimpleFormBootstrap4Datetime.js b/test/javascript/public/test/form_builders/validateSimpleFormBootstrap4Datetime.js deleted file mode 100644 index 29b8cfa..0000000 --- a/test/javascript/public/test/form_builders/validateSimpleFormBootstrap4Datetime.js +++ /dev/null @@ -1,170 +0,0 @@ -QUnit.module('Validate SimpleForm Bootstrap 4 Datetime Fields/Wrappers', { - before: function () { - currentFormBuilder = window.ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] - window.ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = BS4_FORM_BUILDER - }, - - after: function () { - window.ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = currentFormBuilder - }, - - beforeEach: function () { - dataCsv = { - html_settings: { - type: 'SimpleForm::FormBuilder', - error_class: null, - error_tag: 'div', - wrapper_error_class: 'form-group-invalid', - wrapper_tag: 'div', - wrapper_class: 'form-group' - }, - validators: { - 'user[date_of_birth]': { presence: [{ message: 'must be present' }] }, - 'user[time_of_birth]': { presence: [{ message: 'must be present' }] } - } - } - - $('#qunit-fixture') - .append( - $('
', { - action: '/users', - 'data-client-side-validations': JSON.stringify(dataCsv), - method: 'post', - id: 'new_user' - }) - .append($('
', { - class:'form-group date required user_date_of_birth' - }) - .append($('')) - .append($('
', { - class: 'd-flex flex-row justify-content-between align-items-center' - }) - .append($('', { - id: 'user_date_of_birth_2i', - name: 'user[date_of_birth(2i)]', - class: 'form-control mx-1 date required', - 'data-client-side-validations-wrapper': 'vertical_multi_select' - }) - .append($('')) - .append($('')) - .append($(''))) - .append($('') - .append('') - .append('') - .append($('', { - id: 'user_time_of_birth_5i', - name: 'user[time_of_birth(5i)]', - class: 'form-control mx-1 is-invalid time required', - 'data-client-side-validations-wrapper': 'vertical_multi_select' - }) - .append($('')) - .append($('')) - .append($('')) - ) - ) - .append('
Time of birth must be present.
') - .append('Hint: At what time you were born?') - ) - ) - - $('form#new_user').validate() - } -}) - -//I don think this multiple wrapper names makes sense here, because in SimpleForm different wrapper would have different DOM -//but here DOM ($('#qunit-fixture')) is same for all tests. -var wrappers = ['vertical_form'] - -for (var i = 0; i < wrappers.length; i++) { - var wrapper = wrappers[i] - - QUnit.test(wrapper + ' - Validate date input', function (assert) { - const form = $('form#new_user'); - const select_year = form.find('select#user_date_of_birth_1i') - const select_month = form.find('select#user_date_of_birth_2i') - const select_day = form.find('select#user_date_of_birth_3i') - - form[0].ClientSideValidations.settings.html_settings.wrapper = wrapper - - select_year.trigger('focusout') - select_day.trigger('focusout') - - assert.ok(select_year.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_month.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_year.closest('.form-group').find('div.invalid-feedback').length === 1) - - select_year.val(2025).trigger('change').trigger('focusout') - - assert.ok(select_year.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_year.closest('.form-group').find('div.invalid-feedback').length === 1) - - select_month.val(1).trigger('change').trigger('focusout') - select_day.val(1).trigger('change').trigger('focusout') - - assert.notOk(select_year.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_year.closest('.form-group').find('div.invalid-feedback').length === 0) - }) - - QUnit.test(wrapper + ' - Validate time input reusing server message', function (assert) { - const form = $('form#new_user'); - const select_hour = form.find('select#user_time_of_birth_4i') - const select_minute = form.find('select#user_time_of_birth_5i') - - form[0].ClientSideValidations.settings.html_settings.wrapper = wrapper - - assert.ok(select_hour.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_minute.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_hour.closest('.form-group').find('div.invalid-feedback').length === 1) - - select_hour.val(23).trigger('change').trigger('focusout') - - assert.ok(select_hour.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_minute.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_hour.closest('.form-group').find('div.invalid-feedback').length === 1) - - select_minute.val(55).trigger('change').trigger('focusout') - - assert.notOk(select_hour.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_hour.closest('.form-group').find('div.invalid-feedback').length === 0) - }) -} diff --git a/test/javascript/public/test/form_builders/validateSimpleFormDateTime.js b/test/javascript/public/test/form_builders/validateSimpleFormDateTime.js deleted file mode 100644 index f172069..0000000 --- a/test/javascript/public/test/form_builders/validateSimpleFormDateTime.js +++ /dev/null @@ -1,152 +0,0 @@ -QUnit.module('Validate SimpleForm DateTime', { - before: function () { - currentFormBuilder = window.ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] - window.ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = DEFAULT_FORM_BUILDER - }, - - after: function () { - window.ClientSideValidations.formBuilders['SimpleForm::FormBuilder'] = currentFormBuilder - }, - - beforeEach: function () { - dataCsv = { - html_settings: { - type: 'SimpleForm::FormBuilder', - error_class: 'error', - error_tag: 'span', - wrapper_error_class: 'field_with_errors', - wrapper_tag: 'div', - wrapper_class: 'input', - wrapper: 'default' - }, - validators: { - 'user[date_of_birth]': { presence: [{ message: 'must be present' }] }, - 'user[time_of_birth]': { presence: [{ message: 'must be present' }] } - } - } - - $('#qunit-fixture') - .append( - $('', { - action: '/users', - 'data-client-side-validations': JSON.stringify(dataCsv), - method: 'post', - id: 'new_user' - }) - .append($('
', { - class:'input date required user_date_of_birth field_with_hint' - }) - .append($('')) - .append($('', { - id: 'user_date_of_birth_2i', - name: 'user[date_of_birth(2i)]', - class: 'date required', - }) - .append($('')) - .append($('')) - .append($(''))) - .append($('') - .append('') - .append('') - .append($('', { - id: 'user_time_of_birth_5i', - name: 'user[time_of_birth(5i)]', - class: 'time required', - 'aria-invalid': true - }) - .append($('')) - .append($('')) - .append($('')) - ) - .append('Hint: At what time you were born?') - .append('Time of birth must be present.') - ) - ) - - $('form#new_user').validate() - } - }) - - QUnit.test('Validate date input', function (assert) { - const form = $('form#new_user'); - const select_year = form.find('select#user_date_of_birth_1i') - const select_month = form.find('select#user_date_of_birth_2i') - const select_day = form.find('select#user_date_of_birth_3i') - - form[0].ClientSideValidations.settings.html_settings.wrapper = wrapper - - select_year.trigger('focusout') - select_day.trigger('focusout') - - assert.ok(select_year.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_month.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_year.closest('.form-group').find('div.invalid-feedback').length === 1) - - select_year.val(2025).trigger('change').trigger('focusout') - - assert.ok(select_year.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_year.closest('.form-group').find('div.invalid-feedback').length === 1) - - select_month.val(1).trigger('change').trigger('focusout') - select_day.val(1).trigger('change').trigger('focusout') - - assert.notOk(select_year.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_year.closest('.form-group').find('div.invalid-feedback').length === 0) - }) - - QUnit.test('Validate time input reusing server message', function (assert) { - const form = $('form#new_user'); - const select_hour = form.find('select#user_time_of_birth_4i') - const select_minute = form.find('select#user_time_of_birth_5i') - - form[0].ClientSideValidations.settings.html_settings.wrapper = wrapper - - assert.ok(select_hour.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_minute.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_hour.closest('.form-group').find('div.invalid-feedback').length === 1) - - select_hour.val(23).trigger('change').trigger('focusout') - - assert.ok(select_hour.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_minute.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_hour.closest('.form-group').find('div.invalid-feedback').length === 1) - - select_minute.val(55).trigger('change').trigger('focusout') - - assert.notOk(select_hour.closest('.form-group').hasClass('form-group-invalid')) - assert.ok(select_hour.closest('.form-group').find('div.invalid-feedback').length === 0) - }) diff --git a/vendor/assets/javascripts/rails.validations.simple_form.bootstrap4.js b/vendor/assets/javascripts/rails.validations.simple_form.bootstrap4.js index feaf840..431ad3c 100644 --- a/vendor/assets/javascripts/rails.validations.simple_form.bootstrap4.js +++ b/vendor/assets/javascripts/rails.validations.simple_form.bootstrap4.js @@ -29,7 +29,6 @@ wrappers: { "default": { add: function add(element, settings, message) { - alert('bla'); var wrapperElement = element.parent(); var errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback'); diff --git a/vendor/assets/javascripts/rails.validations.simple_form.js b/vendor/assets/javascripts/rails.validations.simple_form.js index 42ad6b1..62decb9 100644 --- a/vendor/assets/javascripts/rails.validations.simple_form.js +++ b/vendor/assets/javascripts/rails.validations.simple_form.js @@ -29,12 +29,6 @@ wrappers: { "default": { add: function add(element, settings, message) { - console.log(this); - - if (element.is('select') && (element.hasClass('date') || element.hasClass('time'))) { - console.log(this); - } - var wrapper = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/ /g, '.')); var errorElement = wrapper.find(settings.error_tag + '.' + settings.error_class.replace(/ /g, '.')); @@ -55,37 +49,6 @@ wrapper.removeClass(settings.wrapper_error_class); return errorElement.remove(); } - }, - multi_select: { - add: function add(element, settings, message) { - var wrapperElement = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/ /g, '.')); - var parentElement = element.parent(); - var errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback'); - - if (!errorElement.length) { - errorElement = $('<' + settings.error_tag + '>', { - "class": 'invalid-feedback d-block', - text: message - }); - parentElement.after(errorElement); - } - - wrapperElement.addClass(settings.wrapper_error_class); - element.addClass('is-invalid'); - errorElement.text(message); - }, - remove: function remove(element, settings) { - var wrapperElement = element.closest(settings.wrapper_tag + '.' + settings.wrapper_class.replace(/ /g, '.')); - var errorElement = wrapperElement.find(settings.error_tag + '.invalid-feedback'); - var invalidSiblingExists = element.siblings('.is-invalid').length; - - if (!invalidSiblingExists) { - wrapperElement.removeClass(settings.wrapper_error_class); - errorElement.remove(); - } - - element.removeClass('is-invalid'); - } } } };