diff options
author | Johann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com> | 2018-10-09 20:01:49 +0300 |
---|---|---|
committer | Johann Hubert Sonntagbauer <johann.sonntagbauer@gmail.com> | 2018-10-09 20:01:49 +0300 |
commit | 2a76e04091211c03684d236230331d6eabdf748e (patch) | |
tree | 8e1d9bbe0391095cf1c1a183a4e12315558b9c78 /spec/javascripts/new_branch_spec.js | |
parent | 10836664487a771319e2d97dd7b9011dcd017f14 (diff) |
enable jasmine/new-line-between-declarations
Diffstat (limited to 'spec/javascripts/new_branch_spec.js')
-rw-r--r-- | spec/javascripts/new_branch_spec.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/javascripts/new_branch_spec.js b/spec/javascripts/new_branch_spec.js index e52ac686435..85419e640d8 100644 --- a/spec/javascripts/new_branch_spec.js +++ b/spec/javascripts/new_branch_spec.js @@ -21,18 +21,22 @@ import NewBranchForm from '~/new_branch_form'; }); return this.form = new NewBranchForm($('.js-create-branch-form'), []); }); + it("can't start with a dot", function() { fillNameWith('.foo'); return expectToHaveError("can't start with '.'"); }); + it("can't start with a slash", function() { fillNameWith('/foo'); return expectToHaveError("can't start with '/'"); }); + it("can't have two consecutive dots", function() { fillNameWith('foo..bar'); return expectToHaveError("can't contain '..'"); }); + it("can't have spaces anywhere", function() { fillNameWith(' foo'); expectToHaveError("can't contain spaces"); @@ -41,6 +45,7 @@ import NewBranchForm from '~/new_branch_form'; fillNameWith('foo '); return expectToHaveError("can't contain spaces"); }); + it("can't have ~ anywhere", function() { fillNameWith('~foo'); expectToHaveError("can't contain '~'"); @@ -49,6 +54,7 @@ import NewBranchForm from '~/new_branch_form'; fillNameWith('foo~'); return expectToHaveError("can't contain '~'"); }); + it("can't have tilde anwhere", function() { fillNameWith('~foo'); expectToHaveError("can't contain '~'"); @@ -57,6 +63,7 @@ import NewBranchForm from '~/new_branch_form'; fillNameWith('foo~'); return expectToHaveError("can't contain '~'"); }); + it("can't have caret anywhere", function() { fillNameWith('^foo'); expectToHaveError("can't contain '^'"); @@ -65,6 +72,7 @@ import NewBranchForm from '~/new_branch_form'; fillNameWith('foo^'); return expectToHaveError("can't contain '^'"); }); + it("can't have : anywhere", function() { fillNameWith(':foo'); expectToHaveError("can't contain ':'"); @@ -73,6 +81,7 @@ import NewBranchForm from '~/new_branch_form'; fillNameWith(':foo'); return expectToHaveError("can't contain ':'"); }); + it("can't have question mark anywhere", function() { fillNameWith('?foo'); expectToHaveError("can't contain '?'"); @@ -81,6 +90,7 @@ import NewBranchForm from '~/new_branch_form'; fillNameWith('foo?'); return expectToHaveError("can't contain '?'"); }); + it("can't have asterisk anywhere", function() { fillNameWith('*foo'); expectToHaveError("can't contain '*'"); @@ -89,6 +99,7 @@ import NewBranchForm from '~/new_branch_form'; fillNameWith('foo*'); return expectToHaveError("can't contain '*'"); }); + it("can't have open bracket anywhere", function() { fillNameWith('[foo'); expectToHaveError("can't contain '['"); @@ -97,6 +108,7 @@ import NewBranchForm from '~/new_branch_form'; fillNameWith('foo['); return expectToHaveError("can't contain '['"); }); + it("can't have a backslash anywhere", function() { fillNameWith('\\foo'); expectToHaveError("can't contain '\\'"); @@ -105,6 +117,7 @@ import NewBranchForm from '~/new_branch_form'; fillNameWith('foo\\'); return expectToHaveError("can't contain '\\'"); }); + it("can't contain a sequence @{ anywhere", function() { fillNameWith('@{foo'); expectToHaveError("can't contain '@{'"); @@ -113,48 +126,59 @@ import NewBranchForm from '~/new_branch_form'; fillNameWith('foo@{'); return expectToHaveError("can't contain '@{'"); }); + it("can't have consecutive slashes", function() { fillNameWith('foo//bar'); return expectToHaveError("can't contain consecutive slashes"); }); + it("can't end with a slash", function() { fillNameWith('foo/'); return expectToHaveError("can't end in '/'"); }); + it("can't end with a dot", function() { fillNameWith('foo.'); return expectToHaveError("can't end in '.'"); }); + it("can't end with .lock", function() { fillNameWith('foo.lock'); return expectToHaveError("can't end in '.lock'"); }); + it("can't be the single character @", function() { fillNameWith('@'); return expectToHaveError("can't be '@'"); }); + it("concatenates all error messages", function() { fillNameWith('/foo bar?~.'); return expectToHaveError("can't start with '/', can't contain spaces, '?', '~', can't end in '.'"); }); + it("doesn't duplicate error messages", function() { fillNameWith('?foo?bar?zoo?'); return expectToHaveError("can't contain '?'"); }); + it("removes the error message when is a valid name", function() { fillNameWith('foo?bar'); expect($('.js-branch-name-error span').length).toEqual(1); fillNameWith('foobar'); return expect($('.js-branch-name-error span').length).toEqual(0); }); + it("can have dashes anywhere", function() { fillNameWith('-foo-bar-zoo-'); return expect($('.js-branch-name-error span').length).toEqual(0); }); + it("can have underscores anywhere", function() { fillNameWith('_foo_bar_zoo_'); return expect($('.js-branch-name-error span').length).toEqual(0); }); + it("can have numbers anywhere", function() { fillNameWith('1foo2bar3zoo4'); return expect($('.js-branch-name-error span').length).toEqual(0); |