Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
23b436dc
Commit
23b436dc
authored
Dec 21, 2015
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix minor stylistic complaints
parent
daa28d9f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
39 deletions
+38
-39
app/assets/javascripts/new_branch_form.js.coffee
app/assets/javascripts/new_branch_form.js.coffee
+3
-4
features/steps/project/commits/branches.rb
features/steps/project/commits/branches.rb
+1
-1
spec/javascripts/new_branch_spec.js.coffee
spec/javascripts/new_branch_spec.js.coffee
+34
-34
No files found.
app/assets/javascripts/new_branch_form.js.coffee
View file @
23b436dc
...
@@ -13,13 +13,12 @@ class @NewBranchForm
...
@@ -13,13 +13,12 @@ class @NewBranchForm
@
name
.
on
'blur'
,
@
validate
@
name
.
on
'blur'
,
@
validate
init
:
->
init
:
->
@
name
.
trigger
'blur'
if
@
name
.
val
().
length
>
0
@
name
.
trigger
'blur'
if
@
name
.
val
().
length
>
0
setupAvailableRefs
:
(
availableRefs
)
->
setupAvailableRefs
:
(
availableRefs
)
->
@
ref
.
autocomplete
{
@
ref
.
autocomplete
source
:
availableRefs
,
source
:
availableRefs
,
minLength
:
1
minLength
:
1
}
setupRestrictions
:
->
setupRestrictions
:
->
startsWith
=
{
startsWith
=
{
...
@@ -36,7 +35,7 @@ class @NewBranchForm
...
@@ -36,7 +35,7 @@ class @NewBranchForm
invalid
=
{
invalid
=
{
pattern
:
/(\s|~|\^|:|\?|\*|\[|\\|\.\.|@\{|\/{2,}){1}/g
pattern
:
/(\s|~|\^|:|\?|\*|\[|\\|\.\.|@\{|\/{2,}){1}/g
prefix
:
"can't contain
s
"
,
prefix
:
"can't contain"
,
conjunction
:
", "
conjunction
:
", "
}
}
...
...
features/steps/project/commits/branches.rb
View file @
23b436dc
...
@@ -62,7 +62,7 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
...
@@ -62,7 +62,7 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
step
'I should see new an error that branch is invalid'
do
step
'I should see new an error that branch is invalid'
do
expect
(
page
).
to
have_content
'Branch name is invalid'
expect
(
page
).
to
have_content
'Branch name is invalid'
expect
(
page
).
to
have_content
"can't contain
s
spaces"
expect
(
page
).
to
have_content
"can't contain spaces"
end
end
step
'I should see new an error that ref is invalid'
do
step
'I should see new an error that ref is invalid'
do
...
...
spec/javascripts/new_branch_spec.js.coffee
View file @
23b436dc
...
@@ -22,91 +22,91 @@ describe 'Branch', ->
...
@@ -22,91 +22,91 @@ describe 'Branch', ->
it
"can't have two consecutive dots"
,
->
it
"can't have two consecutive dots"
,
->
@
name
.
val
(
'foo..bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo..bar'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'..'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '..'"
)
it
"can't have spaces anywhere"
,
->
it
"can't have spaces anywhere"
,
->
@
name
.
val
(
' foo'
).
trigger
(
'blur'
)
@
name
.
val
(
' foo'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
spaces"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain spaces"
)
@
name
.
val
(
'foo bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo bar'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
spaces"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain spaces"
)
@
name
.
val
(
'foo '
).
trigger
(
'blur'
)
@
name
.
val
(
'foo '
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
spaces"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain spaces"
)
it
"can't have ~ anywhere"
,
->
it
"can't have ~ anywhere"
,
->
@
name
.
val
(
'~foo'
).
trigger
(
'blur'
)
@
name
.
val
(
'~foo'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'~'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '~'"
)
@
name
.
val
(
'foo~bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo~bar'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'~'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '~'"
)
@
name
.
val
(
'foo~'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo~'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'~'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '~'"
)
it
"can't have tilde anwhere"
,
->
it
"can't have tilde anwhere"
,
->
@
name
.
val
(
'~foo'
).
trigger
(
'blur'
)
@
name
.
val
(
'~foo'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'~'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '~'"
)
@
name
.
val
(
'foo~bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo~bar'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'~'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '~'"
)
@
name
.
val
(
'foo~'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo~'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'~'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '~'"
)
it
"can't have caret anywhere"
,
->
it
"can't have caret anywhere"
,
->
@
name
.
val
(
'^foo'
).
trigger
(
'blur'
)
@
name
.
val
(
'^foo'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'^'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '^'"
)
@
name
.
val
(
'foo^bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo^bar'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'^'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '^'"
)
@
name
.
val
(
'foo^'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo^'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'^'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '^'"
)
it
"can't have : anywhere"
,
->
it
"can't have : anywhere"
,
->
@
name
.
val
(
':foo'
).
trigger
(
'blur'
)
@
name
.
val
(
':foo'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
':'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain ':'"
)
@
name
.
val
(
'foo:bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo:bar'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
':'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain ':'"
)
@
name
.
val
(
':foo'
).
trigger
(
'blur'
)
@
name
.
val
(
':foo'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
':'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain ':'"
)
it
"can't have question mark anywhere"
,
->
it
"can't have question mark anywhere"
,
->
@
name
.
val
(
'?foo'
).
trigger
(
'blur'
)
@
name
.
val
(
'?foo'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'?'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '?'"
)
@
name
.
val
(
'foo?bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo?bar'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'?'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '?'"
)
@
name
.
val
(
'foo?'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo?'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'?'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '?'"
)
it
"can't have asterisk anywhere"
,
->
it
"can't have asterisk anywhere"
,
->
@
name
.
val
(
'*foo'
).
trigger
(
'blur'
)
@
name
.
val
(
'*foo'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'*'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '*'"
)
@
name
.
val
(
'foo*bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo*bar'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'*'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '*'"
)
@
name
.
val
(
'foo*'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo*'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'*'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '*'"
)
it
"can't have open bracket anywhere"
,
->
it
"can't have open bracket anywhere"
,
->
@
name
.
val
(
'[foo'
).
trigger
(
'blur'
)
@
name
.
val
(
'[foo'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'['"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '['"
)
@
name
.
val
(
'foo[bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo[bar'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'['"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '['"
)
@
name
.
val
(
'foo['
).
trigger
(
'blur'
)
@
name
.
val
(
'foo['
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'['"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '['"
)
it
"can't have a backslash anywhere"
,
->
it
"can't have a backslash anywhere"
,
->
@
name
.
val
(
'
\\
foo'
).
trigger
(
'blur'
)
@
name
.
val
(
'
\\
foo'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'
\\
'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '
\\
'"
)
@
name
.
val
(
'foo
\\
bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo
\\
bar'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'
\\
'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '
\\
'"
)
@
name
.
val
(
'foo
\\
'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo
\\
'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'
\\
'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '
\\
'"
)
it
"can't contain a sequence @{ anywhere"
,
->
it
"can't contain a sequence @{ anywhere"
,
->
@
name
.
val
(
'@{foo'
).
trigger
(
'blur'
)
@
name
.
val
(
'@{foo'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'@{'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '@{'"
)
@
name
.
val
(
'foo@{bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo@{bar'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'@{'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '@{'"
)
@
name
.
val
(
'foo@{'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo@{'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'@{'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '@{'"
)
it
"can't have consecutive slashes"
,
->
it
"can't have consecutive slashes"
,
->
@
name
.
val
(
'foo//bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo//bar'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
consecutive slashes"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain consecutive slashes"
)
it
"can't end with a slash"
,
->
it
"can't end with a slash"
,
->
@
name
.
val
(
'foo/'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo/'
).
trigger
(
'blur'
)
...
@@ -126,11 +126,11 @@ describe 'Branch', ->
...
@@ -126,11 +126,11 @@ describe 'Branch', ->
it
"concatenates all error messages"
,
->
it
"concatenates all error messages"
,
->
@
name
.
val
(
'/foo bar?~.'
).
trigger
(
'blur'
)
@
name
.
val
(
'/foo bar?~.'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't start with '/', can't contain
s
spaces, '?', '~', can't end in '.'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't start with '/', can't contain spaces, '?', '~', can't end in '.'"
)
it
"doesn't duplicate error messages"
,
->
it
"doesn't duplicate error messages"
,
->
@
name
.
val
(
'?foo?bar?zoo?'
).
trigger
(
'blur'
)
@
name
.
val
(
'?foo?bar?zoo?'
).
trigger
(
'blur'
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain
s
'?'"
)
expect
(
$
(
'.js-branch-name-error span'
).
text
()).
toEqual
(
"can't contain '?'"
)
it
"removes the error message when is a valid name"
,
->
it
"removes the error message when is a valid name"
,
->
@
name
.
val
(
'foo?bar'
).
trigger
(
'blur'
)
@
name
.
val
(
'foo?bar'
).
trigger
(
'blur'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment