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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
2a76e040
Commit
2a76e040
authored
Oct 09, 2018
by
Johann Hubert Sonntagbauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable jasmine/new-line-between-declarations
parent
10836664
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
115 additions
and
1 deletion
+115
-1
spec/javascripts/.eslintrc.yml
spec/javascripts/.eslintrc.yml
+0
-1
spec/javascripts/awards_handler_spec.js
spec/javascripts/awards_handler_spec.js
+16
-0
spec/javascripts/behaviors/quick_submit_spec.js
spec/javascripts/behaviors/quick_submit_spec.js
+2
-0
spec/javascripts/bootstrap_jquery_spec.js
spec/javascripts/bootstrap_jquery_spec.js
+2
-0
spec/javascripts/emoji_spec.js
spec/javascripts/emoji_spec.js
+38
-0
spec/javascripts/graphs/stat_graph_contributors_util_spec.js
spec/javascripts/graphs/stat_graph_contributors_util_spec.js
+2
-0
spec/javascripts/jobs/components/job_log_controllers_spec.js
spec/javascripts/jobs/components/job_log_controllers_spec.js
+1
-0
spec/javascripts/lib/utils/common_utils_spec.js
spec/javascripts/lib/utils/common_utils_spec.js
+1
-0
spec/javascripts/line_highlighter_spec.js
spec/javascripts/line_highlighter_spec.js
+18
-0
spec/javascripts/new_branch_spec.js
spec/javascripts/new_branch_spec.js
+24
-0
spec/javascripts/notes/components/note_form_spec.js
spec/javascripts/notes/components/note_form_spec.js
+1
-0
spec/javascripts/reports/components/report_section_spec.js
spec/javascripts/reports/components/report_section_spec.js
+1
-0
spec/javascripts/right_sidebar_spec.js
spec/javascripts/right_sidebar_spec.js
+2
-0
spec/javascripts/search_autocomplete_spec.js
spec/javascripts/search_autocomplete_spec.js
+6
-0
spec/javascripts/syntax_highlight_spec.js
spec/javascripts/syntax_highlight_spec.js
+1
-0
No files found.
spec/javascripts/.eslintrc.yml
View file @
2a76e040
...
...
@@ -37,7 +37,6 @@ rules:
-
'
fixtures/blob'
# Temporarily disabled to facilitate an upgrade to eslint-plugin-jasmine
jasmine/new-line-before-expect
:
off
jasmine/new-line-between-declarations
:
off
jasmine/no-promise-without-done-fail
:
off
jasmine/prefer-jasmine-matcher
:
off
jasmine/prefer-toHaveBeenCalledWith
:
off
spec/javascripts/awards_handler_spec.js
View file @
2a76e040
...
...
@@ -55,6 +55,7 @@ import '~/lib/utils/common_utils';
});
};
});
afterEach
(
function
()
{
// restore original url root value
gon
.
relative_url_root
=
urlRoot
;
...
...
@@ -64,6 +65,7 @@ import '~/lib/utils/common_utils';
awardsHandler
.
destroy
();
});
describe
(
'
::showEmojiMenu
'
,
function
()
{
it
(
'
should show emoji menu when Add emoji button clicked
'
,
function
(
done
)
{
$
(
'
.js-add-award
'
)
...
...
@@ -78,6 +80,7 @@ import '~/lib/utils/common_utils';
return
expect
(
$
(
'
.js-awards-block.current
'
).
length
).
toBe
(
1
);
});
});
it
(
'
should also show emoji menu for the smiley icon in notes
'
,
function
(
done
)
{
$
(
'
.js-add-award.note-action-button
'
).
click
();
return
lazyAssert
(
done
,
function
()
{
...
...
@@ -85,6 +88,7 @@ import '~/lib/utils/common_utils';
return
expect
(
$emojiMenu
.
length
).
toBe
(
1
);
});
});
it
(
'
should remove emoji menu when body is clicked
'
,
function
(
done
)
{
$
(
'
.js-add-award
'
)
.
eq
(
0
)
...
...
@@ -98,6 +102,7 @@ import '~/lib/utils/common_utils';
return
expect
(
$
(
'
.js-awards-block.current
'
).
length
).
toBe
(
0
);
});
});
it
(
'
should not remove emoji menu when search is clicked
'
,
function
(
done
)
{
$
(
'
.js-add-award
'
)
.
eq
(
0
)
...
...
@@ -123,6 +128,7 @@ import '~/lib/utils/common_utils';
expect
(
$emojiButton
.
next
(
'
.js-counter
'
).
text
()).
toBe
(
'
1
'
);
return
expect
(
$votesBlock
.
hasClass
(
'
hidden
'
)).
toBe
(
false
);
});
it
(
'
should remove the emoji when we click again
'
,
function
()
{
var
$emojiButton
,
$votesBlock
;
$votesBlock
=
$
(
'
.js-awards-block
'
).
eq
(
0
);
...
...
@@ -142,6 +148,7 @@ import '~/lib/utils/common_utils';
return
expect
(
$emojiButton
.
next
(
'
.js-counter
'
).
text
()).
toBe
(
'
4
'
);
});
});
describe
(
'
::userAuthored
'
,
function
()
{
it
(
'
should update tooltip to user authored title
'
,
function
()
{
var
$thumbsUpEmoji
,
$votesBlock
;
...
...
@@ -153,6 +160,7 @@ import '~/lib/utils/common_utils';
'
You cannot vote on your own issue, MR and note
'
,
);
});
it
(
'
should restore tooltip back to initial vote list
'
,
function
()
{
var
$thumbsUpEmoji
,
$votesBlock
;
jasmine
.
clock
().
install
();
...
...
@@ -165,6 +173,7 @@ import '~/lib/utils/common_utils';
return
expect
(
$thumbsUpEmoji
.
data
(
'
originalTitle
'
)).
toBe
(
'
sam
'
);
});
});
describe
(
'
::getAwardUrl
'
,
function
()
{
return
it
(
'
returns the url for request
'
,
function
()
{
return
expect
(
awardsHandler
.
getAwardUrl
()).
toBe
(
...
...
@@ -172,6 +181,7 @@ import '~/lib/utils/common_utils';
);
});
});
describe
(
'
::addAward and ::checkMutuality
'
,
function
()
{
return
it
(
'
should handle :+1: and :-1: mutuality
'
,
function
()
{
var
$thumbsDownEmoji
,
$thumbsUpEmoji
,
$votesBlock
,
awardUrl
;
...
...
@@ -189,6 +199,7 @@ import '~/lib/utils/common_utils';
return
expect
(
$thumbsDownEmoji
.
hasClass
(
'
active
'
)).
toBe
(
true
);
});
});
describe
(
'
::removeEmoji
'
,
function
()
{
return
it
(
'
should remove emoji
'
,
function
()
{
var
$votesBlock
,
awardUrl
;
...
...
@@ -200,6 +211,7 @@ import '~/lib/utils/common_utils';
return
expect
(
$votesBlock
.
find
(
'
[data-name=fire]
'
).
length
).
toBe
(
0
);
});
});
describe
(
'
::addYouToUserList
'
,
function
()
{
it
(
'
should prepend "You" to the award tooltip
'
,
function
()
{
var
$thumbsUpEmoji
,
$votesBlock
,
awardUrl
;
...
...
@@ -222,6 +234,7 @@ import '~/lib/utils/common_utils';
return
expect
(
$thumbsUpEmoji
.
data
(
'
originalTitle
'
)).
toBe
(
'
You and sam
'
);
});
});
describe
(
'
::removeYouToUserList
'
,
function
()
{
it
(
'
removes "You" from the front of the tooltip
'
,
function
()
{
var
$thumbsUpEmoji
,
$votesBlock
,
awardUrl
;
...
...
@@ -246,6 +259,7 @@ import '~/lib/utils/common_utils';
return
expect
(
$thumbsUpEmoji
.
data
(
'
originalTitle
'
)).
toBe
(
'
sam
'
);
});
});
describe
(
'
::searchEmojis
'
,
()
=>
{
it
(
'
should filter the emoji
'
,
function
(
done
)
{
return
openAndWaitForEmojiMenu
()
...
...
@@ -263,6 +277,7 @@ import '~/lib/utils/common_utils';
done
.
fail
(
`Failed to open and build emoji menu:
${
err
.
message
}
`
);
});
});
it
(
'
should clear the search when searching for nothing
'
,
function
(
done
)
{
return
openAndWaitForEmojiMenu
()
.
then
(()
=>
{
...
...
@@ -305,6 +320,7 @@ import '~/lib/utils/common_utils';
done
.
fail
(
`Failed to open and build emoji menu:
${
err
.
message
}
`
);
});
});
it
(
'
should remove already selected emoji
'
,
function
(
done
)
{
return
openEmojiMenuAndAddEmoji
()
.
then
(()
=>
{
...
...
spec/javascripts/behaviors/quick_submit_spec.js
View file @
2a76e040
...
...
@@ -58,12 +58,14 @@ describe('Quick Submit behavior', function () {
expect
(
submitButton
).
toBeDisabled
();
});
it
(
'
disables button of type submit
'
,
()
=>
{
const
submitButton
=
$
(
'
.js-quick-submit input[type=submit]
'
);
this
.
textarea
.
trigger
(
keydownEvent
());
expect
(
submitButton
).
toBeDisabled
();
});
it
(
'
only clicks one submit
'
,
()
=>
{
const
existingSubmit
=
$
(
'
.js-quick-submit input[type=submit]
'
);
// Add an extra submit button
...
...
spec/javascripts/bootstrap_jquery_spec.js
View file @
2a76e040
...
...
@@ -9,6 +9,7 @@ import '~/commons/bootstrap';
beforeEach
(
function
()
{
return
setFixtures
(
'
<input type="text" />
'
);
});
it
(
'
adds the disabled attribute
'
,
function
()
{
var
$input
;
$input
=
$
(
'
input
'
).
first
();
...
...
@@ -26,6 +27,7 @@ import '~/commons/bootstrap';
beforeEach
(
function
()
{
return
setFixtures
(
'
<input type="text" disabled="disabled" class="disabled" />
'
);
});
it
(
'
removes the disabled attribute
'
,
function
()
{
var
$input
;
$input
=
$
(
'
input
'
).
first
();
...
...
spec/javascripts/emoji_spec.js
View file @
2a76e040
...
...
@@ -140,6 +140,7 @@ describe('gl_emoji', () => {
},
);
});
it
(
'
bomb emoji with sprite fallback
'
,
()
=>
{
const
emojiKey
=
'
bomb
'
;
const
markup
=
glEmojiTag
(
emojiFixtureMap
[
emojiKey
].
name
,
{
...
...
@@ -195,24 +196,31 @@ describe('gl_emoji', () => {
it
(
'
should gracefully handle empty string
'
,
()
=>
{
expect
(
isFlagEmoji
(
''
)).
toBeFalsy
();
});
it
(
'
should detect flag_ac
'
,
()
=>
{
expect
(
isFlagEmoji
(
'
🇦🇨
'
)).
toBeTruthy
();
});
it
(
'
should detect flag_us
'
,
()
=>
{
expect
(
isFlagEmoji
(
'
🇺🇸
'
)).
toBeTruthy
();
});
it
(
'
should detect flag_zw
'
,
()
=>
{
expect
(
isFlagEmoji
(
'
🇿🇼
'
)).
toBeTruthy
();
});
it
(
'
should not detect flags
'
,
()
=>
{
expect
(
isFlagEmoji
(
'
🎏
'
)).
toBeFalsy
();
});
it
(
'
should not detect triangular_flag_on_post
'
,
()
=>
{
expect
(
isFlagEmoji
(
'
🚩
'
)).
toBeFalsy
();
});
it
(
'
should not detect single letter
'
,
()
=>
{
expect
(
isFlagEmoji
(
'
🇦
'
)).
toBeFalsy
();
});
it
(
'
should not detect >2 letters
'
,
()
=>
{
expect
(
isFlagEmoji
(
'
🇦🇧🇨
'
)).
toBeFalsy
();
});
...
...
@@ -222,15 +230,19 @@ describe('gl_emoji', () => {
it
(
'
should gracefully handle empty string
'
,
()
=>
{
expect
(
isRainbowFlagEmoji
(
''
)).
toBeFalsy
();
});
it
(
'
should detect rainbow_flag
'
,
()
=>
{
expect
(
isRainbowFlagEmoji
(
'
🏳🌈
'
)).
toBeTruthy
();
});
it
(
'
should not detect flag_white on its
\'
own
'
,
()
=>
{
expect
(
isRainbowFlagEmoji
(
'
🏳
'
)).
toBeFalsy
();
});
it
(
'
should not detect rainbow on its
\'
own
'
,
()
=>
{
expect
(
isRainbowFlagEmoji
(
'
🌈
'
)).
toBeFalsy
();
});
it
(
'
should not detect flag_white with something else
'
,
()
=>
{
expect
(
isRainbowFlagEmoji
(
'
🏳🔵
'
)).
toBeFalsy
();
});
...
...
@@ -240,15 +252,19 @@ describe('gl_emoji', () => {
it
(
'
should gracefully handle empty string
'
,
()
=>
{
expect
(
isKeycapEmoji
(
''
)).
toBeFalsy
();
});
it
(
'
should detect one(keycap)
'
,
()
=>
{
expect
(
isKeycapEmoji
(
'
1️⃣
'
)).
toBeTruthy
();
});
it
(
'
should detect nine(keycap)
'
,
()
=>
{
expect
(
isKeycapEmoji
(
'
9️⃣
'
)).
toBeTruthy
();
});
it
(
'
should not detect ten(keycap)
'
,
()
=>
{
expect
(
isKeycapEmoji
(
'
🔟
'
)).
toBeFalsy
();
});
it
(
'
should not detect hash(keycap)
'
,
()
=>
{
expect
(
isKeycapEmoji
(
'
#⃣
'
)).
toBeFalsy
();
});
...
...
@@ -258,24 +274,31 @@ describe('gl_emoji', () => {
it
(
'
should gracefully handle empty string
'
,
()
=>
{
expect
(
isSkinToneComboEmoji
(
''
)).
toBeFalsy
();
});
it
(
'
should detect hand_splayed_tone5
'
,
()
=>
{
expect
(
isSkinToneComboEmoji
(
'
🖐🏿
'
)).
toBeTruthy
();
});
it
(
'
should not detect hand_splayed
'
,
()
=>
{
expect
(
isSkinToneComboEmoji
(
'
🖐
'
)).
toBeFalsy
();
});
it
(
'
should detect lifter_tone1
'
,
()
=>
{
expect
(
isSkinToneComboEmoji
(
'
🏋🏻
'
)).
toBeTruthy
();
});
it
(
'
should not detect lifter
'
,
()
=>
{
expect
(
isSkinToneComboEmoji
(
'
🏋
'
)).
toBeFalsy
();
});
it
(
'
should detect rowboat_tone4
'
,
()
=>
{
expect
(
isSkinToneComboEmoji
(
'
🚣🏾
'
)).
toBeTruthy
();
});
it
(
'
should not detect rowboat
'
,
()
=>
{
expect
(
isSkinToneComboEmoji
(
'
🚣
'
)).
toBeFalsy
();
});
it
(
'
should not detect individual tone emoji
'
,
()
=>
{
expect
(
isSkinToneComboEmoji
(
'
🏻
'
)).
toBeFalsy
();
});
...
...
@@ -285,9 +308,11 @@ describe('gl_emoji', () => {
it
(
'
should gracefully handle empty string
'
,
()
=>
{
expect
(
isHorceRacingSkinToneComboEmoji
(
''
)).
toBeFalsy
();
});
it
(
'
should detect horse_racing_tone2
'
,
()
=>
{
expect
(
isHorceRacingSkinToneComboEmoji
(
'
🏇🏼
'
)).
toBeTruthy
();
});
it
(
'
should not detect horse_racing
'
,
()
=>
{
expect
(
isHorceRacingSkinToneComboEmoji
(
'
🏇
'
)).
toBeFalsy
();
});
...
...
@@ -297,36 +322,47 @@ describe('gl_emoji', () => {
it
(
'
should gracefully handle empty string
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
''
)).
toBeFalsy
();
});
it
(
'
should detect couple_mm
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
'
👨❤️👨
'
)).
toBeTruthy
();
});
it
(
'
should not detect couple_with_heart
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
'
💑
'
)).
toBeFalsy
();
});
it
(
'
should not detect couplekiss
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
'
💏
'
)).
toBeFalsy
();
});
it
(
'
should detect family_mmb
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
'
👨👨👦
'
)).
toBeTruthy
();
});
it
(
'
should detect family_mwgb
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
'
👨👩👧👦
'
)).
toBeTruthy
();
});
it
(
'
should not detect family
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
'
👪
'
)).
toBeFalsy
();
});
it
(
'
should detect kiss_ww
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
'
👩❤️💋👩
'
)).
toBeTruthy
();
});
it
(
'
should not detect girl
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
'
👧
'
)).
toBeFalsy
();
});
it
(
'
should not detect girl_tone5
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
'
👧🏿
'
)).
toBeFalsy
();
});
it
(
'
should not detect man
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
'
👨
'
)).
toBeFalsy
();
});
it
(
'
should not detect woman
'
,
()
=>
{
expect
(
isPersonZwjEmoji
(
'
👩
'
)).
toBeFalsy
();
});
...
...
@@ -341,6 +377,7 @@ describe('gl_emoji', () => {
);
expect
(
isSupported
).
toBeTruthy
();
});
it
(
'
should gracefully handle empty string without unicode support
'
,
()
=>
{
const
isSupported
=
isEmojiUnicodeSupported
(
{},
...
...
@@ -349,6 +386,7 @@ describe('gl_emoji', () => {
);
expect
(
isSupported
).
toBeFalsy
();
});
it
(
'
bomb(6.0) with 6.0 support
'
,
()
=>
{
const
emojiKey
=
'
bomb
'
;
const
unicodeSupportMap
=
Object
.
assign
({},
emptySupportMap
,
{
...
...
spec/javascripts/graphs/stat_graph_contributors_util_spec.js
View file @
2a76e040
...
...
@@ -205,10 +205,12 @@ describe("ContributorsStatGraphUtil", function () {
it
(
"
returns true if date_range is null
"
,
function
()
{
expect
(
ContributorsStatGraphUtil
.
in_range
(
date
,
null
)).
toEqual
(
true
);
});
it
(
"
returns true if date is in range
"
,
function
()
{
var
date_range
=
[
new
Date
(
"
2013-01-01
"
),
new
Date
(
"
2013-12-12
"
)];
expect
(
ContributorsStatGraphUtil
.
in_range
(
date
,
date_range
)).
toEqual
(
true
);
});
it
(
"
returns false if date is not in range
"
,
function
()
{
var
date_range
=
[
new
Date
(
"
1999-12-01
"
),
new
Date
(
"
2000-12-01
"
)];
expect
(
ContributorsStatGraphUtil
.
in_range
(
date
,
date_range
)).
toEqual
(
false
);
...
...
spec/javascripts/jobs/components/job_log_controllers_spec.js
View file @
2a76e040
...
...
@@ -25,6 +25,7 @@ describe('Job log controllers', () => {
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
props
);
});
it
(
'
renders size information
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-truncated-info
'
).
textContent
).
toContain
(
'
499.95 KiB
'
);
});
...
...
spec/javascripts/lib/utils/common_utils_spec.js
View file @
2a76e040
...
...
@@ -9,6 +9,7 @@ describe('common_utils', () => {
it
(
'
returns an anchor tag with url
'
,
()
=>
{
expect
(
commonUtils
.
parseUrl
(
'
/some/absolute/url
'
).
pathname
).
toContain
(
'
some/absolute/url
'
);
});
it
(
'
url is escaped
'
,
()
=>
{
// IE11 will return a relative pathname while other browsers will return a full pathname.
// parseUrl uses an anchor element for parsing an url. With relative urls, the anchor
...
...
spec/javascripts/line_highlighter_spec.js
View file @
2a76e040
...
...
@@ -23,17 +23,20 @@ import LineHighlighter from '~/line_highlighter';
__setLocationHash__
:
spyOn
(
this
[
"
class
"
],
'
__setLocationHash__
'
).
and
.
callFake
(
function
()
{})
};
});
describe
(
'
behavior
'
,
function
()
{
it
(
'
highlights one line given in the URL hash
'
,
function
()
{
new
LineHighlighter
({
hash
:
'
#L13
'
});
return
expect
(
$
(
'
#LC13
'
)).
toHaveClass
(
this
.
css
);
});
it
(
'
highlights one line given in the URL hash with given CSS class name
'
,
function
()
{
const
hiliter
=
new
LineHighlighter
({
hash
:
'
#L13
'
,
highlightLineClass
:
'
hilite
'
});
expect
(
hiliter
.
highlightLineClass
).
toBe
(
'
hilite
'
);
expect
(
$
(
'
#LC13
'
)).
toHaveClass
(
'
hilite
'
);
expect
(
$
(
'
#LC13
'
)).
not
.
toHaveClass
(
'
hll
'
);
});
it
(
'
highlights a range of lines given in the URL hash
'
,
function
()
{
var
line
,
results
;
new
LineHighlighter
({
hash
:
'
#L5-25
'
});
...
...
@@ -44,18 +47,21 @@ import LineHighlighter from '~/line_highlighter';
}
return
results
;
});
it
(
'
scrolls to the first highlighted line on initial load
'
,
function
()
{
var
spy
;
spy
=
spyOn
(
$
,
'
scrollTo
'
);
new
LineHighlighter
({
hash
:
'
#L5-25
'
});
return
expect
(
spy
).
toHaveBeenCalledWith
(
'
#L5
'
,
jasmine
.
anything
());
});
it
(
'
discards click events
'
,
function
()
{
var
spy
;
spy
=
spyOnEvent
(
'
a[data-line-number]
'
,
'
click
'
);
clickLine
(
13
);
return
expect
(
spy
).
toHaveBeenPrevented
();
});
it
(
'
handles garbage input from the hash
'
,
function
()
{
var
func
;
func
=
function
()
{
...
...
@@ -64,6 +70,7 @@ import LineHighlighter from '~/line_highlighter';
return
expect
(
func
).
not
.
toThrow
();
});
});
describe
(
'
clickHandler
'
,
function
()
{
it
(
'
handles clicking on a child icon element
'
,
function
()
{
var
spy
;
...
...
@@ -72,11 +79,13 @@ import LineHighlighter from '~/line_highlighter';
expect
(
spy
).
toHaveBeenCalledWith
(
13
);
return
expect
(
$
(
'
#LC13
'
)).
toHaveClass
(
this
.
css
);
});
describe
(
'
without shiftKey
'
,
function
()
{
it
(
'
highlights one line when clicked
'
,
function
()
{
clickLine
(
13
);
return
expect
(
$
(
'
#LC13
'
)).
toHaveClass
(
this
.
css
);
});
it
(
'
unhighlights previously highlighted lines
'
,
function
()
{
clickLine
(
13
);
clickLine
(
20
);
...
...
@@ -101,6 +110,7 @@ import LineHighlighter from '~/line_highlighter';
expect
(
spy
).
toHaveBeenCalledWith
(
13
);
return
expect
(
spy
).
toHaveBeenCalledWith
(
13
,
20
);
});
describe
(
'
without existing highlight
'
,
function
()
{
it
(
'
highlights the clicked line
'
,
function
()
{
clickLine
(
13
,
{
...
...
@@ -118,6 +128,7 @@ import LineHighlighter from '~/line_highlighter';
return
expect
(
spy
).
toHaveBeenCalledWith
(
13
);
});
});
describe
(
'
with existing single-line highlight
'
,
function
()
{
it
(
'
uses existing line as last line when target is lesser
'
,
function
()
{
var
line
,
results
;
...
...
@@ -155,6 +166,7 @@ import LineHighlighter from '~/line_highlighter';
shiftKey
:
true
});
});
it
(
'
uses target as first line when it is less than existing first line
'
,
function
()
{
var
line
,
results
;
clickLine
(
5
,
{
...
...
@@ -182,13 +194,16 @@ import LineHighlighter from '~/line_highlighter';
});
});
});
describe
(
'
hashToRange
'
,
function
()
{
beforeEach
(
function
()
{
return
this
.
subject
=
this
[
"
class
"
].
hashToRange
;
});
it
(
'
extracts a single line number from the hash
'
,
function
()
{
return
expect
(
this
.
subject
(
'
#L5
'
)).
toEqual
([
5
,
null
]);
});
it
(
'
extracts a range of line numbers from the hash
'
,
function
()
{
return
expect
(
this
.
subject
(
'
#L5-15
'
)).
toEqual
([
5
,
15
]);
});
...
...
@@ -196,10 +211,12 @@ import LineHighlighter from '~/line_highlighter';
return
expect
(
this
.
subject
(
'
#foo
'
)).
toEqual
([
null
,
null
]);
});
});
describe
(
'
highlightLine
'
,
function
()
{
beforeEach
(
function
()
{
return
this
.
subject
=
this
[
"
class
"
].
highlightLine
;
});
it
(
'
highlights the specified line
'
,
function
()
{
this
.
subject
(
13
);
return
expect
(
$
(
'
#LC13
'
)).
toHaveClass
(
this
.
css
);
...
...
@@ -213,6 +230,7 @@ import LineHighlighter from '~/line_highlighter';
beforeEach
(
function
()
{
return
this
.
subject
=
this
[
"
class
"
].
setHash
;
});
it
(
'
sets the location hash for a single line
'
,
function
()
{
this
.
subject
(
5
);
return
expect
(
this
.
spies
.
__setLocationHash__
).
toHaveBeenCalledWith
(
'
#L5
'
);
...
...
spec/javascripts/new_branch_spec.js
View file @
2a76e040
...
...
@@ -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
);
...
...
spec/javascripts/notes/components/note_form_spec.js
View file @
2a76e040
...
...
@@ -100,6 +100,7 @@ describe('issue_note_form component', () => {
expect
(
vm
.
handleUpdate
).
toHaveBeenCalled
();
});
it
(
'
should save note when ctrl+enter is pressed
'
,
()
=>
{
spyOn
(
vm
,
'
handleUpdate
'
).
and
.
callThrough
();
vm
.
$el
.
querySelector
(
'
textarea
'
).
value
=
'
Foo
'
;
...
...
spec/javascripts/reports/components/report_section_spec.js
View file @
2a76e040
...
...
@@ -86,6 +86,7 @@ describe('Report section', () => {
});
});
});
describe
(
'
when it is loading
'
,
()
=>
{
it
(
'
should render loading indicator
'
,
()
=>
{
vm
=
mountComponent
(
ReportSection
,
{
...
...
spec/javascripts/right_sidebar_spec.js
View file @
2a76e040
...
...
@@ -60,10 +60,12 @@ import Sidebar from '~/right_sidebar';
$toggle
.
click
();
assertSidebarState
(
'
expanded
'
);
});
it
(
'
should float over the page and when sidebar icons clicked
'
,
function
()
{
$labelsIcon
.
click
();
return
assertSidebarState
(
'
expanded
'
);
});
it
(
'
should collapse when the icon arrow clicked while it is floating on page
'
,
function
()
{
$labelsIcon
.
click
();
assertSidebarState
(
'
expanded
'
);
...
...
spec/javascripts/search_autocomplete_spec.js
View file @
2a76e040
...
...
@@ -140,6 +140,7 @@ describe('Search autocomplete dropdown', () => {
removeBodyAttributes
();
window
.
gon
=
{};
});
it
(
'
should show Dashboard specific dropdown menu
'
,
function
()
{
var
list
;
addBodyAttributes
();
...
...
@@ -148,6 +149,7 @@ describe('Search autocomplete dropdown', () => {
list
=
widget
.
wrap
.
find
(
'
.dropdown-menu
'
).
find
(
'
ul
'
);
return
assertLinks
(
list
,
dashboardIssuesPath
,
dashboardMRsPath
);
});
it
(
'
should show Group specific dropdown menu
'
,
function
()
{
var
list
;
addBodyAttributes
(
'
group
'
);
...
...
@@ -156,6 +158,7 @@ describe('Search autocomplete dropdown', () => {
list
=
widget
.
wrap
.
find
(
'
.dropdown-menu
'
).
find
(
'
ul
'
);
return
assertLinks
(
list
,
groupIssuesPath
,
groupMRsPath
);
});
it
(
'
should show Project specific dropdown menu
'
,
function
()
{
var
list
;
addBodyAttributes
(
'
project
'
);
...
...
@@ -164,6 +167,7 @@ describe('Search autocomplete dropdown', () => {
list
=
widget
.
wrap
.
find
(
'
.dropdown-menu
'
).
find
(
'
ul
'
);
return
assertLinks
(
list
,
projectIssuesPath
,
projectMRsPath
);
});
it
(
'
should show only Project mergeRequest dropdown menu items when project issues are disabled
'
,
function
()
{
addBodyAttributes
(
'
project
'
);
disableProjectIssues
();
...
...
@@ -172,6 +176,7 @@ describe('Search autocomplete dropdown', () => {
const
list
=
widget
.
wrap
.
find
(
'
.dropdown-menu
'
).
find
(
'
ul
'
);
assertLinks
(
list
,
null
,
projectMRsPath
);
});
it
(
'
should not show category related menu if there is text in the input
'
,
function
()
{
var
link
,
list
;
addBodyAttributes
(
'
project
'
);
...
...
@@ -182,6 +187,7 @@ describe('Search autocomplete dropdown', () => {
link
=
"
a[href='
"
+
projectIssuesPath
+
'
/?assignee_id=
'
+
userId
+
"
']
"
;
return
expect
(
list
.
find
(
link
).
length
).
toBe
(
0
);
});
it
(
'
should not submit the search form when selecting an autocomplete row with the keyboard
'
,
function
()
{
var
ENTER
=
13
;
var
DOWN
=
40
;
...
...
spec/javascripts/syntax_highlight_spec.js
View file @
2a76e040
...
...
@@ -25,6 +25,7 @@ describe('Syntax Highlighter', function() {
beforeEach
(
function
()
{
return
setFixtures
(
"
<div class=
\"
parent
\"
>
\n
<div class=
\"
js-syntax-highlight
\"
></div>
\n
<div class=
\"
foo
\"
></div>
\n
<div class=
\"
js-syntax-highlight
\"
></div>
\n
</div>
"
);
});
it
(
'
applies highlighting to all applicable children
'
,
function
()
{
stubUserColorScheme
(
'
monokai
'
);
syntaxHighlight
(
$
(
'
.parent
'
));
...
...
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