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