diff --git a/app/assets/stylesheets/generic/common.scss b/app/assets/stylesheets/generic/common.scss index 9d3c9f372a90af6c97322d0e05fa532d9e7d593a..803219a2e862aa36841795e9dda2be778cd978bf 100644 --- a/app/assets/stylesheets/generic/common.scss +++ b/app/assets/stylesheets/generic/common.scss @@ -128,7 +128,7 @@ p.time { } .highlight_word { - border-bottom: 2px solid #F90; + background: #fafe3d; } .thin_area{ diff --git a/app/views/search/_filter.html.haml b/app/views/search/_filter.html.haml index 979b18e38563421ae662e32f836cda7fccad4b5d..416ae8fc9f547a8503d0dfdde44511197deb4d54 100644 --- a/app/views/search/_filter.html.haml +++ b/app/views/search/_filter.html.haml @@ -16,7 +16,7 @@ = link_to search_path(group_id: group.id, search: params[:search]) do = group.name -.dropdown.inline.prepend-left-10 +.dropdown.inline.prepend-left-10.project-filter %a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"} %i.icon-tags %span.light Project: diff --git a/app/views/search/_global_results.html.haml b/app/views/search/_global_results.html.haml index afecf1d3ac04db5ead08c3fe63249596328dac63..2d7968f84987ede71ba6479f6c0868ab1e45f5eb 100644 --- a/app/views/search/_global_results.html.haml +++ b/app/views/search/_global_results.html.haml @@ -1,6 +1,6 @@ .row .col-sm-3 - %ul.nav.nav-pills.nav-stacked + %ul.nav.nav-pills.nav-stacked.search-filter %li{class: ("active" if @scope == 'projects')} = link_to search_filter_path(scope: 'projects') do Projects diff --git a/app/views/search/_project_results.html.haml b/app/views/search/_project_results.html.haml index 35bc436dd18898976b389487b1e6929ded2fba5c..9b2d485fdceaf6c779296aa9645d753668e163c9 100644 --- a/app/views/search/_project_results.html.haml +++ b/app/views/search/_project_results.html.haml @@ -1,6 +1,6 @@ .row .col-sm-3 - %ul.nav.nav-pills.nav-stacked + %ul.nav.nav-pills.nav-stacked.search-filter %li{class: ("active" if @scope == 'blobs')} = link_to search_filter_path(scope: 'blobs') do %i.icon-code diff --git a/app/views/search/results/_issue.html.haml b/app/views/search/results/_issue.html.haml index 8147cf272fb526f607be7d10db19520564eff1ca..7579c99c9ed0967c77a165db90735490e1862165 100644 --- a/app/views/search/results/_issue.html.haml +++ b/app/views/search/results/_issue.html.haml @@ -1,9 +1,10 @@ %li - issue: - = link_to [issue.project, issue] do - %span ##{issue.iid} - %strong.term - = truncate issue.title, length: 50 - %span.light (#{issue.project.name_with_namespace}) + %h4 + = link_to [issue.project, issue] do + %span.term.str-truncated= issue.title + .pull-right ##{issue.iid} + %span.light + #{issue.project.name_with_namespace} - if issue.closed? - %span.label.label-danger Closed + .pull-right + %span.label.label-danger Closed diff --git a/features/dashboard/search.feature b/features/dashboard/search.feature deleted file mode 100644 index 24c450286979ff1fb9b8186f353e241c3a1e2aa9..0000000000000000000000000000000000000000 --- a/features/dashboard/search.feature +++ /dev/null @@ -1,10 +0,0 @@ -@dashboard -Feature: Dashboard Search - Background: - Given I sign in as a user - And I own project "Shop" - And I visit dashboard search page - - Scenario: I should see project I am looking for - Given I search for "Sho" - Then I should see "Shop" project link diff --git a/features/search.feature b/features/search.feature new file mode 100644 index 0000000000000000000000000000000000000000..b174d9731222eaad70fd324e1bbb3eccd82873ed --- /dev/null +++ b/features/search.feature @@ -0,0 +1,29 @@ +@dashboard +Feature: Search + Background: + Given I sign in as a user + And I own project "Shop" + And I visit dashboard search page + + Scenario: I should see project I am looking for + Given I search for "Sho" + Then I should see "Shop" project link + + Scenario: I should see issues I am looking for + And project has issues + When I search for "Foo" + And I click "Issues" link + Then I should see "Foo" link + And I should not see "Bar" link + + Scenario: I should see merge requests I am looking for + And project has merge requests + When I search for "Foo" + When I click "Merge requests" link + Then I should see "Foo" link + And I should not see "Bar" link + + Scenario: I should see project code I am looking for + When I search for "rspec" + And I click project "Shop" link + Then I should see code results for project "Shop" diff --git a/features/steps/dashboard/search.rb b/features/steps/dashboard/search.rb deleted file mode 100644 index 32966a8617a52e16675d915c803f0b96ac2fea76..0000000000000000000000000000000000000000 --- a/features/steps/dashboard/search.rb +++ /dev/null @@ -1,19 +0,0 @@ -class DashboardSearch < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - - Given 'I search for "Sho"' do - fill_in "dashboard_search", with: "Sho" - click_button "Search" - end - - Then 'I should see "Shop" project link' do - page.should have_link "Shop" - end - - Given 'I search for "Contibuting"' do - fill_in "dashboard_search", with: "Contibuting" - click_button "Search" - end -end diff --git a/features/steps/search.rb b/features/steps/search.rb new file mode 100644 index 0000000000000000000000000000000000000000..b1058989d0b969c56b819f834132c1234b88c427 --- /dev/null +++ b/features/steps/search.rb @@ -0,0 +1,73 @@ +class Spinach::Features::Search < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + step 'I search for "Sho"' do + fill_in "dashboard_search", with: "Sho" + click_button "Search" + end + + step 'I search for "Foo"' do + fill_in "dashboard_search", with: "Foo" + click_button "Search" + end + + step 'I search for "rspec"' do + fill_in "dashboard_search", with: "rspec" + click_button "Search" + end + + step 'I click "Issues" link' do + within '.search-filter' do + click_link 'Issues' + end + end + + step 'I click project "Shop" link' do + within '.project-filter' do + click_link project.name_with_namespace + end + end + + step 'I click "Merge requests" link' do + within '.search-filter' do + click_link 'Merge requests' + end + end + + step 'I should see "Shop" project link' do + page.should have_link "Shop" + end + + step 'I should see code results for project "Shop"' do + page.should have_content 'Update capybara, rspec-rails, poltergeist to recent versions' + end + + step 'I search for "Contibuting"' do + fill_in "dashboard_search", with: "Contibuting" + click_button "Search" + end + + step 'project has issues' do + create(:issue, title: "Foo", project: project) + create(:issue, title: "Bar", project: project) + end + + step 'project has merge requests' do + create(:merge_request, title: "Foo", source_project: project, target_project: project) + create(:merge_request, :simple, title: "Bar", source_project: project, target_project: project) + end + + step 'I should see "Foo" link' do + page.should have_link "Foo" + end + + step 'I should not see "Bar" link' do + page.should_not have_link "Bar" + end + + def project + @project ||= Project.find_by(name: "Shop") + end +end