BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
cd40278b
Commit
cd40278b
authored
Jun 12, 2017
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/fix-9-2-stable-conflicts-for-mr-11700' into 9-2-stable
parents
1e24ed3a
0ef4d3cc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
2 deletions
+61
-2
merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+1
-1
merge_requests.rb
spec/javascripts/fixtures/merge_requests.rb
+16
-0
merge_request_tabs_spec.js
spec/javascripts/merge_request_tabs_spec.js
+44
-1
No files found.
app/assets/javascripts/merge_request_tabs.js
View file @
cd40278b
...
...
@@ -285,7 +285,7 @@ import BlobForkSuggestion from './blob/blob_fork_suggestion';
// Similar to `toggler_behavior` in the discussion tab
const
hash
=
window
.
gl
.
utils
.
getLocationHash
();
const
anchor
=
hash
&&
$container
.
find
(
`[id="
${
hash
}
"]`
);
if
(
anchor
)
{
if
(
anchor
&&
anchor
.
length
>
0
)
{
const
notesContent
=
anchor
.
closest
(
'.notes_content'
);
const
lineType
=
notesContent
.
hasClass
(
'new'
)
?
'new'
:
'old'
;
notes
.
toggleDiffNote
({
...
...
spec/javascripts/fixtures/merge_requests.rb
View file @
cd40278b
...
...
@@ -16,6 +16,16 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
sha:
merge_request
.
diff_head_sha
)
end
let
(
:path
)
{
"files/ruby/popen.rb"
}
let
(
:position
)
do
Gitlab
::
Diff
::
Position
.
new
(
old_path:
path
,
new_path:
path
,
old_line:
nil
,
new_line:
14
,
diff_refs:
merge_request
.
diff_refs
)
end
render_views
...
...
@@ -39,6 +49,12 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
render_merge_request
(
example
.
description
,
merged_merge_request
)
end
it
'merge_requests/diff_comment.html.raw'
do
|
example
|
create
(
:diff_note_on_merge_request
,
project:
project
,
author:
admin
,
position:
position
,
noteable:
merge_request
)
create
(
:note_on_merge_request
,
author:
admin
,
project:
project
,
noteable:
merge_request
)
render_merge_request
(
example
.
description
,
merge_request
)
end
private
def
render_merge_request
(
fixture_file_name
,
merge_request
)
...
...
spec/javascripts/merge_request_tabs_spec.js
View file @
cd40278b
/* eslint-disable no-var, comma-dangle, object-shorthand */
/* global Notes */
require
(
'~/merge_request_tabs'
);
require
(
'~/commit/pipelines/pipelines_bundle.js'
);
...
...
@@ -7,6 +8,7 @@ require('~/lib/utils/common_utils');
require
(
'~/diff'
);
require
(
'~/single_file_diff'
);
require
(
'~/files_comment_button'
);
require
(
'~/notes'
);
require
(
'vendor/jquery.scrollTo'
);
(
function
()
{
...
...
@@ -29,7 +31,7 @@ require('vendor/jquery.scrollTo');
};
$
.
extend
(
stubLocation
,
defaults
,
stubs
||
{});
};
preloadFixtures
(
'merge_requests/merge_request_with_task_list.html.raw'
);
preloadFixtures
(
'merge_requests/merge_request_with_task_list.html.raw'
,
'merge_requests/diff_comment.html.raw'
);
beforeEach
(
function
()
{
this
.
class
=
new
gl
.
MergeRequestTabs
({
stubLocation
:
stubLocation
});
...
...
@@ -286,8 +288,49 @@ require('vendor/jquery.scrollTo');
spyOn
(
$
,
'ajax'
).
and
.
callFake
(
function
(
options
)
{
expect
(
options
.
url
).
toEqual
(
'/foo/bar/merge_requests/1/diffs.json'
);
});
this
.
class
.
loadDiff
(
'/foo/bar/merge_requests/1/diffs'
);
});
describe
(
'with note fragment hash'
,
()
=>
{
beforeEach
(()
=>
{
loadFixtures
(
'merge_requests/diff_comment.html.raw'
);
spyOn
(
window
.
gl
.
utils
,
'getPagePath'
).
and
.
returnValue
(
'merge_requests'
);
window
.
notes
=
new
Notes
(
''
,
[]);
spyOn
(
window
.
notes
,
'toggleDiffNote'
).
and
.
callThrough
();
});
afterEach
(()
=>
{
delete
window
.
notes
;
});
it
(
'should expand and scroll to linked fragment hash #note_xxx'
,
function
()
{
const
noteId
=
'note_1'
;
spyOn
(
window
.
gl
.
utils
,
'getLocationHash'
).
and
.
returnValue
(
noteId
);
spyOn
(
$
,
'ajax'
).
and
.
callFake
(
function
(
options
)
{
options
.
success
({
html
:
`<div id="
${
noteId
}
">foo</div>`
});
});
this
.
class
.
loadDiff
(
'/foo/bar/merge_requests/1/diffs'
);
expect
(
window
.
notes
.
toggleDiffNote
).
toHaveBeenCalledWith
({
target
:
jasmine
.
any
(
Object
),
lineType
:
'old'
,
forceShow
:
true
,
});
});
it
(
'should gracefully ignore non-existant fragment hash'
,
function
()
{
spyOn
(
window
.
gl
.
utils
,
'getLocationHash'
).
and
.
returnValue
(
'note_something-that-does-not-exist'
);
spyOn
(
$
,
'ajax'
).
and
.
callFake
(
function
(
options
)
{
options
.
success
({
html
:
''
});
});
this
.
class
.
loadDiff
(
'/foo/bar/merge_requests/1/diffs'
);
expect
(
window
.
notes
.
toggleDiffNote
).
not
.
toHaveBeenCalled
();
});
});
});
});
}).
call
(
window
);
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