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
ae62fc05
Commit
ae62fc05
authored
Apr 06, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes failing spec
parent
0dd3ce62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+2
-0
spec/javascripts/merge_request_tabs_spec.js
spec/javascripts/merge_request_tabs_spec.js
+14
-1
No files found.
app/assets/javascripts/merge_request_tabs.js
View file @
ae62fc05
...
@@ -90,6 +90,7 @@ import './flash';
...
@@ -90,6 +90,7 @@ import './flash';
.
on
(
'
click
'
,
this
.
clickTab
);
.
on
(
'
click
'
,
this
.
clickTab
);
}
}
// Used in tests
unbindEvents
()
{
unbindEvents
()
{
$
(
document
)
$
(
document
)
.
off
(
'
shown.bs.tab
'
,
'
.merge-request-tabs a[data-toggle="tab"]
'
,
this
.
tabShown
)
.
off
(
'
shown.bs.tab
'
,
'
.merge-request-tabs a[data-toggle="tab"]
'
,
this
.
tabShown
)
...
@@ -103,6 +104,7 @@ import './flash';
...
@@ -103,6 +104,7 @@ import './flash';
if
(
this
.
commitPipelinesTable
)
{
if
(
this
.
commitPipelinesTable
)
{
document
.
querySelector
(
'
#commit-pipeline-table-view
'
)
document
.
querySelector
(
'
#commit-pipeline-table-view
'
)
.
removeChild
(
this
.
commitPipelinesTable
.
$el
);
.
removeChild
(
this
.
commitPipelinesTable
.
$el
);
this
.
commitPipelinesTable
.
$destroy
();
this
.
commitPipelinesTable
.
$destroy
();
}
}
}
}
...
...
spec/javascripts/merge_request_tabs_spec.js
View file @
ae62fc05
...
@@ -39,7 +39,8 @@ require('vendor/jquery.scrollTo');
...
@@ -39,7 +39,8 @@ require('vendor/jquery.scrollTo');
});
});
afterEach
(
function
()
{
afterEach
(
function
()
{
this
.
class
.
destroy
();
this
.
class
.
unbindEvents
();
this
.
class
.
destroyPipelinesView
();
});
});
describe
(
'
#activateTab
'
,
function
()
{
describe
(
'
#activateTab
'
,
function
()
{
...
@@ -65,6 +66,7 @@ require('vendor/jquery.scrollTo');
...
@@ -65,6 +66,7 @@ require('vendor/jquery.scrollTo');
expect
(
$
(
'
#diffs
'
)).
toHaveClass
(
'
active
'
);
expect
(
$
(
'
#diffs
'
)).
toHaveClass
(
'
active
'
);
});
});
});
});
describe
(
'
#opensInNewTab
'
,
function
()
{
describe
(
'
#opensInNewTab
'
,
function
()
{
var
tabUrl
;
var
tabUrl
;
var
windowTarget
=
'
_blank
'
;
var
windowTarget
=
'
_blank
'
;
...
@@ -116,6 +118,7 @@ require('vendor/jquery.scrollTo');
...
@@ -116,6 +118,7 @@ require('vendor/jquery.scrollTo');
stopImmediatePropagation
:
function
()
{}
stopImmediatePropagation
:
function
()
{}
});
});
});
});
it
(
'
opens page tab in a new browser tab with Cmd+Click - Mac
'
,
function
()
{
it
(
'
opens page tab in a new browser tab with Cmd+Click - Mac
'
,
function
()
{
spyOn
(
window
,
'
open
'
).
and
.
callFake
(
function
(
url
,
name
)
{
spyOn
(
window
,
'
open
'
).
and
.
callFake
(
function
(
url
,
name
)
{
expect
(
url
).
toEqual
(
tabUrl
);
expect
(
url
).
toEqual
(
tabUrl
);
...
@@ -129,6 +132,7 @@ require('vendor/jquery.scrollTo');
...
@@ -129,6 +132,7 @@ require('vendor/jquery.scrollTo');
stopImmediatePropagation
:
function
()
{}
stopImmediatePropagation
:
function
()
{}
});
});
});
});
it
(
'
opens page tab in a new browser tab with Middle-click - Mac/PC
'
,
function
()
{
it
(
'
opens page tab in a new browser tab with Middle-click - Mac/PC
'
,
function
()
{
spyOn
(
window
,
'
open
'
).
and
.
callFake
(
function
(
url
,
name
)
{
spyOn
(
window
,
'
open
'
).
and
.
callFake
(
function
(
url
,
name
)
{
expect
(
url
).
toEqual
(
tabUrl
);
expect
(
url
).
toEqual
(
tabUrl
);
...
@@ -149,6 +153,7 @@ require('vendor/jquery.scrollTo');
...
@@ -149,6 +153,7 @@ require('vendor/jquery.scrollTo');
spyOn
(
$
,
'
ajax
'
).
and
.
callFake
(
function
()
{});
spyOn
(
$
,
'
ajax
'
).
and
.
callFake
(
function
()
{});
this
.
subject
=
this
.
class
.
setCurrentAction
;
this
.
subject
=
this
.
class
.
setCurrentAction
;
});
});
it
(
'
changes from commits
'
,
function
()
{
it
(
'
changes from commits
'
,
function
()
{
setLocation
({
setLocation
({
pathname
:
'
/foo/bar/merge_requests/1/commits
'
pathname
:
'
/foo/bar/merge_requests/1/commits
'
...
@@ -156,13 +161,16 @@ require('vendor/jquery.scrollTo');
...
@@ -156,13 +161,16 @@ require('vendor/jquery.scrollTo');
expect
(
this
.
subject
(
'
notes
'
)).
toBe
(
'
/foo/bar/merge_requests/1
'
);
expect
(
this
.
subject
(
'
notes
'
)).
toBe
(
'
/foo/bar/merge_requests/1
'
);
expect
(
this
.
subject
(
'
diffs
'
)).
toBe
(
'
/foo/bar/merge_requests/1/diffs
'
);
expect
(
this
.
subject
(
'
diffs
'
)).
toBe
(
'
/foo/bar/merge_requests/1/diffs
'
);
});
});
it
(
'
changes from diffs
'
,
function
()
{
it
(
'
changes from diffs
'
,
function
()
{
setLocation
({
setLocation
({
pathname
:
'
/foo/bar/merge_requests/1/diffs
'
pathname
:
'
/foo/bar/merge_requests/1/diffs
'
});
});
expect
(
this
.
subject
(
'
notes
'
)).
toBe
(
'
/foo/bar/merge_requests/1
'
);
expect
(
this
.
subject
(
'
notes
'
)).
toBe
(
'
/foo/bar/merge_requests/1
'
);
expect
(
this
.
subject
(
'
commits
'
)).
toBe
(
'
/foo/bar/merge_requests/1/commits
'
);
expect
(
this
.
subject
(
'
commits
'
)).
toBe
(
'
/foo/bar/merge_requests/1/commits
'
);
});
});
it
(
'
changes from diffs.html
'
,
function
()
{
it
(
'
changes from diffs.html
'
,
function
()
{
setLocation
({
setLocation
({
pathname
:
'
/foo/bar/merge_requests/1/diffs.html
'
pathname
:
'
/foo/bar/merge_requests/1/diffs.html
'
...
@@ -170,6 +178,7 @@ require('vendor/jquery.scrollTo');
...
@@ -170,6 +178,7 @@ require('vendor/jquery.scrollTo');
expect
(
this
.
subject
(
'
notes
'
)).
toBe
(
'
/foo/bar/merge_requests/1
'
);
expect
(
this
.
subject
(
'
notes
'
)).
toBe
(
'
/foo/bar/merge_requests/1
'
);
expect
(
this
.
subject
(
'
commits
'
)).
toBe
(
'
/foo/bar/merge_requests/1/commits
'
);
expect
(
this
.
subject
(
'
commits
'
)).
toBe
(
'
/foo/bar/merge_requests/1/commits
'
);
});
});
it
(
'
changes from notes
'
,
function
()
{
it
(
'
changes from notes
'
,
function
()
{
setLocation
({
setLocation
({
pathname
:
'
/foo/bar/merge_requests/1
'
pathname
:
'
/foo/bar/merge_requests/1
'
...
@@ -177,6 +186,7 @@ require('vendor/jquery.scrollTo');
...
@@ -177,6 +186,7 @@ require('vendor/jquery.scrollTo');
expect
(
this
.
subject
(
'
diffs
'
)).
toBe
(
'
/foo/bar/merge_requests/1/diffs
'
);
expect
(
this
.
subject
(
'
diffs
'
)).
toBe
(
'
/foo/bar/merge_requests/1/diffs
'
);
expect
(
this
.
subject
(
'
commits
'
)).
toBe
(
'
/foo/bar/merge_requests/1/commits
'
);
expect
(
this
.
subject
(
'
commits
'
)).
toBe
(
'
/foo/bar/merge_requests/1/commits
'
);
});
});
it
(
'
includes search parameters and hash string
'
,
function
()
{
it
(
'
includes search parameters and hash string
'
,
function
()
{
setLocation
({
setLocation
({
pathname
:
'
/foo/bar/merge_requests/1/diffs
'
,
pathname
:
'
/foo/bar/merge_requests/1/diffs
'
,
...
@@ -185,6 +195,7 @@ require('vendor/jquery.scrollTo');
...
@@ -185,6 +195,7 @@ require('vendor/jquery.scrollTo');
});
});
expect
(
this
.
subject
(
'
show
'
)).
toBe
(
'
/foo/bar/merge_requests/1?view=parallel#L15-35
'
);
expect
(
this
.
subject
(
'
show
'
)).
toBe
(
'
/foo/bar/merge_requests/1?view=parallel#L15-35
'
);
});
});
it
(
'
replaces the current history state
'
,
function
()
{
it
(
'
replaces the current history state
'
,
function
()
{
var
newState
;
var
newState
;
setLocation
({
setLocation
({
...
@@ -197,6 +208,7 @@ require('vendor/jquery.scrollTo');
...
@@ -197,6 +208,7 @@ require('vendor/jquery.scrollTo');
},
document
.
title
,
newState
);
},
document
.
title
,
newState
);
}
}
});
});
it
(
'
treats "show" like "notes"
'
,
function
()
{
it
(
'
treats "show" like "notes"
'
,
function
()
{
setLocation
({
setLocation
({
pathname
:
'
/foo/bar/merge_requests/1/commits
'
pathname
:
'
/foo/bar/merge_requests/1/commits
'
...
@@ -207,6 +219,7 @@ require('vendor/jquery.scrollTo');
...
@@ -207,6 +219,7 @@ require('vendor/jquery.scrollTo');
describe
(
'
#tabShown
'
,
()
=>
{
describe
(
'
#tabShown
'
,
()
=>
{
beforeEach
(
function
()
{
beforeEach
(
function
()
{
spyOn
(
$
,
'
ajax
'
).
and
.
callFake
(
function
()
{});
loadFixtures
(
'
merge_requests/merge_request_with_task_list.html.raw
'
);
loadFixtures
(
'
merge_requests/merge_request_with_task_list.html.raw
'
);
});
});
...
...
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