summaryrefslogtreecommitdiff
path: root/spec/javascripts/gl_field_errors_spec.js
diff options
context:
space:
mode:
authorJohann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com>2018-10-09 20:03:09 +0200
committerJohann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com>2018-10-17 06:57:29 +0200
commit6f5723a169b5d400c136dbd844fc54c68e5f8563 (patch)
treee7bad2648366ed5943293655a0abe23367e869a6 /spec/javascripts/gl_field_errors_spec.js
parent28d412e5b2b8499fba22e8fabb1d44f44449228e (diff)
downloadgitlab-ce-6f5723a169b5d400c136dbd844fc54c68e5f8563.tar.gz
enable jasmine/new-line-before-expect
Diffstat (limited to 'spec/javascripts/gl_field_errors_spec.js')
-rw-r--r--spec/javascripts/gl_field_errors_spec.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/javascripts/gl_field_errors_spec.js b/spec/javascripts/gl_field_errors_spec.js
index 21c462cd040..4a95d4f4a24 100644
--- a/spec/javascripts/gl_field_errors_spec.js
+++ b/spec/javascripts/gl_field_errors_spec.js
@@ -19,6 +19,7 @@ describe('GL Style Field Errors', function() {
expect(this.$form.length).toBe(1);
expect(this.fieldErrors).toBeDefined();
const { inputs } = this.fieldErrors.state;
+
expect(inputs.length).toBe(4);
});
@@ -31,6 +32,7 @@ describe('GL Style Field Errors', function() {
const customErrors = this.fieldErrors.state.inputs.filter((input) => {
return input.inputElement.hasClass(customErrorFlag);
});
+
expect(customErrors.length).toBe(0);
});
@@ -40,6 +42,7 @@ describe('GL Style Field Errors', function() {
this.$form.find('.alphanumberic').val('?---*').keyup();
const errorsShown = this.$form.find('.gl-field-error-outline');
+
expect(errorsShown.length).toBe(0);
});
@@ -51,6 +54,7 @@ describe('GL Style Field Errors', function() {
this.$form.submit();
const errorsShown = this.$form.find('.gl-field-error-outline');
+
expect(errorsShown.length).toBe(4);
});
@@ -68,30 +72,35 @@ describe('GL Style Field Errors', function() {
// Then invalid input
emailInputElement.val('not-a-valid-email').keyup();
+
expect(emailInputElement).toHaveClass('gl-field-error-outline');
expect(fieldState.empty).toBe(false);
expect(fieldState.valid).toBe(false);
// Then valid input
emailInputElement.val('email@gitlab.com').keyup();
+
expect(emailInputElement).not.toHaveClass('gl-field-error-outline');
expect(fieldState.empty).toBe(false);
expect(fieldState.valid).toBe(true);
// Then invalid input
emailInputElement.val('not-a-valid-email').keyup();
+
expect(emailInputElement).toHaveClass('gl-field-error-outline');
expect(fieldState.empty).toBe(false);
expect(fieldState.valid).toBe(false);
// Then empty input
emailInputElement.val('').keyup();
+
expect(emailInputElement).toHaveClass('gl-field-error-outline');
expect(fieldState.empty).toBe(true);
expect(fieldState.valid).toBe(false);
// Then valid input
emailInputElement.val('email@gitlab.com').keyup();
+
expect(emailInputElement).not.toHaveClass('gl-field-error-outline');
expect(fieldState.empty).toBe(false);
expect(fieldState.valid).toBe(true);