summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Andrinopoulos <geoandri@gmail.com>2017-03-09 01:29:11 +0000
committerRémy Coutable <remy@rymai.me>2017-03-09 01:29:11 +0000
commit71eeb8632774dd0f7a38ac867319b8ad9182bbee (patch)
treed3d83f4ef38c2d11eb6d979eb85267d50f72a124
parent71d371cf892b88b73f0678989233bce672e56632 (diff)
downloadgitlab-ce-71eeb8632774dd0f7a38ac867319b8ad9182bbee.tar.gz
Fix wrong message on starred projects filtering
-rw-r--r--app/views/dashboard/projects/starred.html.haml2
-rw-r--r--changelogs/unreleased/28402-fix-starred-projects-filter-wrong-message-on-no-results.yml4
-rw-r--r--spec/features/dashboard/user_filters_projects_spec.rb37
3 files changed, 33 insertions, 10 deletions
diff --git a/app/views/dashboard/projects/starred.html.haml b/app/views/dashboard/projects/starred.html.haml
index 70705923d42..162ae153b1c 100644
--- a/app/views/dashboard/projects/starred.html.haml
+++ b/app/views/dashboard/projects/starred.html.haml
@@ -6,7 +6,7 @@
- if @last_push
= render "events/event_last_push", event: @last_push
-- if @projects.any?
+- if @projects.any? || params[:filter_projects]
= render 'projects'
- else
%h3 You don't have starred projects yet
diff --git a/changelogs/unreleased/28402-fix-starred-projects-filter-wrong-message-on-no-results.yml b/changelogs/unreleased/28402-fix-starred-projects-filter-wrong-message-on-no-results.yml
new file mode 100644
index 00000000000..dd94b3fe663
--- /dev/null
+++ b/changelogs/unreleased/28402-fix-starred-projects-filter-wrong-message-on-no-results.yml
@@ -0,0 +1,4 @@
+---
+title: Fix wrong message on starred projects filtering
+merge_request:
+author: George Andrinopoulos
diff --git a/spec/features/dashboard/user_filters_projects_spec.rb b/spec/features/dashboard/user_filters_projects_spec.rb
index c2e0612aef8..34d6257f5fd 100644
--- a/spec/features/dashboard/user_filters_projects_spec.rb
+++ b/spec/features/dashboard/user_filters_projects_spec.rb
@@ -1,26 +1,45 @@
require 'spec_helper'
-describe "Dashboard > User filters projects", feature: true do
+describe 'Dashboard > User filters projects', :feature do
+ let(:user) { create(:user) }
+ let(:project) { create(:project, name: 'Victorialand', namespace: user.namespace) }
+ let(:user2) { create(:user) }
+ let(:project2) { create(:project, name: 'Treasure', namespace: user2.namespace) }
+
+ before do
+ project.team << [user, :master]
+
+ login_as(user)
+ end
+
describe 'filtering personal projects' do
before do
- user = create(:user)
- project = create(:project, name: "Victorialand", namespace: user.namespace)
- project.team << [user, :master]
-
- user2 = create(:user)
- project2 = create(:project, name: "Treasure", namespace: user2.namespace)
project2.team << [user, :developer]
- login_as(user)
visit dashboard_projects_path
end
it 'filters by projects "Owned by me"' do
- click_link "Owned by me"
+ click_link 'Owned by me'
expect(page).to have_css('.is-active', text: 'Owned by me')
expect(page).to have_content('Victorialand')
expect(page).not_to have_content('Treasure')
end
end
+
+ describe 'filtering starred projects', :js do
+ before do
+ user.toggle_star(project)
+
+ visit dashboard_projects_path
+ end
+
+ it 'returns message when starred projects fitler returns no results' do
+ fill_in 'project-filter-form-field', with: 'Beta\n'
+
+ expect(page).to have_content('No projects found')
+ expect(page).not_to have_content('You don\'t have starred projects yet')
+ end
+ end
end