summaryrefslogtreecommitdiff
path: root/spec/javascripts/new_branch_spec.js
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-10-17 02:13:26 -0500
committerMike Greiling <mike@pixelcog.com>2018-10-17 11:18:17 -0500
commitf666026d71ebefd70219d5078b1f0c83fa01f84d (patch)
treece43feb99c12c21dd266d25de24b1768bac1d459 /spec/javascripts/new_branch_spec.js
parent5a6fffcffca3dc8e4f52c90d3d18eaefd9e48aef (diff)
downloadgitlab-ce-f666026d71ebefd70219d5078b1f0c83fa01f84d.tar.gz
Prettify all spec files
Diffstat (limited to 'spec/javascripts/new_branch_spec.js')
-rw-r--r--spec/javascripts/new_branch_spec.js324
1 files changed, 163 insertions, 161 deletions
diff --git a/spec/javascripts/new_branch_spec.js b/spec/javascripts/new_branch_spec.js
index e17f340831a..e914a2eb5eb 100644
--- a/spec/javascripts/new_branch_spec.js
+++ b/spec/javascripts/new_branch_spec.js
@@ -3,197 +3,199 @@
import $ from 'jquery';
import NewBranchForm from '~/new_branch_form';
-(function() {
- describe('Branch', function() {
- describe('create a new branch', function() {
- var expectToHaveError, fillNameWith;
- preloadFixtures('branches/new_branch.html.raw');
- fillNameWith = function(value) {
- return $('.js-branch-name').val(value).trigger('blur');
- };
- expectToHaveError = function(error) {
- expect($('.js-branch-name-error span').text()).toEqual(error);
- };
- beforeEach(function() {
- loadFixtures('branches/new_branch.html.raw');
- $('form').on('submit', function(e) {
- return e.preventDefault();
- });
- return this.form = new NewBranchForm($('.js-create-branch-form'), []);
- });
+describe('Branch', function() {
+ describe('create a new branch', function() {
+ var expectToHaveError, fillNameWith;
+ preloadFixtures('branches/new_branch.html.raw');
+ fillNameWith = function(value) {
+ return $('.js-branch-name')
+ .val(value)
+ .trigger('blur');
+ };
+ expectToHaveError = function(error) {
+ expect($('.js-branch-name-error span').text()).toEqual(error);
+ };
+ beforeEach(function() {
+ loadFixtures('branches/new_branch.html.raw');
+ $('form').on('submit', function(e) {
+ return e.preventDefault();
+ });
+ 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 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 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 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");
- fillNameWith('foo bar');
- expectToHaveError("can't contain spaces");
- fillNameWith('foo ');
- return expectToHaveError("can't contain spaces");
- });
+ it("can't have spaces anywhere", function() {
+ fillNameWith(' foo');
+ expectToHaveError("can't contain spaces");
+ fillNameWith('foo bar');
+ expectToHaveError("can't contain spaces");
+ fillNameWith('foo ');
+ return expectToHaveError("can't contain spaces");
+ });
- it("can't have ~ anywhere", function() {
- fillNameWith('~foo');
- expectToHaveError("can't contain '~'");
- fillNameWith('foo~bar');
- expectToHaveError("can't contain '~'");
- fillNameWith('foo~');
- return expectToHaveError("can't contain '~'");
- });
+ it("can't have ~ anywhere", function() {
+ fillNameWith('~foo');
+ expectToHaveError("can't contain '~'");
+ fillNameWith('foo~bar');
+ expectToHaveError("can't contain '~'");
+ fillNameWith('foo~');
+ return expectToHaveError("can't contain '~'");
+ });
- it("can't have tilde anwhere", function() {
- fillNameWith('~foo');
- expectToHaveError("can't contain '~'");
- fillNameWith('foo~bar');
- expectToHaveError("can't contain '~'");
- fillNameWith('foo~');
- return expectToHaveError("can't contain '~'");
- });
+ it("can't have tilde anwhere", function() {
+ fillNameWith('~foo');
+ expectToHaveError("can't contain '~'");
+ fillNameWith('foo~bar');
+ expectToHaveError("can't contain '~'");
+ fillNameWith('foo~');
+ return expectToHaveError("can't contain '~'");
+ });
- it("can't have caret anywhere", function() {
- fillNameWith('^foo');
- expectToHaveError("can't contain '^'");
- fillNameWith('foo^bar');
- expectToHaveError("can't contain '^'");
- fillNameWith('foo^');
- return expectToHaveError("can't contain '^'");
- });
+ it("can't have caret anywhere", function() {
+ fillNameWith('^foo');
+ expectToHaveError("can't contain '^'");
+ fillNameWith('foo^bar');
+ expectToHaveError("can't contain '^'");
+ fillNameWith('foo^');
+ return expectToHaveError("can't contain '^'");
+ });
- it("can't have : anywhere", function() {
- fillNameWith(':foo');
- expectToHaveError("can't contain ':'");
- fillNameWith('foo:bar');
- expectToHaveError("can't contain ':'");
- fillNameWith(':foo');
- return expectToHaveError("can't contain ':'");
- });
+ it("can't have : anywhere", function() {
+ fillNameWith(':foo');
+ expectToHaveError("can't contain ':'");
+ fillNameWith('foo:bar');
+ expectToHaveError("can't contain ':'");
+ fillNameWith(':foo');
+ return expectToHaveError("can't contain ':'");
+ });
- it("can't have question mark anywhere", function() {
- fillNameWith('?foo');
- expectToHaveError("can't contain '?'");
- fillNameWith('foo?bar');
- expectToHaveError("can't contain '?'");
- fillNameWith('foo?');
- return expectToHaveError("can't contain '?'");
- });
+ it("can't have question mark anywhere", function() {
+ fillNameWith('?foo');
+ expectToHaveError("can't contain '?'");
+ fillNameWith('foo?bar');
+ expectToHaveError("can't contain '?'");
+ fillNameWith('foo?');
+ return expectToHaveError("can't contain '?'");
+ });
- it("can't have asterisk anywhere", function() {
- fillNameWith('*foo');
- expectToHaveError("can't contain '*'");
- fillNameWith('foo*bar');
- expectToHaveError("can't contain '*'");
- fillNameWith('foo*');
- return expectToHaveError("can't contain '*'");
- });
+ it("can't have asterisk anywhere", function() {
+ fillNameWith('*foo');
+ expectToHaveError("can't contain '*'");
+ fillNameWith('foo*bar');
+ expectToHaveError("can't contain '*'");
+ fillNameWith('foo*');
+ return expectToHaveError("can't contain '*'");
+ });
- it("can't have open bracket anywhere", function() {
- fillNameWith('[foo');
- expectToHaveError("can't contain '['");
- fillNameWith('foo[bar');
- expectToHaveError("can't contain '['");
- fillNameWith('foo[');
- return expectToHaveError("can't contain '['");
- });
+ it("can't have open bracket anywhere", function() {
+ fillNameWith('[foo');
+ expectToHaveError("can't contain '['");
+ fillNameWith('foo[bar');
+ expectToHaveError("can't contain '['");
+ fillNameWith('foo[');
+ return expectToHaveError("can't contain '['");
+ });
- it("can't have a backslash anywhere", function() {
- fillNameWith('\\foo');
- expectToHaveError("can't contain '\\'");
- fillNameWith('foo\\bar');
- expectToHaveError("can't contain '\\'");
- fillNameWith('foo\\');
- return expectToHaveError("can't contain '\\'");
- });
+ it("can't have a backslash anywhere", function() {
+ fillNameWith('\\foo');
+ expectToHaveError("can't contain '\\'");
+ fillNameWith('foo\\bar');
+ expectToHaveError("can't contain '\\'");
+ fillNameWith('foo\\');
+ return expectToHaveError("can't contain '\\'");
+ });
- it("can't contain a sequence @{ anywhere", function() {
- fillNameWith('@{foo');
- expectToHaveError("can't contain '@{'");
- fillNameWith('foo@{bar');
- expectToHaveError("can't contain '@{'");
- fillNameWith('foo@{');
- return expectToHaveError("can't contain '@{'");
- });
+ it("can't contain a sequence @{ anywhere", function() {
+ fillNameWith('@{foo');
+ expectToHaveError("can't contain '@{'");
+ fillNameWith('foo@{bar');
+ expectToHaveError("can't contain '@{'");
+ 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 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 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 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 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("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('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("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');
+ 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');
+ expect($('.js-branch-name-error span').length).toEqual(1);
+ fillNameWith('foobar');
- expect($('.js-branch-name-error span').length).toEqual(0);
- });
+ expect($('.js-branch-name-error span').length).toEqual(0);
+ });
- it("can have dashes anywhere", function() {
- fillNameWith('-foo-bar-zoo-');
+ it('can have dashes anywhere', function() {
+ fillNameWith('-foo-bar-zoo-');
- expect($('.js-branch-name-error span').length).toEqual(0);
- });
+ expect($('.js-branch-name-error span').length).toEqual(0);
+ });
- it("can have underscores anywhere", function() {
- fillNameWith('_foo_bar_zoo_');
+ it('can have underscores anywhere', function() {
+ fillNameWith('_foo_bar_zoo_');
- expect($('.js-branch-name-error span').length).toEqual(0);
- });
+ expect($('.js-branch-name-error span').length).toEqual(0);
+ });
- it("can have numbers anywhere", function() {
- fillNameWith('1foo2bar3zoo4');
+ it('can have numbers anywhere', function() {
+ fillNameWith('1foo2bar3zoo4');
- expect($('.js-branch-name-error span').length).toEqual(0);
- });
+ expect($('.js-branch-name-error span').length).toEqual(0);
+ });
- it("can be only letters", function() {
- fillNameWith('foo');
+ it('can be only letters', function() {
+ fillNameWith('foo');
- expect($('.js-branch-name-error span').length).toEqual(0);
- });
+ expect($('.js-branch-name-error span').length).toEqual(0);
});
});
-}).call(window);
+});