summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/stylesheets/generic/common.scss2
-rw-r--r--app/views/search/_filter.html.haml2
-rw-r--r--app/views/search/_global_results.html.haml2
-rw-r--r--app/views/search/_project_results.html.haml2
-rw-r--r--app/views/search/results/_issue.html.haml15
-rw-r--r--features/dashboard/search.feature10
-rw-r--r--features/search.feature29
-rw-r--r--features/steps/dashboard/search.rb19
-rw-r--r--features/steps/search.rb73
9 files changed, 114 insertions, 40 deletions
diff --git a/app/assets/stylesheets/generic/common.scss b/app/assets/stylesheets/generic/common.scss
index 9d3c9f372a9..803219a2e86 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 979b18e3856..416ae8fc9f5 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 afecf1d3ac0..2d7968f8498 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 35bc436dd18..9b2d485fdce 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 8147cf272fb..7579c99c9ed 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 24c45028697..00000000000
--- 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 00000000000..b174d973122
--- /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 32966a8617a..00000000000
--- 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 00000000000..b1058989d0b
--- /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