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
d2362e2e
Commit
d2362e2e
authored
Jun 08, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests fix for ref switcher
parent
deca5ef2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
16 deletions
+37
-16
app/assets/stylesheets/framework/panels.scss
app/assets/stylesheets/framework/panels.scss
+4
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/views/projects/badges/index.html.haml
app/views/projects/badges/index.html.haml
+1
-1
app/views/shared/_ref_switcher.html.haml
app/views/shared/_ref_switcher.html.haml
+1
-2
features/steps/project/network_graph.rb
features/steps/project/network_graph.rb
+14
-6
features/steps/project/source/browse_files.rb
features/steps/project/source/browse_files.rb
+11
-3
spec/features/projects/badges/list_spec.rb
spec/features/projects/badges/list_spec.rb
+5
-3
No files found.
app/assets/stylesheets/framework/panels.scss
View file @
d2362e2e
...
...
@@ -9,6 +9,10 @@
margin-top
:
-2px
;
float
:
right
;
}
.dropdown-menu-toggle
{
line-height
:
20px
;
}
}
.panel-body
{
...
...
app/controllers/projects_controller.rb
View file @
d2362e2e
...
...
@@ -261,7 +261,7 @@ class ProjectsController < Projects::ApplicationController
# If reference is commit id - we should add it to branch/tag selectbox
if
@ref
&&
!
options
.
flatten
.
include?
(
@ref
)
&&
@ref
=~
/\A[0-9a-zA-Z]{6,52}\z/
options
<<
{
'Commits'
=>
@ref
}
options
<<
{
'Commits'
=>
@ref
}
end
render
json:
options
.
to_json
...
...
app/views/projects/badges/index.html.haml
View file @
d2362e2e
...
...
@@ -7,7 +7,7 @@
%b
Builds badge
·
=
@build_badge
.
to_html
.pull-right
=
render
'shared/ref_switcher'
,
destination:
'badges'
=
render
'shared/ref_switcher'
,
destination:
'badges'
,
align_right:
true
.panel-body
.row
.col-md-2.text-center
...
...
app/views/shared/_ref_switcher.html.haml
View file @
d2362e2e
...
...
@@ -6,9 +6,8 @@
=
hidden_field_tag
key
,
value
,
id:
nil
.dropdown
=
dropdown_toggle
@ref
||
@project
.
default_branch
,
{
toggle:
"dropdown"
,
selected:
@ref
||
@project
.
default_branch
,
refs_url:
refs_namespace_project_path
(
@project
.
namespace
,
@project
)
},
{
toggle_class:
"js-project-refs-dropdown"
}
.dropdown-menu.dropdown-menu-selectable
.dropdown-menu.dropdown-menu-selectable
{
class:
(
"dropdown-menu-align-right"
if
local_assigns
[
:align_right
])
}
=
dropdown_title
"Switch branch/tag"
=
dropdown_filter
"Search branches and tags"
=
dropdown_content
=
dropdown_loading
-# = select_tag "ref", grouped_options_refs, class: "project-refs-select select2 select2-sm"
features/steps/project/network_graph.rb
View file @
d2362e2e
...
...
@@ -20,11 +20,11 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end
step
'page should select "master" in select box'
do
expect
(
page
).
to
have_selector
'.
select2-chosen
'
,
text:
"master"
expect
(
page
).
to
have_selector
'.
dropdown-menu-toggle
'
,
text:
"master"
end
step
'page should select "v1.0.0" in select box'
do
expect
(
page
).
to
have_selector
'.
select2-chosen
'
,
text:
"v1.0.0"
expect
(
page
).
to
have_selector
'.
dropdown-menu-toggle
'
,
text:
"v1.0.0"
end
step
'page should have "master" on graph'
do
...
...
@@ -40,11 +40,19 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end
When
'I switch ref to "feature"'
do
select
'feature'
,
from:
'ref'
first
(
'.js-project-refs-dropdown'
).
click
page
.
within
'.project-refs-form'
do
click_link
'feature'
end
end
When
'I switch ref to "v1.0.0"'
do
select
'v1.0.0'
,
from:
'ref'
first
(
'.js-project-refs-dropdown'
).
click
page
.
within
'.project-refs-form'
do
click_link
'v1.0.0'
end
end
When
'click "Show only selected branch" checkbox'
do
...
...
@@ -68,11 +76,11 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
end
step
'page should select "feature" in select box'
do
expect
(
page
).
to
have_selector
'.
select2-chosen
'
,
text:
"feature"
expect
(
page
).
to
have_selector
'.
dropdown-menu-toggle
'
,
text:
"feature"
end
step
'page should select "v1.0.0" in select box'
do
expect
(
page
).
to
have_selector
'.
select2-chosen
'
,
text:
"v1.0.0"
expect
(
page
).
to
have_selector
'.
dropdown-menu-toggle
'
,
text:
"v1.0.0"
end
step
'page should have "feature" on graph'
do
...
...
features/steps/project/source/browse_files.rb
View file @
d2362e2e
...
...
@@ -290,15 +290,23 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
step
"I switch ref to 'test'"
do
select
"'test'"
,
from:
'ref'
first
(
'.js-project-refs-dropdown'
).
click
page
.
within
'.project-refs-form'
do
click_link
'test'
end
end
step
"I switch ref to fix"
do
select
"fix"
,
from:
'ref'
first
(
'.js-project-refs-dropdown'
).
click
page
.
within
'.project-refs-form'
do
click_link
'fix'
end
end
step
"I see the ref 'test' has been selected"
do
expect
(
page
).
to
have_selector
'.
select2-chosen
'
,
text:
"'test'"
expect
(
page
).
to
have_selector
'.
dropdown-toggle
'
,
text:
"'test'"
end
step
"I visit the 'test' tree"
do
...
...
spec/features/projects/badges/list_spec.rb
View file @
d2362e2e
require
'spec_helper'
feature
'list of badges'
do
include
Select2Helper
background
do
user
=
create
(
:user
)
project
=
create
(
:project
)
...
...
@@ -24,7 +22,11 @@ feature 'list of badges' do
end
scenario
'user changes current ref on badges list page'
,
js:
true
do
select2
(
'improve/awesome'
,
from:
'#ref'
)
first
(
'.js-project-refs-dropdown'
).
click
page
.
within
'.project-refs-form'
do
click_link
'improve/awesome'
end
expect
(
page
).
to
have_content
'badges/improve/awesome/build.svg'
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