BigW Consortium Gitlab

Commit d2362e2e by Phil Hughes

Tests fix for ref switcher

parent deca5ef2
......@@ -9,6 +9,10 @@
margin-top: -2px;
float: right;
}
.dropdown-menu-toggle {
line-height: 20px;
}
}
.panel-body {
......
......@@ -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
......
......@@ -7,7 +7,7 @@
%b Builds badge &middot;
= @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
......
......@@ -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"
......@@ -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
......
......@@ -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
......
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment