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
f165bda4
Commit
f165bda4
authored
Jan 31, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed failing specs
parent
58eb3c55
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
34 deletions
+43
-34
app/assets/javascripts/labels_select.js
app/assets/javascripts/labels_select.js
+6
-6
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+1
-1
spec/javascripts/issue_spec.js
spec/javascripts/issue_spec.js
+2
-2
spec/javascripts/job_spec.js
spec/javascripts/job_spec.js
+3
-5
spec/javascripts/labels_issue_sidebar_spec.js
spec/javascripts/labels_issue_sidebar_spec.js
+27
-16
spec/javascripts/merge_request_tabs_spec.js
spec/javascripts/merge_request_tabs_spec.js
+4
-4
No files found.
app/assets/javascripts/labels_select.js
View file @
f165bda4
...
@@ -102,28 +102,28 @@ export default class LabelsSelect {
...
@@ -102,28 +102,28 @@ export default class LabelsSelect {
}
}
$value
.
removeAttr
(
'
style
'
).
html
(
template
);
$value
.
removeAttr
(
'
style
'
).
html
(
template
);
$sidebarCollapsedValue
.
text
(
labelCount
);
$sidebarCollapsedValue
.
text
(
labelCount
);
if
(
data
.
labels
.
length
)
{
if
(
data
.
labels
.
length
)
{
labelTitles
=
data
.
labels
.
map
(
function
(
label
)
{
labelTitles
=
data
.
labels
.
map
(
function
(
label
)
{
return
label
.
title
;
return
label
.
title
;
});
});
if
(
labelTitles
.
length
>
5
)
{
if
(
labelTitles
.
length
>
5
)
{
labelTitles
=
labelTitles
.
slice
(
0
,
5
);
labelTitles
=
labelTitles
.
slice
(
0
,
5
);
labelTitles
.
push
(
'
and
'
+
(
data
.
labels
.
length
-
5
)
+
'
more
'
);
labelTitles
.
push
(
'
and
'
+
(
data
.
labels
.
length
-
5
)
+
'
more
'
);
}
}
labelTooltipTitle
=
labelTitles
.
join
(
'
,
'
);
labelTooltipTitle
=
labelTitles
.
join
(
'
,
'
);
}
}
else
{
else
{
labelTooltipTitle
=
''
;
labelTooltipTitle
=
''
;
$sidebarLabelTooltip
.
tooltip
(
'
destroy
'
);
$sidebarLabelTooltip
.
tooltip
(
'
destroy
'
);
}
}
$sidebarLabelTooltip
$sidebarLabelTooltip
.
attr
(
'
title
'
,
labelTooltipTitle
)
.
attr
(
'
title
'
,
labelTooltipTitle
)
.
tooltip
(
'
fixTitle
'
);
.
tooltip
(
'
fixTitle
'
);
$
(
'
.has-tooltip
'
,
$value
).
tooltip
({
$
(
'
.has-tooltip
'
,
$value
).
tooltip
({
container
:
'
body
'
container
:
'
body
'
});
});
...
@@ -168,7 +168,7 @@ export default class LabelsSelect {
...
@@ -168,7 +168,7 @@ export default class LabelsSelect {
data
=
extraData
.
concat
(
data
);
data
=
extraData
.
concat
(
data
);
}
}
}
}
callback
(
data
);
callback
(
data
);
if
(
showMenuAbove
)
{
if
(
showMenuAbove
)
{
$dropdown
.
data
(
'
glDropdown
'
).
positionMenuAbove
();
$dropdown
.
data
(
'
glDropdown
'
).
positionMenuAbove
();
...
...
app/assets/javascripts/merge_request_tabs.js
View file @
f165bda4
...
@@ -246,7 +246,7 @@ export default class MergeRequestTabs {
...
@@ -246,7 +246,7 @@ export default class MergeRequestTabs {
return
;
return
;
}
}
this
.
toggleLoading
(
true
)
this
.
toggleLoading
(
true
)
;
axios
.
get
(
`
${
source
}
.json`
)
axios
.
get
(
`
${
source
}
.json`
)
.
then
(({
data
})
=>
{
.
then
(({
data
})
=>
{
...
...
spec/javascripts/issue_spec.js
View file @
f165bda4
/* eslint-disable space-before-function-paren, one-var, one-var-declaration-per-line, no-use-before-define, comma-dangle, max-len */
/* eslint-disable space-before-function-paren, one-var, one-var-declaration-per-line, no-use-before-define, comma-dangle, max-len */
import
MockAdapt
o
r
from
'
axios-mock-adapter
'
;
import
MockAdapt
e
r
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
Issue
from
'
~/issue
'
;
import
Issue
from
'
~/issue
'
;
import
'
~/lib/utils/text_utility
'
;
import
'
~/lib/utils/text_utility
'
;
...
@@ -138,7 +138,7 @@ describe('Issue', function() {
...
@@ -138,7 +138,7 @@ describe('Issue', function() {
this
.
issueStateDeferred
=
new
jQuery
.
Deferred
();
this
.
issueStateDeferred
=
new
jQuery
.
Deferred
();
this
.
canCreateBranchDeferred
=
new
jQuery
.
Deferred
();
this
.
canCreateBranchDeferred
=
new
jQuery
.
Deferred
();
mock
=
new
MockAdapt
o
r
(
axios
);
mock
=
new
MockAdapt
e
r
(
axios
);
spyOn
(
jQuery
,
'
ajax
'
).
and
.
callFake
(
ajaxSpy
.
bind
(
this
));
spyOn
(
jQuery
,
'
ajax
'
).
and
.
callFake
(
ajaxSpy
.
bind
(
this
));
});
});
...
...
spec/javascripts/job_spec.js
View file @
f165bda4
import
MockAdapt
o
r
from
'
axios-mock-adapter
'
;
import
MockAdapt
e
r
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
numberToHumanSize
}
from
'
~/lib/utils/number_utils
'
;
import
{
numberToHumanSize
}
from
'
~/lib/utils/number_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
...
@@ -22,11 +22,9 @@ describe('Job', () => {
...
@@ -22,11 +22,9 @@ describe('Job', () => {
spyOn
(
urlUtils
,
'
visitUrl
'
);
spyOn
(
urlUtils
,
'
visitUrl
'
);
mock
=
new
MockAdapt
o
r
(
axios
);
mock
=
new
MockAdapt
e
r
(
axios
);
mock
.
onGet
(
new
RegExp
(
`
${
JOB_URL
}
/trace.json?(.*)`
)).
reply
(()
=>
{
mock
.
onGet
(
new
RegExp
(
`
${
JOB_URL
}
/trace.json?(.*)`
)).
reply
(()
=>
[
200
,
response
]);
return
[
200
,
response
];
});
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
...
spec/javascripts/labels_issue_sidebar_spec.js
View file @
f165bda4
/* eslint-disable no-new */
/* eslint-disable no-new */
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
IssuableContext
from
'
~/issuable_context
'
;
import
IssuableContext
from
'
~/issuable_context
'
;
import
LabelsSelect
from
'
~/labels_select
'
;
import
LabelsSelect
from
'
~/labels_select
'
;
...
@@ -10,35 +12,44 @@ import '~/users_select';
...
@@ -10,35 +12,44 @@ import '~/users_select';
(()
=>
{
(()
=>
{
let
saveLabelCount
=
0
;
let
saveLabelCount
=
0
;
let
mock
;
describe
(
'
Issue dropdown sidebar
'
,
()
=>
{
describe
(
'
Issue dropdown sidebar
'
,
()
=>
{
preloadFixtures
(
'
static/issue_sidebar_label.html.raw
'
);
preloadFixtures
(
'
static/issue_sidebar_label.html.raw
'
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
loadFixtures
(
'
static/issue_sidebar_label.html.raw
'
);
loadFixtures
(
'
static/issue_sidebar_label.html.raw
'
);
mock
=
new
MockAdapter
(
axios
);
new
IssuableContext
(
'
{"id":1,"name":"Administrator","username":"root"}
'
);
new
IssuableContext
(
'
{"id":1,"name":"Administrator","username":"root"}
'
);
new
LabelsSelect
();
new
LabelsSelect
();
spyOn
(
jQuery
,
'
ajax
'
).
and
.
callFake
((
req
)
=>
{
mock
.
onGet
(
'
/root/test/labels.json
'
).
reply
(()
=>
{
const
d
=
$
.
Deferred
();
const
labels
=
Array
(
10
).
fill
().
map
((
_
,
i
)
=>
({
let
LABELS_DATA
=
[];
id
:
i
,
title
:
`test
${
i
}
`
,
color
:
'
#5CB85C
'
,
}));
if
(
req
.
url
===
'
/root/test/labels.json
'
)
{
return
[
200
,
labels
];
for
(
let
i
=
0
;
i
<
10
;
i
+=
1
)
{
});
LABELS_DATA
.
push
({
id
:
i
,
title
:
`test
${
i
}
`
,
color
:
'
#5CB85C
'
});
}
mock
.
onPut
(
'
/root/test/issues/2.json
'
).
reply
(()
=>
{
}
else
if
(
req
.
url
===
'
/root/test/issues/2.json
'
)
{
const
labels
=
Array
(
saveLabelCount
).
fill
().
map
((
_
,
i
)
=>
({
const
tmp
=
[];
id
:
i
,
for
(
let
i
=
0
;
i
<
saveLabelCount
;
i
+=
1
)
{
title
:
`test
${
i
}
`
,
tmp
.
push
({
id
:
i
,
title
:
`test
${
i
}
`
,
color
:
'
#5CB85C
'
});
color
:
'
#5CB85C
'
,
}
}));
LABELS_DATA
=
{
labels
:
tmp
};
}
d
.
resolve
(
LABELS_DATA
);
return
[
200
,
{
labels
}];
return
d
.
promise
();
});
});
});
});
afterEach
(()
=>
{
mock
.
restore
();
});
it
(
'
changes collapsed tooltip when changing labels when less than 5
'
,
(
done
)
=>
{
it
(
'
changes collapsed tooltip when changing labels when less than 5
'
,
(
done
)
=>
{
saveLabelCount
=
5
;
saveLabelCount
=
5
;
$
(
'
.edit-link
'
).
get
(
0
).
click
();
$
(
'
.edit-link
'
).
get
(
0
).
click
();
...
...
spec/javascripts/merge_request_tabs_spec.js
View file @
f165bda4
/* eslint-disable no-var, comma-dangle, object-shorthand */
/* eslint-disable no-var, comma-dangle, object-shorthand */
import
MockAdapt
o
r
from
'
axios-mock-adapter
'
;
import
MockAdapt
e
r
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
MergeRequestTabs
from
'
~/merge_request_tabs
'
;
import
MergeRequestTabs
from
'
~/merge_request_tabs
'
;
...
@@ -218,7 +218,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -218,7 +218,7 @@ import 'vendor/jquery.scrollTo';
let
mock
;
let
mock
;
beforeEach
(
function
()
{
beforeEach
(
function
()
{
mock
=
new
MockAdapt
o
r
(
axios
);
mock
=
new
MockAdapt
e
r
(
axios
);
mock
.
onGet
(
/
(
.*
)\/
diffs
\.
json/
).
reply
(
200
,
{
mock
.
onGet
(
/
(
.*
)\/
diffs
\.
json/
).
reply
(
200
,
{
data
:
{
html
:
''
},
data
:
{
html
:
''
},
});
});
...
@@ -344,7 +344,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -344,7 +344,7 @@ import 'vendor/jquery.scrollTo';
.
attr
(
'
href
'
)
.
attr
(
'
href
'
)
.
replace
(
'
#
'
,
''
);
.
replace
(
'
#
'
,
''
);
mock
=
new
MockAdapt
o
r
(
axios
);
mock
=
new
MockAdapt
e
r
(
axios
);
mock
.
onGet
(
/
(
.*
)\/
diffs
\.
json/
).
reply
(
200
,
diffsResponse
);
mock
.
onGet
(
/
(
.*
)\/
diffs
\.
json/
).
reply
(
200
,
diffsResponse
);
});
});
...
@@ -410,7 +410,7 @@ import 'vendor/jquery.scrollTo';
...
@@ -410,7 +410,7 @@ import 'vendor/jquery.scrollTo';
.
attr
(
'
href
'
)
.
attr
(
'
href
'
)
.
replace
(
'
#
'
,
''
);
.
replace
(
'
#
'
,
''
);
mock
=
new
MockAdapt
o
r
(
axios
);
mock
=
new
MockAdapt
e
r
(
axios
);
mock
.
onGet
(
/
(
.*
)\/
diffs
\.
json/
).
reply
(
200
,
diffsResponse
);
mock
.
onGet
(
/
(
.*
)\/
diffs
\.
json/
).
reply
(
200
,
diffsResponse
);
});
});
...
...
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