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
97dc95b1
Commit
97dc95b1
authored
Sep 16, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed tests
parent
8962a335
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+9
-6
sticky_tabs_spec.rb
spec/features/merge_requests/sticky_tabs_spec.rb
+7
-3
No files found.
app/assets/javascripts/merge_request_tabs.js
View file @
97dc95b1
...
...
@@ -369,18 +369,21 @@
};
MergeRequestTabs
.
prototype
.
initAffix
=
function
()
{
var
$tabs
=
$
(
'.js-tabs-affix'
);
// Screen space on small screens is usually very sparse
// So we dont affix the tabs on these
if
(
Breakpoints
.
get
().
getBreakpointSize
()
===
'xs'
)
return
;
if
(
Breakpoints
.
get
().
getBreakpointSize
()
===
'xs'
||
!
$tabs
.
length
)
return
;
var
$tabs
=
$
(
'.js-tabs-affix'
),
tabsWidth
=
$tabs
.
outerWidth
(),
$diffTabs
=
$
(
'#diff-notes-app'
),
offsetTop
=
$tabs
.
offset
().
top
-
(
$
(
'.navbar-fixed-top'
).
height
()
+
$
(
'.layout-nav'
).
height
());
var
tabsWidth
=
$tabs
.
outerWidth
(),
$diffTabs
=
$
(
'#diff-notes-app'
),
offsetTop
=
$tabs
.
offset
().
top
-
(
$
(
'.navbar-fixed-top'
).
height
()
+
$
(
'.layout-nav'
).
height
());
$tabs
.
off
(
'affix.bs.affix affix-top.bs.affix'
)
.
affix
({
offset
:
offsetTop
offset
:
{
top
:
offsetTop
}
}).
on
(
'affix.bs.affix'
,
function
()
{
$tabs
.
css
({
left
:
$tabs
.
offset
().
left
,
...
...
spec/features/merge_requests/sticky_tabs_spec.rb
View file @
97dc95b1
require
'spec_helper'
feature
'Merge request tabs'
,
js:
true
,
feature:
true
do
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:merge_request
)
{
create
(
:merge_request_with_diffs
,
source_project:
project
,
author:
user
,
title:
"Bug NS-04"
)
}
...
...
@@ -9,18 +11,20 @@ feature 'Merge request tabs', js: true, feature: true do
project
.
team
<<
[
user
,
:master
]
login_as
user
visit
diffs_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
)
wait_for_ajax
end
it
'affixes to top of page when scrolling'
do
page
.
execute_script
"window.scroll
By
(0,10000)"
page
.
execute_script
"window.scroll(0,10000)"
expect
(
page
).
to
have_selector
(
'.js-tabs-affix.affix'
)
end
it
'removes affix when scrolling to top'
do
page
.
execute_script
"window.scroll
By
(0,10000)"
page
.
execute_script
"window.scroll(0,10000)"
expect
(
page
).
to
have_selector
(
'.js-tabs-affix.affix'
)
page
.
execute_script
"window.scroll
By
(0,-10000)"
page
.
execute_script
"window.scroll(0,-10000)"
expect
(
page
).
to
have_selector
(
'.js-tabs-affix.affix-top'
)
end
end
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